Commit e42233e7 authored by Kyle Larsen's avatar Kyle Larsen
Browse files

Fixed docstrings for Sphinx (with numpydoc).

parent 4277f931
......@@ -3,11 +3,13 @@ from pyMFD.FV import FV
from pyMFD.summarize import comp_mat_inspector
from pyMFD.cantilever import calc_modulus
import matplotlib.pyplot as plt
import os
use_inspector = False
spm_file = "data/examples/02041411.001" # Example force-volume scan
fv = FV(spm_file) # Load force-volume scan
path = os.path.abspath(os.path.dirname(__file__))
spm_file = os.path.join(path, "data/examples/02041411.001") # Example force-volume scan
fv = FV(spm_file) # Load force-volume scan
print(fv.tm_defl.shape)
......
......@@ -32,6 +32,17 @@ class FV:
Function that returns the force-volume data.
_sc_params_func : function
Function that returns the `sv_params` dictionary.
Methods
-------
get_extend():
Get extenstion ramp data
get_retract():
Get retraction ramp data
get_pixel_size([scan_size, scan_points]):
Get pixel size
summarize([which_dir, summary_func]):
Summarize the ramp data (i.e. extract compliance)
'''
def __init__(
......@@ -146,6 +157,8 @@ class FV:
Function that will perform the summary. By default, this is a function that takes `z_piezo`,
`tm_defl`, and `sc_params` and returns the compliance matrix and R^2 matrix (how well each curve
was summarized).
**kwargs : dict
Arguments that are passed to `summary_func`.
Returns
-------
......@@ -159,7 +172,7 @@ class FV:
See Also
--------
See `get_comp_mat()`.
pyMFD.summarize.get_comp_mat
'''
if which_dir == 'trace' or which_dir == 'extend' or which_dir == 0:
which_dir = 0
......
......@@ -14,27 +14,30 @@ def read_fv_header(filename: str) -> dict:
Read the header information from a Bruker/Veeco Nanoscope v7.2 file.
Returns a dictionary containing all of the lines from the header
organized under the sections:
- FFL = b'*Force file list'
- CFIL = b'*Ciao force image list'
- CIL = b'*Ciao image list'
- SL = b'*Scanner list'
- CSL = b'*Ciao scan list'
- FFL = b'\*Force file list'
- CFIL = b'\*Ciao force image list'
- CIL = b'\*Ciao image list'
- SL = b'\*Scanner list'
- CSL = b'\*Ciao scan list'
Nanoscope header files are a mess. There will be different sections
depending on the type of data in the file. For more information see
Nanoscope User Guide and this informative forum post:
- https://physics-astronomy-manuals.wwu.edu/Nanosocpe%207.3%20User%20Guide.pdf (broken link as of 2/23/2022)
- http://nanoqam.ca/wiki/lib/exe/fetch.php?media=nanoscope_software_8.10_user_guide-d_004-1025-000_.pdf
- http://nanoscaleworld.bruker-axs.com/nanoscaleworld/forums/p/538/1065.aspx
In the file header some parameters start with '\@' instead of simply
'\'. This is an indication to the software that the data that follows
- [Nanoscope 7.3](https://physics-astronomy-manuals.wwu.edu/Nanosocpe%207.3%20User%20Guide.pdf) (broken link as of 2/23/2022)
- [Nanoscope 8.10](http://nanoqam.ca/wiki/lib/exe/fetch.php?media=nanoscope_software_8.10_user_guide-d_004-1025-000\_.pdf)
- [Forum post](http://nanoscaleworld.bruker-axs.com/nanoscaleworld/forums/p/538/1065.aspx)
In the file header some parameters start with '\\@' instead of simply
'\\'. This is an indication to the software that the data that follows
is intended for a CIAO parameter object. After the '@', you might see a
number followed by a colon before the label. This number is what is
called a “group number” and can generally be ignored.
Further, after the label and its colon, you will see a single
definition character of 'V', 'C', or 'S'.
- V means _Value_ -- a parameter that contains a double and a unit of
measure, and some scaling definitions.
- C means _Scale_ -- a parameter that is simply a scaled version of
......@@ -112,6 +115,7 @@ def convert_params(old_params, custom_to_extract = []):
These are the parameters we need:
CFIL
- Data offset
- Data length
- Bytes/pixel
......@@ -119,10 +123,12 @@ def convert_params(old_params, custom_to_extract = []):
- @4:Ramp size
CSL
- Samps/line
- @2:TMDeflectionLimit
SL
- @Sens. Zsens
Parameters
......@@ -132,8 +138,8 @@ def convert_params(old_params, custom_to_extract = []):
custom_to_extract : array of tuples, optional
This function will also convert any additional parameters provided
here. Follow tuple format in function:
(Section, Parameter Name, New parameter name, Function to convert
from bytestring to desired type)
(Section, Parameter Name, New parameter name, Function to convert
from bytestring to desired type)
Returns
-------
......@@ -190,8 +196,9 @@ def read_fv_data(filename: str, params: dict) -> np.ndarray:
extend and retract).
For example, a 64x64 with 1024 samples per force-ramp will have a data
length of:
- 64^2 * 1024 * 2 = 8388608
length of::
64^2 * 1024 * 2 = 8388608
This length should be recorded in the header as `\*Ciao force image
list\Data length` (keeping in mind the bytes/pixel).
......
......@@ -6,35 +6,35 @@ def get_scan_params(sp_filename: str) -> dict:
The following is an example scan parameter file, with annotation.
JSON does not support comments, so anything after (and including) '#'
should be removed.
should be removed::
{
"name": "02041411.001", # Required
"growth": "Polished12072018",
"sample": "D1",
"afm_spring_constant": 39, # Required [N/m]
"afm_tip": "tip19",
"thickness": 160E-9, # Required [m]
"ignored": false,
"cantilevers": [ # Required (at least one cantilever definition)
{
"name": "D1a2", # Required
"width": 2.7E-6, # Required [m]
"lin_ignore": 0,
"fixed_edge": 24, # Required (guess in pixels at fixed end location relative to left side of scan)
"start": [26, 13], # Required (top left corner [x, y] in pixels of cantilever)
"end": [38, 22] # Required (bottom right corner [x, y] in pixels of cantilever)
},
{
"name": "D1a1",
"width": 2.7E-6,
"lin_ignore": 0,
"fixed_edge": 26,
"start": [28, 38],
"end": [44, 49]
}
]
}
{
"name": "02041411.001", # Required
"growth": "Polished12072018",
"sample": "D1",
"afm_spring_constant": 39, # Required [N/m]
"afm_tip": "tip19",
"thickness": 160E-9, # Required [m]
"ignored": false,
"cantilevers": [ # Required (at least one cantilever definition)
{
"name": "D1a2", # Required
"width": 2.7E-6, # Required [m]
"lin_ignore": 0,
"fixed_edge": 24, # Required (guess in pixels at fixed end location relative to left side of scan)
"start": [26, 13], # Required (top left corner [x, y] in pixels of cantilever)
"end": [38, 22] # Required (bottom right corner [x, y] in pixels of cantilever)
},
{
"name": "D1a1",
"width": 2.7E-6,
"lin_ignore": 0,
"fixed_edge": 26,
"start": [28, 38],
"end": [44, 49]
}
]
}
Parameters
----------
......
......@@ -98,19 +98,23 @@ def line_slope(z_piezo, z_tip, index = None):
(The following diagram may not display properly in IDE tooltips.)
\
\ ^
\ |
\ __________________ z_tip
\ / |
\/ v
0123456789... <- z_piezo index
::
\\
\ ^
\ |
\ __________________ z_tip
\ / |
\/ v
0123456789... <- z_piezo index
Algorithm needs to find slope of the linear section from 0 to 5.
However, the data is rarely this nice. A robust algorithm is needed
to handle most cases.
Get an initial (start, end) estimate using `get_start_end()`.
- `get_start_end()` takes the derivative of z_tip and finds the
z_piezo location where that derivative is highest. This is the end
point.
......@@ -123,6 +127,7 @@ def line_slope(z_piezo, z_tip, index = None):
force ramp. If R^2 is greater than 0.9, then this slope is returned.
Otherwise, decrease the end value, fit again, and check R^2. This is
repeated until any of these conditions are met:
- R^2 is greater than 0.9, or
- There are less than 15 points between the start and end values, or
- The process has looped through 10 times without meeting either of
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment