toolbox_scs.detectors.dssc_data

Module Contents

Functions

save_xarray(fname, data[, group, mode])

Store xarray Dataset in the specified location

save_attributes_h5(fname[, data])

Adding attributes to a hdf5 file. This function is intended to be used to

load_xarray(fname[, group, form])

Load stored xarray Dataset.

get_data_formatted([filenames, data_list])

Combines the given data into one dataset. For any of extra_data's data

toolbox_scs.detectors.dssc_data.save_xarray(fname, data, group='data', mode='a')[source]

Store xarray Dataset in the specified location

Parameters
  • data (xarray.DataSet) – The data to be stored

  • fname (str, int) – filename

  • overwrite (bool) – overwrite existing data

Raises

ToolBoxFileError – Exception: File existed, but overwrite was set to False.

toolbox_scs.detectors.dssc_data.save_attributes_h5(fname, data={})[source]

Adding attributes to a hdf5 file. This function is intended to be used to attach metadata to a processed run.

Parameters
  • fname (str) – filename as string

  • data (dictionary) – the data that should be added to the file in form of a dictionary.

toolbox_scs.detectors.dssc_data.load_xarray(fname, group='data', form='dataset')[source]

Load stored xarray Dataset. Comment: This function exists because of a problem with the standard netcdf engine that is malfunctioning due to related software installed in the exfel-python environment. May be dropped at some point.

Parameters
  • fname (str) – filename as string

  • group (str) – the name of the xarray dataset (group in h5 file).

  • form (str) – specify whether the data to be loaded is a ‘dataset’ or a ‘array’.

toolbox_scs.detectors.dssc_data.get_data_formatted(filenames=[], data_list=[])[source]

Combines the given data into one dataset. For any of extra_data’s data types, an xarray.Dataset is returned. The data is sorted along the ‘module’ dimension. The array dimension have the order ‘trainId’, ‘pulse’, ‘module’, ‘x’, ‘y’. This order is required by the extra_geometry package.

Parameters
  • filenames (list of str) – files to be combined as a list of names. Calls ‘_data_from_list’ to actually load the data.

  • data_list (list) – list containing the already loaded data

Returns

data – A xarray.Dataset containing the combined data.

Return type

xarray.Dataset