Loading [MathJax]/extensions/tex2jax.js
scipy 1.10.1 Pypi GitHub Homepage
Other Docs

NotesParametersReturns
RegularGridInterpolator.__call__(self, xi, method=None)

Notes

In the case that xi.ndim == 1 a new axis is inserted into the 0 position of the returned array, values_x, so its shape is instead (1,) + values.shape[ndim:].

Parameters

xi : ndarray of shape (..., ndim)

The coordinates to evaluate the interpolator at.

method : str, optional

The method of interpolation to perform. Supported are "linear", "nearest", "slinear", "cubic", "quintic" and "pchip". Default is the method chosen when the interpolator was created.

Returns

values_x : ndarray, shape xi.shape[:-1] + values.shape[ndim:]

Interpolated values at xi. See notes for behaviour when xi.ndim == 1.

Interpolation at coordinates.

Examples

Here we define a nearest-neighbor interpolator of a simple function
import numpy as np
x, y = np.array([0, 1, 2]), np.array([1, 3, 7])
def f(x, y):
    return x**2 + y**2
data = f(*np.meshgrid(x, y, indexing='ij', sparse=True))
from scipy.interpolate import RegularGridInterpolator
interp = RegularGridInterpolator((x, y), data, method='nearest')
By construction, the interpolator uses the nearest-neighbor interpolation
interp([[1.5, 1.3], [0.3, 4.5]])
We can however evaluate the linear interpolant by overriding the `method` parameter
interp([[1.5, 1.3], [0.3, 4.5]], method='linear')
See :

Local connectivity graph

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


GitHub : /scipy/interpolate/_rgi.py#274
type: <class 'function'>
Commit: