# HDF5 File Mapping (HDFMap)¶

HDFMap constructs the mapping for a given HDF5 file. When a HDF5 file is opened with File, HDFMap is automatically called to construct the map and an instance of the mapping object is bound to the file object as file_map. Thus, the file mappings for test.hdf5 can be accessed like:

>>> f = lapd.File('test.hdf5')
>>> f.file_map
<bapsflib._hdf.maps.core.HDFMap>


## Architecture¶

HDFMap takes a modular approach to mapping a HDF5 file. It contains a dictionary of known modules with known layouts. If one or more of these layouts are discovered inside the HDF5 file, then the associated mappings are added to the mapping object. There are five module categories:

msi diagnostic

This is any sub-group of the '/MSI/' group that represents a diagnostic device. A diagnostic device is a probe or sensor that records machine state data for every experimental run.

digitizer

This is any group inside the '/Raw data + config/' group that is associated with a digitizer. A digitizer is a device that records “primary” data; that is, data recorded for a plasma probe.

control device

This is any group inside the '/Raw data + config/' group that is associated with a device that controls a plasma probe. The recorded data is state data for the plasma probe; for example, probe position, bias, driving frequency, etc.

data run sequence

This is the /Raw data + config/Data run sequence/' group which records the run sequence (operation sequence) of the LaPD DAQ controller.

unknown

This is any group or dataset in '/', '/MSI/', or '/Raw data + config/' groups that is not known by HDFMap or is unsuccessfully mapped.

## Basic Usage¶

### Retrieving Active Digitizers¶

A list of all detected digitizers can be obtain by doing

>>> list(f.file_map.digitizers)


The file mappings for all the active digitizers are stored in the dictionary f.file_map.digitizers such that

>>> list(f.file_map.digitizers.keys())
Out: list of strings of all active digitizer names

>>> f.file_map.digitizer[digi_name]
Out: digitizer mapping object