afmformats.formats
Submodules
Functions
find_data()
: Recursively find valid AFM data filesget_recipe()
: Return the file format recipe for a given pathload_data()
: Load AFM data
- afmformats.formats.find_data(path, modality=None)[source]
Recursively find valid AFM data files
- Parameters
path (str or pathlib.Path) – file or directory
modality (str) – modality of the measurement (“force-distance”)
- Returns
file_list – list of valid AFM data files
- Return type
list of pathlib.Path
- afmformats.formats.get_recipe(path, modality=None)[source]
Return the file format recipe for a given path
- Parameters
path (str or pathlib.Path) – file or directory
modality (str) – modality of the measurement (see
IMAGING_MODALITIES
)
- Returns
recipe – file format recipe
- Return type
- afmformats.formats.load_data(path, meta_override=None, modality=None, data_classes_by_modality=None, diskcache=False, callback=None)[source]
Load AFM data
- Parameters
path (str or pathlib.Path) – Path to AFM data file
meta_override (dict) – Metadata dictionary that overrides experimental metadata
modality (str) – Which acquisition modality to use (e.g. “force-distance”)
data_classes_by_modality (dict) – Override the default AFMData class to use for managing the data (see
default_data_classes_by_modality
): This is e.g. used by index to pass Indentation (which is a subclass of the default AFMForceDistance) for handling “force-indentation” data.diskcache (bool) – Whether to use caching (not implemented)
callback (callable) – A method that accepts a float between 0 and 1 to externally track the process of loading the data
- Returns
afm_list – List where each element is on AFMData curve
- Return type
list of afmformats.afm_data.AFMData
Classes
AFMFormatRecipe
: Undocumented.
- class afmformats.formats.AFMFormatRecipe(recipe)[source]
A wrapper class for file format recipes
- Parameters
recipe (dict) – file format recipe
Inheritance
- detect(path)[source]
Determine whether path can be opened with this recipe
- Returns
valid – True if path is openable, False otherwise.
- Return type
Notes
If the underlying recipe does not implement a “detect” function, then only the file extension is checked.
- get_modality(path)[source]
Determine modality of a path
If a recipe provides several modalities, load the dataset and get the modality from the metadata.
- property descr
description of file format
- property loader
method for loading the data
- property maker
who introduced the file format
- property modalities
list of supported AFM imaging modalities
- property suffix
file format suffix
Variables
- afmformats.formats.default_data_classes_by_modality
dictionary with default data classes for each modality
{'creep-compliance': <class 'afmformats.mod_creep_compliance.AFMCreepCompliance'>, 'force-distance': <class 'afmformats.mod_force_distance.AFMForceDistance'>, 'stress-relaxation': <class 'afmformats.mod_stress_relaxation.AFMStressRelaxation'>}
- afmformats.formats.formats_available
available/supported file formats
[<AFMFormatRecipe from 'afmformats.formats.fmt_hdf5' at 0x7f06d9803520>, <AFMFormatRecipe from 'afmformats.formats.fmt_igor' at 0x7f06d9803400>, <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f06d9726d60>, <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f06d9726eb0>, <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f06d9726f10>, <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f06d9726f70>, <AFMFormatRecipe from 'afmformats.formats.fmt_ntmdt_txt' at 0x7f06d9726fd0>, <AFMFormatRecipe from 'afmformats.formats.fmt_tab' at 0x7f06d9731070>, <AFMFormatRecipe from 'afmformats.formats.fmt_workshop.ws_map' at 0x7f06d97310d0>, <AFMFormatRecipe from 'afmformats.formats.fmt_workshop.ws_single' at 0x7f06d9731130>]
- afmformats.formats.formats_by_suffix
available file formats in a dictionary with suffix keys
{'.csv': [<AFMFormatRecipe from 'afmformats.formats.fmt_workshop.ws_single' at 0x7f06d9731130>], '.h5': [<AFMFormatRecipe from 'afmformats.formats.fmt_hdf5' at 0x7f06d9803520>], '.ibw': [<AFMFormatRecipe from 'afmformats.formats.fmt_igor' at 0x7f06d9803400>], '.jpk-force': [<AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f06d9726d60>], '.jpk-force-map': [<AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f06d9726eb0>], '.jpk-qi-data': [<AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f06d9726f10>], '.jpk-qi-series': [<AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f06d9726f70>], '.tab': [<AFMFormatRecipe from 'afmformats.formats.fmt_tab' at 0x7f06d9731070>], '.txt': [<AFMFormatRecipe from 'afmformats.formats.fmt_ntmdt_txt' at 0x7f06d9726fd0>], '.zip': [<AFMFormatRecipe from 'afmformats.formats.fmt_workshop.ws_map' at 0x7f06d97310d0>]}
- afmformats.formats.formats_by_modality
available file formats in a dictionary for each modality
{'creep-compliance': [<AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f06d9726d60>, <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f06d9726eb0>, <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f06d9726f10>, <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f06d9726f70>], 'force-distance': [<AFMFormatRecipe from 'afmformats.formats.fmt_hdf5' at 0x7f06d9803520>, <AFMFormatRecipe from 'afmformats.formats.fmt_igor' at 0x7f06d9803400>, <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f06d9726d60>, <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f06d9726eb0>, <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f06d9726f10>, <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f06d9726f70>, <AFMFormatRecipe from 'afmformats.formats.fmt_ntmdt_txt' at 0x7f06d9726fd0>, <AFMFormatRecipe from 'afmformats.formats.fmt_tab' at 0x7f06d9731070>, <AFMFormatRecipe from 'afmformats.formats.fmt_workshop.ws_map' at 0x7f06d97310d0>, <AFMFormatRecipe from 'afmformats.formats.fmt_workshop.ws_single' at 0x7f06d9731130>], 'stress-relaxation': [<AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f06d9726d60>, <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f06d9726eb0>, <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f06d9726f10>, <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f06d9726f70>]}
- afmformats.formats.supported_extensions
list of supported extensions
['.csv', '.h5', '.ibw', '.jpk-force', '.jpk-force-map', '.jpk-qi-data', '.jpk-qi-series', '.tab', '.txt', '.zip']