interpax.Akima1DInterpolator

class interpax.Akima1DInterpolator(x: Real[Array, 'n'] | Real[ndarray, 'n'], y: Num[Array, 'n ...'] | Num[ndarray, 'n ...'], axis: int = 0, extrapolate: bool | str | None = None, check: bool = True)Source

Akima interpolator.

Fit piecewise cubic polynomials, given vectors x and y. The interpolation method by Akima uses a continuously differentiable sub-spline built from piecewise cubic polynomials. The resultant curve passes through the given data points and will appear smooth and natural.

Parameters:
  • x (ndarray, shape (npoints, )) – 1-D array of monotonically increasing real values.

  • y (ndarray, shape (..., npoints, ...)) – N-D array of real values. The length of y along the interpolation axis must be equal to the length of x. Use the axis parameter to select the interpolation axis.

  • axis (int, optional) – Axis in the y array corresponding to the x-coordinate values. Defaults to axis=0.

  • extrapolate (bool, optional) – Whether to extrapolate to out-of-bounds points based on first and last intervals, or to return NaNs.

  • check (bool) – Whether to perform checks on the input. Should be False if used under JIT.

See also

PchipInterpolator

PCHIP 1-D monotonic cubic interpolator.

CubicSpline

Cubic spline data interpolator.

PPoly

Piecewise polynomial in terms of coefficients and breakpoints

Notes

Use only for precise data, as the fitted curve passes through the given points exactly. This routine is useful for plotting a pleasingly smooth curve through a few given points for purposes of plotting.

References

[1] A new method of interpolation and smooth curve fitting based

on local procedures. Hiroshi Akima, J. ACM, October 1970, 17(4), 589-602.

Methods

__call__(x[, nu, extrapolate])

Evaluate the piecewise polynomial or its derivative.

antiderivative([nu])

Construct a new piecewise polynomial representing the antiderivative.

construct_fast(c, x[, extrapolate, axis])

Construct the piecewise polynomial without making checks.

derivative([nu])

Construct a new piecewise polynomial representing the derivative.

extend(c, x[, right])

Not currently implemented.

from_bernstein_basis(bp[, extrapolate])

Not currently implemented.

from_spline(tck[, extrapolate])

Not currently implemented.

integrate(a, b[, extrapolate])

Compute a definite integral over a piecewise polynomial.

roots([discontinuity, extrapolate])

Not currently implemented.

solve([y, discontinuity, extrapolate])

Not currently implemented.

Attributes

axis

Axis along which to interpolate.

c

Array of spline coefficients, shape(order, knots-1, ...).

extrapolate

Whether to extrapolate beyond domain of known values.

x

Array of knot values, shape(knots).