colour.utilities.xp_nan_to_num#

colour.utilities.xp_nan_to_num(a: ArrayLike, *, nan: float = 0.0, posinf: float | None = None, neginf: float | None = None, xp: ProtocolArrayNamespace | ModuleType | None = None) NDArrayFloat[source]#

Array API compatible implementation of numpy.nan_to_num().

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

  • nan (float) – Value to replace NaN entries.

  • posinf (float | None) – Value to replace positive infinity entries.

  • neginf (float | None) – Value to replace negative infinity entries.

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

Returns:

Array with NaN/Inf replaced.

Return type:

object