x
and y
are arrays of values used to approximate some function f, with y = f(x)
. The interpolant uses monotonic cubic splines to find the value of new points. (PCHIP stands for Piecewise Cubic Hermite Interpolating Polynomial).
The interpolator preserves monotonicity in the interpolation data and does not overshoot if the data is not smooth.
The first derivatives are guaranteed to be continuous, but the second derivatives may jump at $x_k$ .
Determines the derivatives at the points $x_k$ , $f'_k$ , by using PCHIP algorithm .
Let $h_k = x_{k+1} - x_k$ , and $d_k = (y_{k+1} - y_k) / h_k$ are the slopes at internal points $x_k$ . If the signs of $d_k$ and $d_{k-1}$ are different or either of them equals zero, then $f'_k = 0$ . Otherwise, it is given by the weighted harmonic mean
$$\frac{w_1 + w_2}{f'_k} = \frac{w_1}{d_{k-1}} + \frac{w_2}{d_k}$$where $w_1 = 2 h_k + h_{k-1}$ and $w_2 = h_k + 2 h_{k-1}$ .
The end slopes are set using a one-sided scheme .
A 1-D array of monotonically increasing real values. x
cannot include duplicate values (otherwise f is overspecified)
A 1-D array of real values. y
's length along the interpolation axis must be equal to the length of x
. If N-D array, use axis
parameter to select correct axis.
Axis in the y array corresponding to the x-coordinate values.
Whether to extrapolate to out-of-bounds points based on first and last intervals, or to return NaNs.
PCHIP 1-D monotonic cubic interpolation.
Akima1DInterpolator
Akima 1D interpolator.
CubicHermiteSpline
Piecewise-cubic interpolator.
CubicSpline
Cubic spline data interpolator.
PPoly
Piecewise polynomial in terms of coefficients and breakpoints.
The following pages refer to to this document either explicitly or contain code examples using this.
scipy.interpolate
scipy.interpolate._cubic.CubicSpline
scipy.interpolate._cubic.Akima1DInterpolator
scipy.interpolate._cubic.CubicHermiteSpline
scipy.interpolate._cubic.pchip_interpolate
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them