Defines classes for interpolating variables.
Bases: object
Linearly interpolates a 1-D function.
Parameters: |
|
---|
Notes
This class is a wrapper around numpy.interp definition.
See also
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 = LinearInterpolator1d(x, y)
>>> # Doctests ellipsis for Python 2.x compatibility.
>>> f(0.5)
7.64...
Interpolating an array_like variable:
>>> f([0.25, 0.75])
array([ 6.7825, 8.5075])
Evaluates the interpolating polynomial at given point(s).
Parameters: | x (numeric or array_like) – Point(s) to evaluate the interpolant at. |
---|---|
Returns: | Interpolated value(s). |
Return type: | float or ndarray |
Bases: scipy.interpolate.interpolate.interp1d
Interpolates a 1-D function using cubic spline interpolation.
Notes
This class is a wrapper around scipy.interpolate.interp1d class.
Bases: object
Constructs a fifth-order polynomial that passes through \(y\) dependent variable.
The Sprague (1880) method is recommended by the CIE for interpolating functions having a uniformly spaced independent variable.
Parameters: |
|
---|
See also
Notes
The minimum number \(k\) of data points required along the interpolation axis is \(k=6\).
References
[1] | CIE 167:2005 Recommended Practice for Tabulating Spectral Data for Use in Colour Computations: 9.2.4 Method of interpolation for uniformly spaced independent variable |
[2] | Stephen Westland, Caterina Ripamonti, Vien Cheung, Computational Colour Science Using MATLAB, 2nd Edition, The Wiley-IS&T Series in Imaging Science and Technology, published July 2012, ISBN-13: 978-0-470-66569-5, page 33. |
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...])
Defines the coefficients used to generate extra points for boundaries interpolation.
SPRAGUE_C_COEFFICIENTS : array_like, (4, 6)
References
[3] | CIE 167:2005 Recommended Practice for Tabulating Spectral Data for Use in Colour Computations: Table V |
Evaluates the interpolating polynomial at given point(s).
Parameters: | x (numeric or array_like) – Point(s) to evaluate the interpolant at. |
---|---|
Returns: | Interpolated value(s). |
Return type: | numeric or ndarray |