WrightTools.data.Data.collapse

Data.collapse(axis, method='sum')[source]

Collapse the dataset along one axis, adding lower rank channels.

New channels have names <channel name>_<axis name>_<method>.

Parameters:
  • axis (int or str) – The axis to collapse along. If given as an integer, the axis in the underlying array is used. If given as a string, the axis must exist, and be a 1D array-aligned axis. (i.e. have a shape with a single value which is not 1) The axis to collapse along is inferred from the shape of the axis.

  • method ({'average', 'sum', 'max', 'min'} (optional)) – The method of collapsing the given axis. Method may also be list of methods corresponding to the channels of the object. Default is sum. NaNs are ignored. Can also be a list, allowing for different treatment for varied channels. In this case, None indicates that no change to that channel should occur.

See also

chop

Divide the dataset into its lower-dimensionality components.

split

Split the dataset while maintaining its dimensionality.

moment

Take the moment along a particular axis