scipp.max(x, dim=None)#

Maximum of elements in the input.

Warning

Scipp returns DBL_MIN or INT_MIN for empty inputs of float or int dtype, respectively, while NumPy raises. Note that in the case of DataArray, inputs can also be “empty” if all elements contributing to an output element are masked.

Parameters:
Returns:

TypeVar(VariableLikeType, Variable, DataArray, Dataset, DataGroup[Any]) – The maximum of the input values.

Examples

>>> import scipp as sc
>>> x = sc.array(dims=['x'], values=[3, 1, 4, 1, 5])
>>> sc.max(x)
<scipp.Variable> ()      int64  [dimensionless]  5

Maximum along a specific dimension:

>>> x = sc.array(dims=['x', 'y'], values=[[3, 1, 4], [1, 5, 9]])
>>> sc.max(x, 'y')
<scipp.Variable> (x: 2)      int64  [dimensionless]  [4, 9]