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 (TypeVar(_T, bound= DataArray | Dataset)) – Dataset or DataArray to be split into slices.

  • keep (str) – Dimension to be preserved.

Returns:

dict[str, TypeVar(_T, bound= DataArray | Dataset)] – A dictionary holding 1D slices of the input object.