AGIPD, LPD & DSSC data

Note

This part of karabo_data has been renamed to EXtra-data. Please use that package in new code.

These data from AGIPD, LPD and DSSC is spread out in separate files. karabo_data includes convenient interfaces to access this data, pulling together the separate modules into a single array.

class karabo_data.components.AGIPD1M(data: karabo_data.reader.DataCollection, detector_name=None, modules=None, *, min_modules=1)

An interface to AGIPD-1M data.

Parameters
  • data (DataCollection) – A data collection, e.g. from RunDirectory.

  • modules (set of ints, optional) – Detector module numbers to use. By default, all available modules are used.

  • detector_name (str, optional) – Name of a detector, e.g. ‘SPB_DET_AGIPD1M-1’. This is only needed if the dataset includes more than one AGIPD detector.

  • min_modules (int) – Include trains where at least n modules have data. Default is 1.

The methods of this class are identical to those of LPD1M, below.

class karabo_data.components.DSSC1M(data: karabo_data.reader.DataCollection, detector_name=None, modules=None, *, min_modules=1)

An interface to DSSC-1M data.

Parameters
  • data (DataCollection) – A data collection, e.g. from RunDirectory.

  • modules (set of ints, optional) – Detector module numbers to use. By default, all available modules are used.

  • detector_name (str, optional) – Name of a detector, e.g. ‘SCS_DET_DSSC1M-1’. This is only needed if the dataset includes more than one DSSC detector.

  • min_modules (int) – Include trains where at least n modules have data. Default is 1.

The methods of this class are identical to those of LPD1M, below.

class karabo_data.components.LPD1M(data: karabo_data.reader.DataCollection, detector_name=None, modules=None, *, min_modules=1)

An interface to LPD-1M data.

Parameters
  • data (DataCollection) – A data collection, e.g. from RunDirectory.

  • modules (set of ints, optional) – Detector module numbers to use. By default, all available modules are used.

  • detector_name (str, optional) – Name of a detector, e.g. ‘FXE_DET_LPD1M-1’. This is only needed if the dataset includes more than one LPD detector.

  • min_modules (int) – Include trains where at least n modules have data. Default is 1.

get_array(key, pulses=by_index[:])

Get a labelled array of detector data

Parameters
  • key (str) – The data to get, e.g. ‘image.data’ for pixel values.

  • pulses (by_id or by_index) – Select the pulses to include from each train. by_id selects by pulse ID, by_index by index within the data being read. The default includes all pulses. Only used for per-train data.

trains(pulses=by_index[:])

Iterate over trains for detector data.

Parameters

pulses (by_index or by_id) – Select which pulses to include for each train. The default is to include all pulses.

Yields

train_data (dict) – A dictionary mapping key names (e.g. image.data) to labelled arrays.

write_virtual_cxi(filename)

Write a virtual CXI file to access the detector data.

The virtual datasets in the file provide a view of the detector data as if it was a single huge array, but without copying the data. Creating and using virtual datasets requires HDF5 1.10.

Parameters

filename (str) – The file to be written. Will be overwritten if it already exists.

See also

Accessing LPD data: An example using the class above.

If you get data for a train from the main DataCollection interface, there is also another way to combine detector modules from AGIPD or LPD:

karabo_data.stack_detector_data(train, data, axis=- 3, modules=16, fillvalue=nan, real_array=True)

Stack data from detector modules in a train.

Parameters
  • train (dict) – Train data.

  • data (str) – The path to the device parameter of the data you want to stack, e.g. ‘image.data’.

  • axis (int) – Array axis on which you wish to stack (default is -3).

  • modules (int) – Number of modules composing a detector (default is 16).

  • fillvalue (number) – Value to use in place of data for missing modules. The default is nan (not a number) for floating-point data, and 0 for integers.

  • real_array (bool) – If True (default), copy the data together into a real numpy array. If False, avoid copying the data and return a limited array-like wrapper around the existing arrays. This is sufficient for assembling images using detector geometry, and allows better performance.

Returns

combined – Stacked data for requested data path.

Return type

numpy.array