Statistics

pyfoamalgo.nansum(a, axis=None)

Faster numpy.nansum.

It uses the C++ implementation when applicable. Otherwise, it falls back to numpy.nansum.

Parameters
  • a (numpy.ndarray) – Data array.

  • axis (None/int/tuple) – Axis or axes along which the sum is computed. The default is to compute the sum of the flattened array.

pyfoamalgo.nanmean(a, axis=None)

Faster numpy.nanmean.

It uses the C++ implementation when applicable. Otherwise, it falls back to numpy.nanmean.

If the input array is an array of images, i.e. 3D array, one may want to check pyfoamalgo.nanmean_image_data().

Parameters
  • a (numpy.ndarray) – Data array.

  • axis (None/int/tuple) – Axis or axes along which the mean is computed. The default is to compute the mean of the flattened array.

pyfoamalgo.nanstd(a, axis=None, *, normalized=False)

Faster numpy.nanstd.

It uses the C++ implementation when applicable. Otherwise, it falls back to numpy.nanstd.

Parameters
  • a (numpy.ndarray) – Data array.

  • axis (None/int/tuple) – Axis or axes along which the standard deviation is computed. The default is to compute the standard deviation of the flattened array.

  • normalized (bool) – True for normalizing the result by nanmean along the same axis or axes.

pyfoamalgo.nanvar(a, axis=None, *, normalized=False)

Faster numpy.nanvar.

It uses the C++ implementation when applicable. Otherwise, it falls back to numpy.nanvar.

Parameters
  • a (numpy.ndarray) – Data array.

  • axis (None/int/tuple) – Axis or axes along which the variance is computed. The default is to compute the variance of the flattened array.

  • normalized (bool) – True for normalizing the result by square of nanmean along the same axis or axes.

pyfoamalgo.nanmin(a, axis=None)

Faster numpy.nanmin.

It uses the C++ implementation when applicable. Otherwise, it falls back to numpy.nanmin.

Parameters
  • a (numpy.ndarray) – Data array.

  • axis (None/int/tuple) – Axis or axes along which the mean is computed. The default is to compute the nanmin of the flattened array.

pyfoamalgo.nanmax(a, axis=None)

Faster numpy.nanmax.

It uses the C++ implementation when applicable. Otherwise, it falls back to numpy.nanmax.

Parameters
  • a (numpy.ndarray) – Data array.

  • axis (None/int/tuple) – Axis or axes along which the mean is computed. The default is to compute the nanmax of the flattened array.

pyfoamalgo.histogram1d(a, bins=10, range=None)

Faster numpy.histogram.

It uses the C++ implementation when applicable. Otherwise, it falls back to numpy.histogram.

Parameters
  • a (numpy.ndarray) – Data array.

  • bins (int) – Number of bins.

  • range (tuple/None) – The (lower, upper) boundary of the bins. Default = (a.min(), a.max())

Returns

(Values of the histogram, bin edges)

Return type

(numpy.array, numpy.array)