colour.utilities.xp_trapezoid#

colour.utilities.xp_trapezoid(y: ArrayLike, *, x: ArrayLike | None = None, dx: float = 1.0, axis: int = -1, xp: ProtocolArrayNamespace | ModuleType | None = None) NDArrayFloat[source]#

Array API compatible implementation of numpy.trapezoid().

Parameters:
  • y (ArrayLike) – y-coordinates of the function values.

  • x (ArrayLike | None) – x-coordinates of the function values.

  • dx (float) – Spacing between sample points when x is None.

  • axis (int) – Axis along which to integrate.

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

Returns:

Approximation of the integral.

Return type:

object