colour.utilities.set_default_complex_dtype#

colour.utilities.set_default_complex_dtype(dtype: Type[DTypeComplex] = DTYPE_COMPLEX_DEFAULT) None[source]#

Set the Colour default numpy.complexfloating precision by setting colour.constant.DTYPE_COMPLEX_DEFAULT attribute with the specified numpy.dtype wherever the attribute is imported.

Parameters:

dtype (Type[DTypeComplex]) – numpy.dtype to set colour.constant.DTYPE_COMPLEX_DEFAULT with.

Return type:

None

Notes

  • It is possible to define the complex precision at import time by setting the COLOUR_SCIENCE__DEFAULT_COMPLEX_DTYPE environment variable, for example set COLOUR_SCIENCE__DEFAULT_COMPLEX_DTYPE=complex64.

Warning

Changing complex precision might result in various Colour functionality breaking entirely. With great power comes great responsibility.

Examples

>>> as_complex_array(np.ones(3)).dtype
dtype('complex128')
>>> set_default_complex_dtype(np.complex64)
>>> as_complex_array(np.ones(3)).dtype
dtype('complex64')
>>> set_default_complex_dtype(np.complex128)
>>> as_complex_array(np.ones(3)).dtype
dtype('complex128')