build_sndr_for_complex_dset

bapsflib._hdf.utils.helpers.build_sndr_for_complex_dset(shotnum: ndarray, dset: Dataset, shotnumkey: str, cmap: HDFMapControlTemplate | HDFMapControlCLTemplate, cconfn: Any) Tuple[ndarray, ndarray]

Compares the shotnum numpy array to the specified “complex” dataset, dset, to determine which indices contain the desired shot number(s). As a results, two numpy arrays are returned which satisfy the rule:

shotnum[sni] = dset[index, shotnumkey]

where shotnum is the original shot number array, sni is a boolean numpy array masking which shot numbers were determined to be in the dataset, and index is an array of indices corresponding to the desired shot number(s).

A “complex” dataset is a dataset in which the data for MULTIPLE configurations is recorded.

Dataset Assumption

There is an assumption that each shot number spans n_configs number of rows in the dataset, where n_configs is the number of control device configurations. It is also assumed that the order in which the configs are recorded is the same for each shot number. That is, if there are 3 configs (config01, config02, and config03) and the first three rows of the dataset are recorded in that order, then each following grouping of three rows will maintain that order.

Parameters:
  • shotnum – desired HDF5 shot number

  • dset (h5py.Dataset) – dataset containing shot numbers

  • shotnumkey (str) – field name in the dataset that contains the shot numbers

  • cmap – mapping object for control device

  • cconfn – configuration name for the control device

Returns:

index and sni numpy arrays