stats_utils.py

stats_utils.py collects the package basic descriptive statistics and the internal validators reused by other modules as well.

Main imports

  • External libraries: numpy as np, numpy.typing.ArrayLike, numpy.typing.NDArray

  • Types defined in the module: FloatVector = NDArray[np.float64]

  • Internal helpers: _as_float_vector, _validate_weights

What it exports

What it does

  • convert array-like inputs into one-dimensional float64 vectors

  • catch empty or non-finite inputs

  • optionally handle strictly positive weights

  • compute unweighted and weighted statistics with a uniform interface

Internal relations

The helpers in this module are not used only by the statistical functions. _as_float_vector is also imported by plot_utils and fit_utils, so stats_utils.py is the central point for numeric input normalization.

Detailed pages