colour.utilities.as_array#
- colour.utilities.as_array(a: ArrayLike | KeysView | ValuesView, dtype: Type[DType] | None = None) NDArray[source]#
Convert the specified variable \(a\) to
numpy.ndarrayusing the specifiednumpy.dtype.- Parameters:
a (ArrayLike | KeysView | ValuesView) – Variable \(a\) to convert.
dtype (Type[DType] | None) –
numpy.dtypeto use for conversion, default to thenumpy.dtypedefined by thecolour.constant.DTYPE_FLOAT_DEFAULTattribute.
- Returns:
Variable \(a\) converted to
numpy.ndarray.- Return type:
Examples
>>> as_array([1, 2, 3]) array([1, 2, 3]...) >>> as_array([1, 2, 3], dtype=DTYPE_FLOAT_DEFAULT) array([ 1., 2., 3.])