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.200000, 0.400000, 0.666667, 1.000000]
>>> sc.reduce([a, b]).sum()
<scipp.Variable> (x: 4)    float64  [dimensionless]  [0.200000, 0.733333, 1.266667, 1.800000]
Parameters

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

Returns

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

Return type

scipp.reduction.Reducer