Interpolation (scipy.interpolate)#

There are several general facilities available in SciPy for interpolation andsmoothing for data in 1, 2, and higher dimensions. The choice of a specificinterpolation routine depends on the data: whether it is one-dimensional,is given on a structured grid, or is unstructured. One other factor is thedesired smoothness of the interpolator. In short, routines recommendedforinterpolation can be summarized as follows:

kind

routine

continuity

comment

1D

linear

numpy.interp

piecewise continuous

Alternatively,make_interp_spline(...,k=1)

cubic spline

CubicSpline

2nd derivative

monotone cubic spline

PchipInterpolator

1st derivative

non-overshooting

non-cubic spline

make_interp_spline

(k-1)th derivative

k=3 is equivalent toCubicSpline

nearest

interp1d

kind=’nearest’, ‘previous’, ‘next’

N-D curve

nearest, linear, spline

make_interp_spline

(k-1)th derivative

use N-dimy array

N-D regular(rectilinear)grid

nearest

RegularGridInterpolator

method=’nearest’

linear

method=’linear’

splines

2nd derivatives

method=’cubic’, ‘quintic’

monotone splines

1st derivatives

method=’pchip’

N-D scattered

nearest

NearestNDInterpolator

alias:griddata

linear

LinearNDInterpolator

cubic (2D only)

CloughTocher2DInterpolator

1st derivatives

radial basis function

RBFInterpolator

Smoothing and approximation of data#

1D spline functions

make_smoothing_spline

classic smoothing splines,GCV penalty

make_splrep

automated/semi-automated knotselection

spine curves in N-D

make_splprep

unconstrained least squaresspline fit

make_lsq_spline

2D smoothing surfaces

bisplrep

scattered data

RectBivariateSpline

gridded data

Radial basis functions in N-D

RBFInterpolator

Further details are given in the links below