colour.utilities.xp_as_float_array#
- colour.utilities.xp_as_float_array(a: ArrayLike, *, xp: ProtocolArrayNamespace | ModuleType | None = None, like: Any = None) NDArrayFloat[source]#
Convert the specified variable \(a\) to a float array in the target namespace using
colour.constants.DTYPE_FLOAT_DEFAULT.Shorthand for
xp_as_array(a, dtype=DTYPE_FLOAT_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 a float array in the target namespace.
- Return type:
Examples
>>> xp_as_float_array([1, 2, 3], xp=np) array([1., 2., 3.])