scipy 1.8.0 Pypi GitHub Homepage
Other Docs
NotesParametersReturnsBackRef
interpn(points, values, xi, method='linear', bounds_error=True, fill_value=nan)

Notes

versionadded

Parameters

points : tuple of ndarray of float, with shapes (m1, ), ..., (mn, )

The points defining the regular grid in n dimensions.

values : array_like, shape (m1, ..., mn, ...)

The data on the regular grid in n dimensions.

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

The coordinates to sample the gridded data at

method : str, optional

The method of interpolation to perform. Supported are "linear" and "nearest", and "splinef2d". "splinef2d" is only supported for 2-dimensional data.

bounds_error : bool, optional

If True, when interpolated values are requested outside of the domain of the input data, a ValueError is raised. If False, then :None:None:`fill_value` is used.

fill_value : number, optional

If provided, the value to use for points outside of the interpolation domain. If None, values outside the domain are extrapolated. Extrapolation is not supported by method "splinef2d".

Returns

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

Interpolated values at input coordinates.

Multidimensional interpolation on regular grids.

See Also

LinearNDInterpolator

Piecewise linear interpolant on unstructured data in N dimensions

NearestNDInterpolator

Nearest neighbor interpolation on unstructured data in N dimensions

RectBivariateSpline

Bivariate spline approximation over a rectangular mesh

RegularGridInterpolator

Linear and nearest-neighbor Interpolation on a regular grid in arbitrary dimensions

Examples

Evaluate a simple example function on the points of a regular 3-D grid:

>>> from scipy.interpolate import interpn
... def value_func_3d(x, y, z):
...  return 2 * x + 3 * y - z
... x = np.linspace(0, 4, 5)
... y = np.linspace(0, 5, 6)
... z = np.linspace(0, 6, 7)
... points = (x, y, z)
... values = value_func_3d(*np.meshgrid(*points, indexing='ij'))

Evaluate the interpolating function at a point

>>> point = np.array([2.21, 3.12, 1.15])
... print(interpn(points, values, point)) [12.63]
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy.interpolate._interpolate.interp2d scipy.interpolate._interpolate.interpn

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/_interpolate.py#2586
type: <class 'function'>
Commit: