scipp.cumsum#

scipp.cumsum(a, dim=None, mode='inclusive')#

Return the cumulative sum along the specified dimension.

See scipp.sum() on how rounding errors for float32 inputs are handled.

Parameters:
  • a (scipp.typing.VariableLike) – Input data.

  • dim (Optional[str], default: None) – Optional dimension along which to calculate the sum. If not given, the cumulative sum along all dimensions is calculated.

  • mode (Literal['exclusive', 'inclusive'], default: 'inclusive') – Include or exclude the ith element (along dim) in the sum. Options are ‘inclusive’ and ‘exclusive’. Defaults to ‘inclusive’.

Returns:

Same type as input – The cumulative sum of the input values.