HDFMapMSITemplate
- class bapsflib._hdf.maps.msi.templates.HDFMapMSITemplate(group: Group)
Bases:
HDFMapTemplate,ABCTemplate class for all MSI diagnostic mapping classes to inherit from.
Note
To fully define a subclass the
_build_configsabstract method needs to be defined.- abstractmethod _build_configs()
Inspect the HDF5 group and build the configuration dictionary,
configs.Functionality should specifically populate
self._configsinstead ofself.configs. If a mapping fails, then aHDFMappingErrorshould be raised.
If a subclass needs to initialize additional variables before
_build_configsis called in the__init__, then those routines can be defined in the_init_before_build_configsmethod.- _init_before_build_configs()
Any initialization that needs to be performed before executing
self._build_configsin__init__.By default we do nothing, but subclasses can override this for their specific purposes.
- Parameters:
group (
h5py.Group) – The HDF5 to apply the mapping to.
Attributes Summary
Dictionary containing all the relevant mapping information to translate the corresponding device data in the HDF5 file and provide a consistent user interface via
File.List of names of the HDF5 datasets within the mapped group, at the root level.
Name of MSI diagnostic (device)
Instance of the HDF5 group that was mapped.
Name of the mapped HDF5 group.
Path of the mapped HDF5 group in the HDF5 file.
Metadata information about the mapping type and the mapped group location in the HDF5 file.
Mapping class type (
MapTypes).List of names of the HDF5 subgroups within the mapped group, at the root level.
Attributes Documentation
- configs
Dictionary containing all the relevant mapping information to translate the corresponding device data in the HDF5 file and provide a consistent user interface via
File.Notes
The information stored in this
configsdictionary is used byHDFReadMSIto build the MSInumpyarray from the associated HDF5 dataset(s).The
configsdict is broken into a set of required keys ('shape','shotnum','signals', and'meta') and optional keys. The required keys are used byHDFReadMSIto extract the MSI data and build thenumpyarrays. Any optional key is considered as meta-data and is included in theinfoattribute of the constructed MSInumpyarray.Key
Description
configs['shape']
This is used as the
shapefor theHDFReadMSIconstructednumpyarray and typically looks like:configs['shape'] = (nsn, )
where
nsnis the number of shot numbers saved to the diagnostics’s datasets.configs['shotnum']
Specifies the dataset(s) containing the recorded HDF5 shot numbers. This maps to the
'shotnum'field of thenumpyarray constructed byHDFReadMSI. Should look like:configs['shotnum'] = { 'dset paths': ('/foo/bar/d1',), 'dset field': ('Shot number',), 'shape': (), 'dtype': numpy.int32, }
where
'dset paths'is the internal HDF5 path to the dataset(s),'dset field'is the field name of the dataset containing shot numbers,'shape'of the shot number data, and'dtype'is thenumpydtypethat the'shotnum'field of the constructednumpyarray will be.configs['signals']
A dictionary that maps MSI data signals to the
numpyarray constructed byHDFReadMSI. Each key in this dictionary corresponds to a field name inHDFReadMSIarray and the value defines the data location in the HDF5 file. For example,configs['signals'] = { 'current': { 'dset paths': ('/foo/bar/dset',), 'dset field': (), 'shape': (100,), 'dtype': numpy.float32, }, }
would create a
'current'field in the constructednumpyarray. Any field specified in this key is considered to be your plot-able, or “primary”, diagnostic data.configs['meta']
This is another dictionary specifying meta-data that is both diagnostic and shot number specific. For example,
configs['meta'] = { 'shape': (), 'max current': { 'dset paths': ('/foo/bar/dset',), 'dset field': ('Max current',), 'shape': (), 'dtype': numpy.float32}, }
would create a
'max current'field in the'meta'field of the constructednumpyarray.Note
For further details, look to Adding a MSI Diagnostic Mapping Module.
- dataset_names
List of names of the HDF5 datasets within the mapped group, at the root level.
- device_name
Name of MSI diagnostic (device)
- group
Instance of the HDF5 group that was mapped.
- group_name
Name of the mapped HDF5 group.
- group_path
Path of the mapped HDF5 group in the HDF5 file.
- info
Metadata information about the mapping type and the mapped group location in the HDF5 file.
Extended Summary
The dictionary will contain the following elements:
info = { "group name": "Device", # name of the mapped HDF5 group "group path": "/foo/bar/Device", # internal HDF5 path to the group "maptype": self.maptype, # mapping class type }
- maptype
Mapping class type (
MapTypes).
- subgroup_names
List of names of the HDF5 subgroups within the mapped group, at the root level.