scipp.collapse#

scipp.collapse(scipp_obj, keep)#

Slice down the input object until only the supplied keep dimension is left (effectively ‘collapsing’ all but one dimension), and return a dict of 1D slices. A common use for this is plotting spectra from detectors where most pixels contain noise, but one specific channel contains a strong signal. The plot function accepts a dict of data arrays.

Parameters:
  • [scipp_obj] (Dataset or DataArray) – Dataset or DataArray to be split into slices.

  • [keep] – Dimension to be preserved.

Returns:

A dictionary holding 1D slices of the input object.

Return type:

dict