colour.utilities.as_complex_array#
- colour.utilities.as_complex_array(a: ArrayLike, dtype: Type[DTypeComplex] | None = None) NDArrayComplex[source]#
Convert the specified variable \(a\) to
numpy.ndarrayusing the specified complexnumpy.dtype.- Parameters:
a (ArrayLike) – Variable \(a\) to convert.
dtype (Type[DTypeComplex] | None) – Complex
numpy.dtypeto use for conversion, default to thenumpy.dtypedefined by thecolour.constant.DTYPE_COMPLEX_DEFAULTattribute.
- Returns:
Variable \(a\) converted to complex
numpy.ndarray.- Return type:
Examples
>>> as_complex_array([1, 2, 3]) array([ 1.+0.j, 2.+0.j, 3.+0.j]) >>> as_complex_array([1 + 2j, 3 + 4j]) array([ 1.+2.j, 3.+4.j])