HDFMapControlNIXYZ

class bapsflib._hdf.maps.controls.nixyz.HDFMapControlNIXYZ(group: Group)

Bases: HDFMapControlTemplate

Mapping module for control device ‘NI_XYZ’.

Simple group structure looks like:

+-- NI_XYZ
|   +-- <motion list name 1>
|   |   +--
.
.
.
|   +-- <motion list name N>
|   |   +--
|   +-- Run time list
Parameters:

group – the HDF5 control device group

Attributes Summary

configs

Dictionary containing all the relevant mapping information to translate the HDF5 data into a numpy array by HDFReadControls.

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

return:

True if dataset utilizes a command list

info

Control device dictionary of meta-info. For example, ::.

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 Summary

construct_dataset_name(*args)

Constructs name of dataset containing control state value data.

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 the info 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.

Dictionary breakdown for config = configs['config name']

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 numpy dtype of the data. This all defines the numpy dtype of the 'shotnum' field in the HDFReadControls 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 of numpy.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 by HDFReadData.

  • 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.

Additional required keys for config = configs['config name'] when the control device saves data around the concept of a command list.

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

construct_dataset_name(*args) str

Constructs name of dataset containing control state value data.