colour.utilities.set_int_precision¶
- colour.utilities.set_int_precision(dtype=<class 'numpy.int64'>)[source]¶
Sets Colour integer precision by setting
colour.constant.DEFAULT_INT_DTYPE
attribute with given type wherever the attribute is imported.- Parameters
dtype (object) – Type to set
colour.constant.DEFAULT_INT_DTYPE
with.
Notes
It is possible to define the int precision at import time by setting the COLOUR_SCIENCE__INT_PRECISION environment variable, for example set COLOUR_SCIENCE__INT_PRECISION=int32.
Warning
This definition is mostly given for consistency purposes with
colour.utilities.set_float_precision()
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_int_precision(np.int32) >>> as_int_array(np.ones(3)).dtype dtype('int32') >>> set_int_precision(np.int64) >>> as_int_array(np.ones(3)).dtype dtype('int64')