scipp.cumsum

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._scipp.core.Variable) – Input data.

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

  • mode (Optional[str]) – Include or exclude the ith element (along dim) in the sum. Options are ‘inclusive’ and ‘exclusive’. Defaults to ‘inclusive’.

Returns

The cumulative sum of the input values.

Return type

scipp._scipp.core.Variable