HDFMapper

class bapsflib._hdf.maps.mapper.HDFMapper(hdf_obj: File, control_path: str, digitizer_path: str, msi_path: str)

Bases: object

Constructs a complete file mapping of the HDF5 file. This is utilized by the HDF5 utility classes (in module bapsflib._hdf.utils) to manipulate and read data out of the HDF5 file.

Parameters:
  • hdf_obj (h5py.File) – the HDF5 file object

  • control_path (str) – internal HDF5 path to group containing control devices

  • digitizer_path (str) – internal HDF5 path to group containing digitizers

  • msi_path (str) – internal HDF5 path to group containing MSI diagnostics

Notes

The following classes are leveraged to construct the mappings:

Attributes Summary

controls

Dictionary of all the control device mapping objects.

digitizers

Dictionary of all the digitizer device mapping objects.

main_digitizer

Mapping object for the digitizer that is assumed to be the main digitizer in digitizers.

msi

Dictionary of all the MSI diagnostic mapping objects.

unknowns

List of all subgroup and dataset paths in the HDF5 root group, control device group, digitizer group, and MSI group that were not mapped.

Methods Summary

get(name)

Get a device mapping instance.

Attributes Documentation

controls

Dictionary of all the control device mapping objects.

Examples

How to retrieve the mapping object of the control device '6K Compumotor':

fmap = HDFMapper(file_obj)
dmap = fmap.controls['6K Compumotor']
digitizers

Dictionary of all the digitizer device mapping objects.

Examples

How to retrieve the mapping object of the digitizer 'SIS 3301':

fmap = HDFMapper(file_obj)
dmap = fmap.digitizers['SIS 3301']
main_digitizer

Mapping object for the digitizer that is assumed to be the main digitizer in digitizers.

Notes

The main digitizer is determined by scanning through the local tuple possible_candidates that contains a hierarchical list of digitizers. The first digitizer found is assumed to be the main digitizer.

msi

Dictionary of all the MSI diagnostic mapping objects.

Examples

How to retrieve the mapping object of the 'Magnetic field' MSI diagnostic:

fmap = HDFMapper(file_obj)
dmap = fmap.msi['Magnetic field']
unknowns

List of all subgroup and dataset paths in the HDF5 root group, control device group, digitizer group, and MSI group that were not mapped.

Methods Documentation

get(name: str)

Get a device mapping instance. Returns None if no mapping instance for name is found.

Parameters:

name (str) – name of desired device

Examples

How to retrieve the mapping object for the 'SIS 3301' digitizer:

>>> fmap = HDFMapper(file_obj)
>>> dmap = fmap.get('SIS 3301')
>>>
>>> # which is equivalent to
>>> dmap = fmap.digitizers['SIS 3301']