colour.SpragueInterpolator

class colour.SpragueInterpolator(x, y, dtype=<class 'numpy.float64'>)[source]

Constructs a fifth-order polynomial that passes through \(y\) dependent variable.

Sprague (1880) method is recommended by the CIE for interpolating functions having a uniformly spaced independent variable.

Parameters
  • x (array_like) – Independent \(x\) variable values corresponding with \(y\) variable.

  • y (array_like) – Dependent and already known \(y\) variable values to interpolate.

  • dtype (type) – Data type used for internal conversions.

x
y
__call__()[source]

Notes

  • The minimum number \(k\) of data points required along the interpolation axis is \(k=6\).

References

[CIET13805b], [WRC12e]

Examples

Interpolating a single numeric variable:

>>> y = np.array([5.9200, 9.3700, 10.8135, 4.5100,
...               69.5900, 27.8007, 86.0500])
>>> x = np.arange(len(y))
>>> f = SpragueInterpolator(x, y)
>>> f(0.5)  
7.2185025...

Interpolating an array_like variable:

>>> f([0.25, 0.75])  
array([ 6.7295161...,  7.8140625...])
__init__(x, y, dtype=<class 'numpy.float64'>)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(x, y[, dtype])

Initialize self.

Attributes

SPRAGUE_C_COEFFICIENTS

Defines the coefficients used to generate extra points for boundaries interpolation.

x

Getter and setter property for the independent \(x\) variable.

y

Getter and setter property for the dependent and already known \(y\) variable.