colour.utilities.xp_as_int_array#
- colour.utilities.xp_as_int_array(a: ArrayLike, *, xp: ProtocolArrayNamespace | ModuleType | None = None, like: Any = None) NDArrayInt[source]#
Convert the specified variable \(a\) to an integer array in the target namespace using
colour.constants.DTYPE_INT_DEFAULT.Shorthand for
xp_as_array(a, dtype=DTYPE_INT_DEFAULT, xp=xp, like=like).- Parameters:
a (ArrayLike) – Variable \(a\) to convert.
xp (ProtocolArrayNamespace | ModuleType | None) – Array namespace module. If None, derived from
a.like (Any) – Reference array whose device to match.
- Returns:
Variable \(a\) as an integer array in the target namespace.
- Return type:
Examples
>>> xp_as_int_array([1.5, 2.7, 3.9], xp=np) array([1, 2, 3])