colour.algebra.linstep_function

colour.algebra.linstep_function(x, a=0, b=1, clip=False)[source]

Performs a simple linear interpolation between given array \(a\) and array \(b\) using \(x\) array.

Parameters
  • x (array_like) – Array \(x\) value to use to interpolate between array \(a\) and array \(b\).

  • a (array_like) – Array \(a\), the start of the range in which to interpolate.

  • b (array_like) – Array \(b\), the end of the range in which to interpolate.

  • clip (bool, optional) – Whether to clip the output values to range [a, b].

Returns

Linear interpolation result.

Return type

ndarray

Examples

>>> a = 0
>>> b = 2
>>> linstep_function(0.5, a, b)
1.0