scipp.reduce#

scipp.reduce(x)#

Create helper object for reduction operations over list or tuple of inputs.

Usage examples:

>>> a = sc.linspace(dim='x', start=0, stop=1, num=4)
>>> b = sc.linspace(dim='x', start=0.2, stop=0.8, num=4)
>>> sc.reduce([a, b]).max()
<scipp.Variable> (x: 4)    float64  [dimensionless]  [0.2, 0.4, 0.666667, 1]
>>> sc.reduce([a, b]).sum()
<scipp.Variable> (x: 4)    float64  [dimensionless]  [0.2, 0.733333, 1.26667, 1.8]
Parameters

x (Iterable[Union[Variable, DataArray, Dataset]]) – List or tuple of variables or data arrays

Returns

Reducer – Reducer helper object with methods such as sum() or max()