condition_controls

bapsflib._hdf.utils.helpers.condition_controls(hdf_file: File, controls: Any) List[Tuple[str, Any]]

Conditions the controls argument for HDFReadControls and HDFReadData.

Parameters:
  • hdf_file – HDF5 object instance

  • controlscontrols argument to be conditioned

Returns:

list containing tuple pairs of control device name and desired configuration name

Example:
>>> from bapsflib import lapd
>>> f = lapd.File('sample.hdf5')
>>> controls = ['Wavefrom', ('6K Compumotor', 3)]
>>> conditioned_controls = condition_controls(f, controls)
>>> conditioned_controls
[('Waveform', 'config01'), ('6K Compumotor', 3)]

Condition Criteria

  1. Input controls should be Union[str, Iterable[Union[str, Tuple[str, Any]]]]

  2. There can only be one control for each ConType.

  3. If a control has multiple configurations, then one must be specified.

  4. If a control has ONLY ONE configuration, then that will be assumed (and checked against the specified configuration).