scipp.sum#

scipp.sum(x, dim=None, *, out=None)#

Element-wise sum over the specified dimension.

If the input data is in single precision (dtype=’float32’) this internally uses double precision (dtype=’float64’) to reduce the effect of accumulated rounding errors. If multiple dimensions are reduced, the current implementation casts back to float32 after handling each dimension, i.e., the result is equivalent to what would be obtained from manually summing individual dimensions.

Parameters
Raises

If the dimension does not exist, or the dtype cannot be summed, e.g., if it is a string.

Returns

Union[Variable, DataArray, Dataset] – The sum of the input values.

Seealso

scipp.nansum().