afmformats.afm_data

Classes

  • AFMData: General base class for AFM data

class afmformats.afm_data.AFMData(data, metadata, diskcache=False)[source]

General base class for AFM data

Initialization

Parameters
  • data (dict-like) – Experimental data

  • metadata (dict) – Metadata

  • diskcache (bool) – TODO

Inheritance

Inheritance diagram of AFMData
export_data(out, metadata=True, fmt='tab')[source]

Export all data columns to a file

Parameters
  • out (str, pathlib.Path, writable io.IOBase, or h5py.Group) – Output path, open file, or h5py object

  • metadata (bool or list) – If True, all available metadata are stored. If False, no metadata are stored. If a list, only the given metadata keys are stored.

  • fmt (str) – “tab” for the tab separated values format and “hdf5” / “h5” for the HDF5 file format

Notes

  • If you wish to append HDF5 data to an existing file, please open the file first and call this function with the h5py.File object, i.e.

    with h5py.File(path, "a") as h5:
        fdist.export(out=h5, fmt="hdf5")
    

    Otherwise the file will be overridden.

  • The column “index” is not exported in the HDF5 file format

reset_data()[source]

Resets all data to the state they were after loading

Internally, only self._data is clear`ed, which means that all calls to `__getitem__ fall-back to self._raw_data.

property columns

Available data columns

property columns_innate

Data columns available only in the original data file

property enum

Unique index of self in self.path

Indexing starts at “0”

property metadata

Unique index of self in self.path

abstract property modality

Imaging modality (e.g. force-distance)

property path

Path to the measurement file

Variables

afmformats.afm_data.column_dtypes

Data types of all known columns (all other columns are assumed to be float)

{'force': <class 'float'>,
 'height (measured)': <class 'float'>,
 'height (piezo)': <class 'float'>,
 'index': <class 'int'>,
 'segment': <class 'numpy.uint8'>,
 'time': <class 'float'>,
 'tip position': <class 'float'>}
afmformats.afm_data.column_units

Units of all known columns

{'force': 'N',
 'height (measured)': 'm',
 'height (piezo)': 'm',
 'index': '',
 'segment': '',
 'time': 's',
 'tip position': 'm'}
afmformats.afm_data.known_columns

Known data columns

['force',
 'height (measured)',
 'height (piezo)',
 'index',
 'segment',
 'time',
 'tip position']