colour.utilities.from_range_degrees¶
- colour.utilities.from_range_degrees(a: ArrayLike, scale_factor: FloatingOrArrayLike = 360, dtype: Optional[Type[DTypeFloating]] = None) NDArray [source]¶
Scale given array \(a\) from degrees range. The behaviour is as follows:
If Colour domain-range scale is ‘Reference’, the definition is entirely by-passed.
If Colour domain-range scale is ‘1’, array \(a\) is divided by
scale_factor
, typically 360.If Colour domain-range scale is ‘100’ (currently unsupported private value only used for unit tests), array \(a\) is divided by
scale_factor
/ 100, typically 360 / 100.
- Parameters
a (ArrayLike) – Array \(a\) to scale from degrees range.
scale_factor (FloatingOrArrayLike) – Scale factor, usually numeric but can be a
numpy.ndarray
if some axis need different scaling to be brought from degrees range.dtype (Optional[Type[DTypeFloating]]) – Data type used for the conversion to
np.ndarray
.
- Returns
Array \(a\) scaled from degrees range.
- Return type
Warning
The scale conversion of variable \(a\) happens in-place, i.e. \(a\) will be mutated!
Examples
With Colour domain-range scale set to ‘Reference’:
>>> with domain_range_scale('Reference'): ... from_range_degrees(1) array(1.0)
With Colour domain-range scale set to ‘1’:
>>> with domain_range_scale('1'): ... from_range_degrees(1) array(0.0027777...)
With Colour domain-range scale set to ‘100’ (unsupported):
>>> with domain_range_scale('100'): ... from_range_degrees(1) array(0.2777777...)