colour.utilities.to_domain_1#

colour.utilities.to_domain_1(a: ArrayLike, scale_factor: FloatingOrArrayLike = 100, dtype: Optional[Type[DTypeFloating]] = None) ndarray[source]#

Scale given array \(a\) to domain ‘1’. The behaviour is as follows:

  • If Colour domain-range scale is ‘Reference’ or ‘1’, the definition is almost entirely by-passed and will conveniently convert array \(a\) to np.ndarray.

  • If Colour domain-range scale is ‘100’ (currently unsupported private value only used for unit tests), array \(a\) is divided by scale_factor, typically 100.

Parameters:
  • a (ArrayLike) – Array \(a\) to scale to domain ‘1’.

  • scale_factor (FloatingOrArrayLike) – Scale factor, usually numeric but can be a numpy.ndarray if some axis need different scaling to be brought to domain ‘1’.

  • dtype (Optional[Type[DTypeFloating]]) – Data type used for the conversion to np.ndarray.

Returns:

Array \(a\) scaled to domain ‘1’.

Return type:

numpy.ndarray

Examples

With Colour domain-range scale set to ‘Reference’:

>>> with domain_range_scale("Reference"):
...     to_domain_1(1)
...
array(1.0)

With Colour domain-range scale set to ‘1’:

>>> with domain_range_scale("1"):
...     to_domain_1(1)
...
array(1.0)

With Colour domain-range scale set to ‘100’ (unsupported):

>>> with domain_range_scale("100"):
...     to_domain_1(1)
...
array(0.01)