colour.utilities.xp_average#

colour.utilities.xp_average(a: ArrayLike, *, axis: int | None = None, weights: ArrayLike | None = None, xp: ProtocolArrayNamespace | ModuleType | None = None) NDArrayFloat[source]#

Array API compatible implementation of numpy.average().

Parameters:
  • a (ArrayLike) – Array to average.

  • axis (int | None) – Axis along which to average.

  • weights (ArrayLike | None) – Weights associated with the values in a.

  • xp (ProtocolArrayNamespace | ModuleType | None) – Array namespace module. If None, derived from a and weights.

Returns:

Weighted average.

Return type:

object