colour.algebra.linear_conversion

colour.algebra.linear_conversion(a, old_range, new_range)[source]

Performs a simple linear conversion of given array between the old and new ranges.

Parameters
  • a (array_like) – Array to perform the linear conversion onto.

  • old_range (array_like) – Old range.

  • new_range (array_like) – New range.

Returns

Linear conversion result.

Return type

ndarray

Examples

>>> a = np.linspace(0, 1, 10)
>>> linear_conversion(a, np.array([0, 1]), np.array([1, 10]))
array([  1.,   2.,   3.,   4.,   5.,   6.,   7.,   8.,   9.,  10.])