colour.utilities.set_default_int_dtype#
- colour.utilities.set_default_int_dtype(dtype: Type[DTypeInt] = DTYPE_INT_DEFAULT) None[source]#
Set the Colour default
numpy.integerprecision by settingcolour.constant.DTYPE_INT_DEFAULTattribute with the specifiednumpy.dtypewherever the attribute is imported.- Parameters:
dtype (Type[DTypeInt]) –
numpy.dtypeto setcolour.constant.DTYPE_INT_DEFAULTwith.- Return type:
None
Notes
It is possible to define the integer precision at import time by setting the COLOUR_SCIENCE__DEFAULT_INT_DTYPE environment variable, for example set COLOUR_SCIENCE__DEFAULT_INT_DTYPE=int32.
Warning
This definition is mostly given for consistency purposes with
colour.utilities.set_default_float_dtype()definition but contrary to the latter, changing integer precision will almost certainly completely break Colour. With great power comes great responsibility.Examples
>>> as_int_array(np.ones(3)).dtype dtype('int64') >>> set_default_int_dtype(np.int32) >>> as_int_array(np.ones(3)).dtype dtype('int32') >>> set_default_int_dtype(np.int64) >>> as_int_array(np.ones(3)).dtype dtype('int64')