scipp.mean

scipp.mean

scipp.mean(x, dim=None, *, out=None)

Element-wise mean over the specified dimension.

If the input has variances, the variances stored in the output are based on the “standard deviation of the mean”, i.e., \(\sigma_{mean} = \sigma / \sqrt{N}\). \(N\) is the length of the input dimension. \(\sigma\) is estimated as the average of the standard deviations of the input elements along that dimension.

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

Parameters
  • x (VariableLike) – Input data.

  • dim (Optional[str]) – Dimension along which to calculate the mean. If not given, the mean over all dimensions is calculated.

  • out (Optional[VariableLike]) – Optional output buffer.

Raises

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

Returns

The mean of the input values.

Seealso

scipp.nanmean().

Return type

VariableLike