HDFMapControlWaveform¶
- class bapsflib._hdf.maps.controls.waveform.HDFMapControlWaveform(group: Group)¶
Bases:
HDFMapControlCLTemplate
Mapping module for the ‘Waveform’ control device.
Simple group structure looks like:
+-- Waveform | +-- Run time list | +-- waveform_<descr> | | +--
- Parameters:
group – the HDF5 control device group
Attributes Summary
Dictionary containing all the relevant mapping information to translate the HDF5 data into a numpy array by
HDFReadControls
.control device type
list of names of the HDF5 datasets in the control group
Name of Control device
Instance of the HDF5 Control Device group
- return:
True
if dataset utilizes a command list
Control device dictionary of meta-info. For example, ::.
'True'
if each control configuration has its own datasetlist of names of the HDF5 sub-groups in the control group
Methods Summary
clparse
(config_name)Return instance of
CLParse
forconfig_name
.construct_dataset_name
(*args)Constructs name of dataset containing control state value data.
reset_state_values_config
(config_name[, ...])Reset the
configs[config_name]['state values']
dictionary.set_state_values_config
(config_name, patterns)Rebuild and set
configs[config_name]['state values']
based on the supplied RE patterns.Attributes Documentation
- configs¶
Dictionary containing all the relevant mapping information to translate the HDF5 data into a numpy array by
HDFReadControls
.– Constructing
configs
–The
configs
dict is a nested dictionary where the first level of keys represents the control device configuration names. Each configuration corresponds to one dataset in the HDF5 control group and represents a grouping of state values associated with an probe or instrument used during an experiment.Each configuration is a dictionary consisting of a set of required keys (
'dset paths'
,'shotnum'
, and'state values'
) and optional keys. Any optional key is considered as meta-info for the device and is added to theinfo
dictionary when the numpy array is constructed. The required keys constitute the mapping for constructing the numpy array and are explained in the table below.¶ Key
Description
config['dset paths']
Internal HDF5 path to the dataset associated with the control device configuration. For example,
config['dset paths'] = ('/foo/bar/Control/d1', )
config['shotnum']
Defines how the run shot numbers are stored in the HDF5 file, which are mapped to the
'shotnum'
field of the constructed numpy array. Should look like,config['shotnum'] = { 'dset paths': config['dset paths'], 'dset field': ('Shot number',), 'shape': (), 'dtype': numpy.int32, }
where
'dset paths'
is the internal HDF5 path to the dataset,'dset field'
is the field name of the dataset containing shot numbers,'shape'
is the numpy shape of the shot number data, and'dtype'
is the numpydtype
of the data. This all defines the numpydtype
of the'shotnum'
field in theHDFReadControls
constructed numpy array.config['state values']
This is another dictionary defining
'state values
. For example,config['state values'] = { 'xyz': { 'dset paths': config['dset paths'], 'dset field': ('x', 'y', 'z'), 'shape': (3,), 'dtype': numpy.float32} }
will tell
HDFReadControls
to construct a numpy array with a the'xyz'
field. This field would be a 3-element array ofnumpy.float32
, where the'x'
field of the HDF5 dataset is mapped to the 1st index,'y'
is mapped to the 2nd index, and'z'
is mapped to the 3rd index.Note:
A state value field (key) can not be defined as
'signal'
since this field is reserved for digitizer data constructed byHDFReadData
.If state value data represents probe position data, then it should be given the field name (key)
'xyz'
(like in the example above).
If a control device saves data around the concept of a command list, then
configs
has a few additional required keys, see table below.¶ Key
Description
config['command list']
A tuple representing the original command list. For example,
config['command list'] = ('VOLT: 20.0', 'VOLT 25.0', 'VOLT 30.0')
config['state values']
Has all the same keys as before, plus the addition of
'command list'
,'cl str
, and're pattern'
. For example,config['state values'] = { 'command': { 'dset paths': config['dset paths'], 'dset field': ('Command index',), 'shape': (), 'dtype': numpy.float32, 'command list': (20.0, 25.0, 30.0), 'cl str': ('VOLT: 20.0', 'VOLT 25.0', 'VOLT 30.0'), 're pattern': re.compile(r'some RE pattern')} }
where
're pattern'
is the compiled RE pattern used to parse the original command list,'cl str'
is the matched string segment of the command list, and'command list'
is the set of values that will populate the constructed numpy array.Note
For further details, look to Adding a Control Device Mapping Module.
- contype¶
control device type
- dataset_names¶
list of names of the HDF5 datasets in the control group
- device_name¶
Name of Control device
- group¶
Instance of the HDF5 Control Device group
- has_command_list¶
- Returns:
True
if dataset utilizes a command list
- info¶
Control device dictionary of meta-info. For example,
info = { 'group name': 'Control', 'group path': '/foo/bar/Control', 'contype': 'motion', }
- one_config_per_dset¶
'True'
if each control configuration has its own dataset
- subgroup_names¶
list of names of the HDF5 sub-groups in the control group
Methods Documentation
- clparse(config_name: str) CLParse ¶
Return instance of
CLParse
forconfig_name
.- Parameters:
config_name (str) – configuration name
- reset_state_values_config(config_name: str, apply_patterns=False)¶
Reset the
configs[config_name]['state values']
dictionary.- Parameters:
config_name – configuration name
apply_patterns (bool) – Set
False
(DEFAULT) to reset to_default_state_values_dict(config_name)
. SetTrue
to rebuild dict using_default_re_patterns
.