afmformats.formats

Functions

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

AFMFormatRecipe

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

class afmformats.formats.AFMFormatRecipe(recipe)[source]

A wrapper class for file format recipes

Parameters

recipe (dict) – file format recipe

Inheritance

Inheritance diagram of AFMFormatRecipe
detect(path)[source]

Determine whether path can be opened with this recipe

Returns

valid – True if path is openable, False otherwise.

Return type

bool

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'>}
afmformats.formats.formats_available

available/supported file formats

[<AFMFormatRecipe from 'afmformats.formats.fmt_hdf5' at 0x7f33d2d4fc70>,
 <AFMFormatRecipe from 'afmformats.formats.fmt_igor' at 0x7f33d2d4fbb0>,
 <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f33d2d25fa0>,
 <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f33d2d3a130>,
 <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f33d2d3a190>,
 <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f33d2d3a1f0>,
 <AFMFormatRecipe from 'afmformats.formats.fmt_ntmdt_txt' at 0x7f33d2d3a250>,
 <AFMFormatRecipe from 'afmformats.formats.fmt_tab' at 0x7f33d2d3a2b0>,
 <AFMFormatRecipe from 'afmformats.formats.fmt_workshop.ws_map' at 0x7f33d2d3a310>,
 <AFMFormatRecipe from 'afmformats.formats.fmt_workshop.ws_single' at 0x7f33d2d3a370>]
afmformats.formats.formats_by_suffix

available file formats in a dictionary with suffix keys

{'.csv': [<AFMFormatRecipe from 'afmformats.formats.fmt_workshop.ws_single' at 0x7f33d2d3a370>],
 '.h5': [<AFMFormatRecipe from 'afmformats.formats.fmt_hdf5' at 0x7f33d2d4fc70>],
 '.ibw': [<AFMFormatRecipe from 'afmformats.formats.fmt_igor' at 0x7f33d2d4fbb0>],
 '.jpk-force': [<AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f33d2d25fa0>],
 '.jpk-force-map': [<AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f33d2d3a130>],
 '.jpk-qi-data': [<AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f33d2d3a190>],
 '.jpk-qi-series': [<AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f33d2d3a1f0>],
 '.tab': [<AFMFormatRecipe from 'afmformats.formats.fmt_tab' at 0x7f33d2d3a2b0>],
 '.txt': [<AFMFormatRecipe from 'afmformats.formats.fmt_ntmdt_txt' at 0x7f33d2d3a250>],
 '.zip': [<AFMFormatRecipe from 'afmformats.formats.fmt_workshop.ws_map' at 0x7f33d2d3a310>]}
afmformats.formats.formats_by_modality

available file formats in a dictionary for each modality

{'creep-compliance': [<AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f33d2d25fa0>,
                      <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f33d2d3a130>,
                      <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f33d2d3a190>,
                      <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f33d2d3a1f0>],
 'force-distance': [<AFMFormatRecipe from 'afmformats.formats.fmt_hdf5' at 0x7f33d2d4fc70>,
                    <AFMFormatRecipe from 'afmformats.formats.fmt_igor' at 0x7f33d2d4fbb0>,
                    <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f33d2d25fa0>,
                    <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f33d2d3a130>,
                    <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f33d2d3a190>,
                    <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f33d2d3a1f0>,
                    <AFMFormatRecipe from 'afmformats.formats.fmt_ntmdt_txt' at 0x7f33d2d3a250>,
                    <AFMFormatRecipe from 'afmformats.formats.fmt_tab' at 0x7f33d2d3a2b0>,
                    <AFMFormatRecipe from 'afmformats.formats.fmt_workshop.ws_map' at 0x7f33d2d3a310>,
                    <AFMFormatRecipe from 'afmformats.formats.fmt_workshop.ws_single' at 0x7f33d2d3a370>],
 'stress-relaxation': [<AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f33d2d25fa0>,
                       <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f33d2d3a130>,
                       <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f33d2d3a190>,
                       <AFMFormatRecipe from 'afmformats.formats.fmt_jpk' at 0x7f33d2d3a1f0>]}
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']