afmformats.formats.fmt_hdf5

Functions

  • load_hdf5(): Loads HDF5 files as exported by afmformats

afmformats.formats.fmt_hdf5.load_hdf5(path_or_h5, callback=None, meta_override=None)[source]

Loads HDF5 files as exported by afmformats

The HDF5 format is self explanatory. The root attributes contain the version of afmformats used to create it. For each curve, one group is created, named according to “0”, “1”, … “9”, “10”, “11”, etc. The attributes of each group are key-value pairs defined in afmformats.meta.KEYS_VALID. The group contains datasets named according to afmformats.afm_data.known_columns and have the attribute “unit” with the corresponding value in afmformats.afm_data.column_units.

Parameters
  • path_or_h5 (str or pathlib.Path or h5py.Group) – path to HDF5 file or an HDF5 group

  • callback (callable) – function for progress tracking; must accept a float in [0, 1] as an argument.

  • meta_override (dict) – if specified, contains key-value pairs of metadata that are used when loading the files (see afmformats.meta.META_FIELDS)

Notes

In case path_or_h5 is a h5py.Group object, the “path” metadata variable will always be set to the path of the original HDF5 file. Keep this in mind if you think about storing multiple datasets (each containing multiple curves) in one HDF5 file (bad idea).

Classes

class afmformats.formats.fmt_hdf5.H5DictReader(path_or_h5, enum_key)[source]

Read-only HDF5-based dictionary for arrays

Parameters
  • path_or_h5 (str or pathlib.Path or h5py.Group) – Path to HDF5 file or an HDF5 group

  • enum_key (str) – Name of the subgroup in path_or_h5 that contains the data of the dictionary

Inheritance

Inheritance diagram of H5DictReader