bundles / scipy 1.17.1 / scipy / interpolate / _rgi / RegularGridInterpolator / __call__
function
scipy.interpolate._rgi:RegularGridInterpolator.__call__
source: /scipy/interpolate/_rgi.py :375
Signature
def __call__ ( self , xi , method = None , * , nu = None ) Summary
Interpolation at coordinates.
Parameters
xi: ndarray of shape (..., ndim)The coordinates to evaluate the interpolator at.
method: str, optionalThe method of interpolation to perform. Supported are "linear", "nearest", "slinear", "cubic", "quintic" and "pchip". Default is the method chosen when the interpolator was created.
nu: sequence of ints, length ndim, optionalIf not None, the orders of the derivatives to evaluate. Each entry must be non-negative. Only allowed for methods "slinear", "cubic" and "quintic".
Returns
values_x: ndarray, shape xi.shape[:-1] + values.shape[ndim:]Interpolated values at
xi. See notes for behaviour whenxi.ndim == 1.
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:].
Examples
Here we define a nearest-neighbor interpolator of a simple functionimport 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')✓
interp([[1.5, 1.3], [0.3, 4.5]])
✓interp([[1.5, 1.3], [0.3, 4.5]], method='linear')
✓Aliases
-
scipy.interpolate.RegularGridInterpolator.__call__