Chapter 10: SciPy Interpolation

SciPy Interpolation = scipy.interpolate This submodule gives you tools to estimate values between known data points (and sometimes a bit outside them). It’s one of the most frequently used parts of SciPy in experimental science, engineering, data analysis, plotting smooth curves, resampling signals, machine learning feature engineering, and computer graphics.

Current status (February 2026): SciPy 1.17.0 (released January 2026) → scipy.interpolate is very mature. Some older classes like interp1d are now marked legacy (still work perfectly, but won’t get new features), and newer, more consistent APIs are recommended for new code.

Why do we need interpolation? (quick motivation)

You measured temperature at 10 unevenly spaced times during an experiment → you want a smooth curve or value at any arbitrary time. Or you have scattered (x,y,z) measurements → you want to evaluate on a fine regular grid for contour plotting. Or you resample audio / images / time series to a different sampling rate.

SciPy gives you many flavors — from super simple to very sophisticated splines.

Main families of interpolators in scipy.interpolate (2026 view)

Dimension Data structure Most common / recommended classes / functions (2026) When to reach for it Speed / smoothness
1D x sorted (increasing) interp1d (legacy but still everywhere), make_interp_spline, PchipInterpolator, Akima1DInterpolator, CubicSpline Classic 1D curves, time series, spectra Fast → very smooth
1D x not necessarily sorted InterpolatedUnivariateSpline (older), or sort first + above When data is messy Medium
2D Regular (structured) grid RegularGridInterpolator Gridded simulation output, images, lookup tables Fast
2D+ Scattered / unstructured griddata (convenience), LinearNDInterpolator, CloughTocher2DInterpolator, RBFInterpolator Experimental scattered points, geospatial data Medium → slow
Any Radial basis functions RBFInterpolator Smooth global fit, noisy data, high dimensions Slow but flexible
Spline basis Any dimension make_interp_spline, make_lsq_spline, LSQUnivariateSpline You want control over knots / smoothing Medium

Let’s do practical examples — start simple, build up

Always begin your notebook like this:

Python

1. Classic 1D — interp1d (still very widely used, even if legacy)

Python

→ Cubic usually looks nicer, but can overshoot (Runge phenomenon) if points are uneven or data noisy.

2. Modern & recommended 1D splines (2026 style)

Better control, no legacy warning, boundary conditions, derivatives, etc.

Python

PCHIP and Akima are excellent when you don’t want overshoot (e.g. concentrations, cumulative sums, monotonic trends).

3. 2D regular grid — RegularGridInterpolator

Python

→ Very fast for structured grids (e.g. NetCDF output, image resizing).

4. Scattered 2D data — griddata (quick & dirty) or RBFInterpolator (smooth)

Python

→ griddata is convenient but can look triangular/artifacts. RBFInterpolator gives beautiful smooth surfaces (but slower + parameter tuning needed).

Quick cheat sheet — which one first? (2026 advice)

  • 1D sorted data, want simple → interp1d (still ok) or make_interp_spline
  • 1D, hate overshoot → PchipInterpolator or Akima1DInterpolator
  • 2D/3D regular grid → RegularGridInterpolator
  • Scattered points, quick plot → griddata
  • Scattered, want smooth & global → RBFInterpolator (tune kernel & epsilon)
  • Need derivatives / integrals / control over knots → make_interp_spline + BSpline basis

Official tutorial is still excellent: https://docs.scipy.org/doc/scipy/tutorial/interpolate.html (especially the 1D, multivariate, RBF sections)

Now — what kind of interpolation are you actually facing or curious about?

  • Noisy 1D time series?
  • Scattered sensor data?
  • Resampling images / audio?
  • Need monotonic / shape-preserving?
  • High-dimensional lookup table?

Tell me your use-case and we’ll build a tailored, realistic example (maybe even with fake data that looks like yours). 😊

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *