HDFMapDigiSISCrate
- class bapsflib._hdf.maps.digitizers.siscrate.HDFMapDigiSISCrate(group: Group)
Bases:
HDFMapDigiTemplateMapping class for the ‘SIS crate’ digitizer.
Simple group structure looks like:
+-- SIS crate | +-- config01 | | +-- SIS crate 3302 calibration[0] | | | +-- . | | +-- SIS crate 3302 configurations[0] | | | +-- . | | +-- SIS crate 3305 calibration[0] | | | +-- . | | +-- SIS crate 3305 configurations[0] | | | +-- . . | | +-- SIS crate 3820 configurations[0] | | | +-- | +-- config01 [Slot 5: SIS 3302 ch 1] | +-- config01 [Slot 5: SIS 3302 ch 1] headers . . . | +-- config01 [Slot 13: SIS 3305 FPGA 1 ch 1] | +-- config01 [Slot 13: SIS 3305 FPGA 1 ch 1] headers . | +-- config01 [Slot 13: SIS 3305 FPGA 2 ch 1] | +-- config01 [Slot 13: SIS 3305 FPGA 2 ch 1] headers . . .
- Parameters:
group (
h5py.Group) – The HDF5 to apply the mapping to.
Attributes Summary
List of active digitizer configurations
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.
Tuple of the analog-digital-convert (adc) names integrated into the digitizer.
Name of digitizer (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).Slot info dictionary.
List of names of the HDF5 subgroups within the mapped group, at the root level.
Methods Summary
construct_dataset_name(board, channel[, ...])Construct the name of the HDF5 dataset containing digitizer data. The dataset naming follows two formats based on their associated adc::.
construct_header_dataset_name(board, channel)Construct the name of the HDF5 header dataset associated with the digitizer dataset. The header dataset stores shot numbers and other shot number specific meta-data. It also has a one- to-one row correspondence with the digitizer dataset. The header dataset name follows the format::.
deduce_config_active_status(config_name)Determines if data was recorded using the configuration specified by
config_name.get_adc_info(board, channel, *[, ...])Get adc setup info dictionary associated with board and channel.
get_slot(brd, adc)Get slot number for given board number and adc.
validate_board_and_channel(board, channel[, ...])validate_config_name(config_name[, ...])Validate the specified
config_nameto determine if it is present and active in the digitizer acquisition.validate_config_name_and_adc(config_name, adc)Validate the specified
config_nameandadcname to determine if the set is present and active in the digitizer acquisition.Attributes Documentation
- active_configs
List of active digitizer configurations
- 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 byHDFReadDatato build thenumpydata array from the associated HDF5 dataset(s).The
configsdictis a nested dictionary where the first level of keys represents the digitizer configuration names. Each configuration name (dictkey) has an associateddictvalue that consists of a set of polymorphic and non-polymorphic keys. Any additional keys are currently ignored.All the polymorphic and non-polymorphic keys described below are required keys.
The non-polymorphic keys are as follows:
Required Non-Polymorphic keys for config=configs['config name']Key
Description
config['active']
TrueorFalseindicating if this configuration was used in recording the digitizer datasetsconfig['adc']
Tuple of strings naming the adc’s used for this configuration. For example,
('SIS 3301', )
config['config group path']
Internal HDF5 path to the digitizer configuration group. For example,
'/foo/bar/SIS 3301/Configuration: first_run'config['shotnum']
Dictionary defining how the digitizer shot numbers are recorded. Assuming the shot numbers are recorded in the header dataset associated with the main dataset. The dictionary should look like,
config['shotnum'] = { 'dset field': ('Shot number',), 'shape': (), 'dtype': numpy.uint32, }
where
'dset field'is the field name of the header dataset containing shot numbers'shape'is thenumpyshape of the shot number data
This all defines the
numpydtypeof the'shotnum'field in theHDFReadDataconstructednumpyarray.If the
'shotnum'key is given a value ofNone(instead of the above dictionary), then it is assumed that NO shot number is recorded and the generate shot number will follow the ruleshotnum = index + 1.There is a required polymorphic key for each adc named in the
configs['configs name']['adc']tuple. This entry is a(N, 3)tuple whereNis the number of DAQ boards associated with theadc. Continuing with the example above, the first entry of the'SIS 3301'polymorphic key would look like:Breakdown of Polymorphic Key. ( config=configs['config name'])Key
Description
config['SIS 3301'][0][0]
intrepresenting the connected board numberconfig['SIS 3301'][0][1]
Tuple[int, ...]representing the connected channel numbers associated with the board numberconfig['SIS 3301'][0][2]
Dict[str, Any]representing the setup configuration of the adc. The dictionary should look like:config['SIS 3301'][0][2] = { 'bit: 10, 'clock rate': astropy.units.Quantity(100.0, unit='MHz'), 'nshotnum': 10, 'nt': 10000, 'sample average (hardware)': None, 'shot average (software)': None, 'channel_labels': ('Bx', 'By', 'Bz'), 'time_dset_path': 'time', }
where
'bit'represents the bit resolution of the adc. If given a value ofNone, then it is assumed the digitizer data is saved in volts instead of bit-levels.'clock rate'represents the base clock rate of the adc'nshotnum'is the number of shot numbers recorded'nt'is the number of time samples recorded'sample average (hardware)'is the number of time samples averaged together (this and the'clock rate'make up the'sample rate')'shot average (software)'is the number of shot timeseries intended to be average together'channel_labels'(optional) is a tuple of of strings equal in length the number of active channels. These labels are pulled from the digitizers metadata.'time_dset_path'(optional) is a relative path to a time array dataset. The path is relative to the root group of the digitizer, i.e.group_path. This is used if the digitizer records the time array instead of the clock/sample rate.
- dataset_names
List of names of the HDF5 datasets within the mapped group, at the root level.
- device_adcs
Tuple of the analog-digital-convert (adc) names integrated into the digitizer.
- device_name
Name of digitizer (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).
- slot_info
Slot info dictionary. Contains relationship between slot number and the associated board number and adc name.
- subgroup_names
List of names of the HDF5 subgroups within the mapped group, at the root level.
Methods Documentation
- construct_dataset_name(board: int, channel: int, config_name=None, adc=None, return_info=False) str | Tuple[str, Dict[str, Any]]
Construct the name of the HDF5 dataset containing digitizer data. The dataset naming follows two formats based on their associated adc:
# for 'SIS 3302' '<config_name> [Slot <slot>: SIS 3302 ch <ch>]' # for 'SIS 3305' '<config_name> [Slot <slot>: SIS 3305 FPGA <num> ch <ch>]'
where
<config_name>is the digitizer configuration name,<slot>is the slot number in the digitizer crate that is associated with the board number,<ch>is the requested channel number, and<num>is the FPGA number. Only the ‘SIS 3305’ utilizes the FPGA nomenclature, where channels 1-4 reside on ‘FPGA 1’ and channels 5-8 reside on ‘FPGA 2’.- Parameters:
- Returns:
digitizer dataset name. If
return_info=True, then returns a tuple of (dataset name, dictionary of meta-info)- Return type:
Notes
The returned adc information dictionary looks like:
adc_dict = { 'adc': str, 'bit': int, 'clock rate': astropy.units.Quantity, 'configuration name': str, 'digitizer': str, 'nshotnum': int, 'nt': int, 'sample average (hardware)': int, 'shot average (software)': int, }
- construct_header_dataset_name(board: int, channel: int, config_name: str = None, adc: str = None, **kwargs) str
Construct the name of the HDF5 header dataset associated with the digitizer dataset. The header dataset stores shot numbers and other shot number specific meta-data. It also has a one- to-one row correspondence with the digitizer dataset. The header dataset name follows the format:
'<dataset name> headers'where
<dataset name>is the digitizer dataset name specified by the input arguments and constructed byconstruct_dataset_name().
- deduce_config_active_status(config_name: str) bool
Determines if data was recorded using the configuration specified by
config_name. This is done by comparing the configuration name against the dataset names.- Parameters:
config_name (
str) – digitizer configuration name- Returns:
Trueif the configuration was used in recording the group datasets; otherwise,False- Return type:
Notes
Note
If the digitizer does not use the configuration name in the name of the created datasets, then the subclassing digitizer mapping class should override this method with a rule that is appropriate for the digitizer the class is being designed for.
- get_adc_info(board: int, channel: int, *, config_name: str = None, adc: str = None) Dict[str, Any]
Get adc setup info dictionary associated with board and channel.
- Parameters:
- Returns:
dictionary of adc setup info (bit, clock rate, averaging, etc.) associated with board and channel
- Return type:
Dict[str, Any]
- validate_board_and_channel(board: int, channel: int, config_name: str | None = None, adc: str | None = None, allow_inactive: bool = False)
- Parameters:
board (
int) – Board Numberchannel (
int) – Channel Numberconfig_name (
stror None) – Theconfig_nameto be validated. IfNoneand only one active configuration is present, then the active configuration name will be assumed.adc (
stror None) – Theadcto be validated. IfNoneand only one operable analog-digital-converter present, then the single adc will be assumed.allow_inactive (bool, optional) – If
True, then allow an inactive configuration to pass validation. AnHDFMappingWaringwill be given instead of raising aValueError. (DEFAULT:False)
- Returns:
board (int) – Validated board number.
channel (int) – Validated channel number.
config_name – A validated, and active, configuration name.
adc – A validated, and active, analog-digital-converter name.
See also
validate_config_namd,validate_config_name_and_adc
- validate_config_name(config_name: str | None, allow_inactive: bool = False)
Validate the specified
config_nameto determine if it is present and active in the digitizer acquisition. IfNoneand there is only one active configuration, then the active configuration name will be returned.If
allow_inactiveisTrue, then anHDFMappingWarningwill be issued instead of raising aValueErrorwhen the configuration is inactive.- Parameters:
config_name (
stror None) – Theconfig_nameto be validated. IfNoneand only one active configuration is present, then the active configuration name will be assumed.allow_inactive (bool, optional) – If
True, then allow an inactive configuration to pass validation. AnHDFMappingWarningwill be given instead of raising aValueError. (DEFAULT:False)
- Returns:
A validated, and active, configuration name.
- Return type:
config_name
- validate_config_name_and_adc(config_name: str | None, adc: str | None, allow_inactive: bool = False)
Validate the specified
config_nameandadcname to determine if the set is present and active in the digitizer acquisition.If
config_nameisNoneand there is only one active configuration, then the single active configuration will be assumed.If
adcisNoneand the active configuration only has one operable analog-digital-converter, then the single adc will be assumed.- Parameters:
config_name (
stror None) – Theconfig_nameto be validated. IfNoneand only one active configuration is present, then the active configuration name will be assumed.adc (
stror None) – Theadcto be validated. IfNoneand only one operable analog-digital-converter present, then the single adc will be assumed.allow_inactive (bool, optional) – If
True, then allow an inactive configuration to pass validation. AnHDFMappingWaringwill be given instead of raising aValueError. (DEFAULT:False)
- Returns:
config_name – A validated, and active, configuration name.
adc – A validated, and active, analog-digital-converter name.