afmformats.meta
Functions
parse_time()
: Convert a time string to “HH:MM:SS.S”
Classes
MetaDataMissingError
: Raised when meta data is missingLazyMetaValue
: A metadata value that is evaluated lazily inMetaData
MetaData
: Management of meta data variables
- class afmformats.meta.LazyMetaValue(func, *args, **kwargs)[source]
A metadata value that is evaluated lazily in
MetaData
Example usage:
meta = afmformats.meta.MetaData meta["z range"] = afmformats.meta.LazyMetaValue( np.ptp, np.arange(10))
- Parameters
func (callable) – Function to call to get the metadata value
args – arguments to
func
kwargs – Keyword arguments to
func
Inheritance
- class afmformats.meta.MetaData(*args, **kwargs)[source]
Management of meta data variables
Valid key names are defined in
afmformats.meta.KEYS_VALID
.Inheritance
- as_dict()[source]
Convert to real dictionary
This is needed e.g. for self.items such that json.dump works in combination with LazyMetaValue (which is not JSON serializable)
- copy()[source]
Create a copy of the metadata
- Returns
mdc – Copy of the MetaData class (LazyMetaValue not copied)
- Return type
- get_summary()[source]
Convenience function returning the meta data summary
Returns a dict of dicts with keys matching the DEF_* dicts. Unset values are returned as np.nan.
Variables
- afmformats.meta.IMAGING_MODALITIES
supported imaging modalities
['creep-compliance', 'force-distance', 'stress-relaxation']
- afmformats.meta.META_FIELDS
Compendium of all allowed meta data keys, sorted by topic, and including units and validation methods
{'acquisition': {'feedback mode': ['Feedback mode', '', <function vd_str_in.<locals>.str_in at 0x7f64e53d1a60>], 'imaging mode': ['Imaging modality', '', <function vd_str_in.<locals>.str_in at 0x7f64e53d1f70>], 'sensitivity': ['Sensitivity', 'm/V', <class 'float'>], 'spring constant': ['Cantilever spring constant', 'N/m', <class 'float'>]}, 'dataset': {'duration': ['Duration', 's', <class 'float'>], 'duration approach': ['Duration of approach segment', 's', <class 'float'>], 'duration retract': ['Duration of retract segment', 's', <class 'float'>], 'enum': ['Dataset index within the experiment', '', <function fint at 0x7f64e53d1ee0>], 'point count': ['Size of the dataset in points', '', <function fint at 0x7f64e53d1ee0>], 'rate approach': ['Sampling rate of approach segment', 'Hz', <class 'float'>], 'rate retract': ['Sampling rate of retract segment', 'Hz', <class 'float'>], 'segment count': ['Number of segments', '', <function fint at 0x7f64e53d1ee0>], 'setpoint': ['Target indentation force', 'N', <class 'float'>], 'speed approach': ['Piezo speed of approach segment', 'm/s', <class 'float'>], 'speed retract': ['Piezo speed of retract segment', 'm/s', <class 'float'>], 'z range': ['Axial piezo range', 'm', <class 'float'>]}, 'dataset-mod creep-compliance': {'duration intermediate': ['Duration of ' 'intermediate ' 'segment', 's', <class 'float'>]}, 'qmap': {'grid center x': ['Horizontal center of grid', 'm', <class 'float'>], 'grid center y': ['Vertical center of grid', 'm', <class 'float'>], 'grid index x': ['Horizontal grid position index', '', <function fint at 0x7f64e53d1ee0>], 'grid index y': ['Vertical grid position index', '', <function fint at 0x7f64e53d1ee0>], 'grid shape x': ['Horizontal grid shape', 'px', <function fint at 0x7f64e53d1ee0>], 'grid shape y': ['Vertical grid shape', 'px', <function fint at 0x7f64e53d1ee0>], 'grid size x': ['Horizontal grid image size', 'm', <class 'float'>], 'grid size y': ['Vertical grid image size', 'm', <class 'float'>], 'position x': ['Horizontal position', 'm', <class 'float'>], 'position y': ['Vertical position', 'm', <class 'float'>]}, 'setup': {'instrument': ['Instrument', '', <class 'str'>], 'software': ['Acquisition software', '', <class 'str'>], 'software version': ['Acquisition software version', '', <class 'str'>]}, 'storage': {'curve id': ['Curve identifier', '', <class 'str'>], 'date': ['Recording date', '', <class 'str'>], 'format': ['File format', '', <class 'str'>], 'path': ['Path', '', <class 'pathlib.Path'>], 'session id': ['Dataset identifier', '', <class 'str'>], 'time': ['Recording time', '', <class 'str'>]}}
- afmformats.meta.DEF_ALL
A dictionary for all metadata definitions
{'curve id': ['Curve identifier', '', <class 'str'>], 'date': ['Recording date', '', <class 'str'>], 'duration': ['Duration', 's', <class 'float'>], 'duration approach': ['Duration of approach segment', 's', <class 'float'>], 'duration intermediate': ['Duration of intermediate segment', 's', <class 'float'>], 'duration retract': ['Duration of retract segment', 's', <class 'float'>], 'enum': ['Dataset index within the experiment', '', <function fint at 0x7f64e53d1ee0>], 'feedback mode': ['Feedback mode', '', <function vd_str_in.<locals>.str_in at 0x7f64e53d1a60>], 'format': ['File format', '', <class 'str'>], 'grid center x': ['Horizontal center of grid', 'm', <class 'float'>], 'grid center y': ['Vertical center of grid', 'm', <class 'float'>], 'grid index x': ['Horizontal grid position index', '', <function fint at 0x7f64e53d1ee0>], 'grid index y': ['Vertical grid position index', '', <function fint at 0x7f64e53d1ee0>], 'grid shape x': ['Horizontal grid shape', 'px', <function fint at 0x7f64e53d1ee0>], 'grid shape y': ['Vertical grid shape', 'px', <function fint at 0x7f64e53d1ee0>], 'grid size x': ['Horizontal grid image size', 'm', <class 'float'>], 'grid size y': ['Vertical grid image size', 'm', <class 'float'>], 'imaging mode': ['Imaging modality', '', <function vd_str_in.<locals>.str_in at 0x7f64e53d1f70>], 'instrument': ['Instrument', '', <class 'str'>], 'path': ['Path', '', <class 'pathlib.Path'>], 'point count': ['Size of the dataset in points', '', <function fint at 0x7f64e53d1ee0>], 'position x': ['Horizontal position', 'm', <class 'float'>], 'position y': ['Vertical position', 'm', <class 'float'>], 'rate approach': ['Sampling rate of approach segment', 'Hz', <class 'float'>], 'rate retract': ['Sampling rate of retract segment', 'Hz', <class 'float'>], 'segment count': ['Number of segments', '', <function fint at 0x7f64e53d1ee0>], 'sensitivity': ['Sensitivity', 'm/V', <class 'float'>], 'session id': ['Dataset identifier', '', <class 'str'>], 'setpoint': ['Target indentation force', 'N', <class 'float'>], 'software': ['Acquisition software', '', <class 'str'>], 'software version': ['Acquisition software version', '', <class 'str'>], 'speed approach': ['Piezo speed of approach segment', 'm/s', <class 'float'>], 'speed retract': ['Piezo speed of retract segment', 'm/s', <class 'float'>], 'spring constant': ['Cantilever spring constant', 'N/m', <class 'float'>], 'time': ['Recording time', '', <class 'str'>], 'z range': ['Axial piezo range', 'm', <class 'float'>]}
- afmformats.meta.KEYS_VALID
List of all valid meta data keys
['curve id', 'date', 'duration', 'duration approach', 'duration intermediate', 'duration retract', 'enum', 'feedback mode', 'format', 'grid center x', 'grid center y', 'grid index x', 'grid index y', 'grid shape x', 'grid shape y', 'grid size x', 'grid size y', 'imaging mode', 'instrument', 'path', 'point count', 'position x', 'position y', 'rate approach', 'rate retract', 'segment count', 'sensitivity', 'session id', 'setpoint', 'software', 'software version', 'speed approach', 'speed retract', 'spring constant', 'time', 'z range']