
Interpolation (scipy.interpolate) — SciPy v1.15.2 Manual
There are several general facilities available in SciPy for interpolation and smoothing for data in 1, 2, and higher dimensions. The choice of a specific interpolation routine depends on the data: whether it is one-dimensional, is given on a structured grid, or is unstructured.
CubicSpline — SciPy v1.15.2 Manual
class scipy.interpolate. CubicSpline (x, y, axis = 0, bc_type = 'not-a-knot', extrapolate = None) [source] # Cubic spline data interpolator. Interpolate data with a piecewise cubic polynomial which is twice continuously differentiable . The result is represented as a PPoly instance with breakpoints matching the given data. Parameters: x array ...
interp2d — SciPy v1.15.2 Manual
class scipy.interpolate. interp2d (x, y, z, kind = 'linear', copy = True, bounds_error = False, fill_value = None) [source] #
interp1d — SciPy v1.15.2 Manual
This class returns a function whose call method uses interpolation to find the value of new points. Parameters: x (npoints, ) array_like. A 1-D array of real values. y (…, npoints, …) array_like. A 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 ...
Smoothing splines — SciPy v1.15.2 Manual
To this end, scipy.interpolate allows constructing smoothing splines which balance how close the resulting curve, \(g(x)\), is to the data, and the smoothness of \(g(x)\). Mathematically, the task is to solve a penalized least-squares problem, where the penalty controls the smoothness of \(g(x)\) .
Extrapolation tips and tricks — SciPy v1.15.2 Manual
In fact, we will use the inverse interpolation: we interpolate the values of \(x\) versus \(у\). This way, solving the original equation becomes simply an evaluation of the interpolated function at zero \(y\) argument.
Scattered data interpolation (griddata) — SciPy v1.15.2 Manual
This example shows how to interpolate scattered 2-D data: >>> import numpy as np >>> from scipy.interpolate import RBFInterpolator >>> import matplotlib.pyplot as plt
griddata — SciPy v1.15.2 Manual
scipy.interpolate. griddata (points, values, xi, method = 'linear', fill_value = nan, rescale = False) [source] # Interpolate unstructured D-D data. Parameters :
PchipInterpolator — SciPy v1.15.2 Manual
class scipy.interpolate. PchipInterpolator (x, y, axis = 0, extrapolate = None) [source] # PCHIP 1-D monotonic cubic interpolation. 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 ...
pchip_interpolate — SciPy v1.15.2 Manual
See scipy.interpolate.PchipInterpolator for details. Parameters: xi array_like. A sorted list of x-coordinates, of length N. yi array_like. A 1-D array of real values. yi’s length along the interpolation axis must be equal to the length of xi. If N-D …