scipy 1.8.0 Pypi GitHub Homepage
Other Docs
MethodsNotesParametersBackRef
LinearNDInterpolator(points, values, fill_value=np.nan, rescale=False)
versionadded

Methods

Notes

The interpolant is constructed by triangulating the input data with Qhull , and on each triangle performing linear barycentric interpolation.

Parameters

points : ndarray of floats, shape (npoints, ndims); or Delaunay

Data point coordinates, or a precomputed Delaunay triangulation.

values : ndarray of float or complex, shape (npoints, ...)

Data values.

fill_value : float, optional

Value used to fill in for requested points outside of the convex hull of the input points. If not provided, then the default is nan .

rescale : bool, optional

Rescale points to unit cube before performing interpolation. This is useful if some of the input dimensions have incommensurable units and differ by many orders of magnitude.

Piecewise linear interpolant in N > 1 dimensions.

See Also

CloughTocher2DInterpolator

Piecewise cubic, C1 smooth, curvature-minimizing interpolant in 2D.

NearestNDInterpolator

Nearest-neighbor interpolation in N dimensions.

griddata

Interpolate unstructured D-D data.

Examples

We can interpolate values on a 2D plane:

>>> from scipy.interpolate import LinearNDInterpolator
... import matplotlib.pyplot as plt
... rng = np.random.default_rng()
... x = rng.random(10) - 0.5
... y = rng.random(10) - 0.5
... z = np.hypot(x, y)
... X = np.linspace(min(x), max(x))
... Y = np.linspace(min(y), max(y))
... X, Y = np.meshgrid(X, Y) # 2D grid for interpolation
... interp = LinearNDInterpolator(list(zip(x, y)), z)
... Z = interp(X, Y)
... plt.pcolormesh(X, Y, Z, shading='auto')
... plt.plot(x, y, "ok", label="input point")
... plt.legend()
... plt.colorbar()
... plt.axis("equal")
... plt.show()
See :

Back References

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

scipy.interpolate._interpolate.interpn scipy.interpolate._ndgriddata.griddata scipy.interpolate._interpolate.RegularGridInterpolator scipy.interpolate.interpnd.LinearNDInterpolator scipy.interpolate._rbfinterp.RBFInterpolator scipy.interpolate._ndgriddata.NearestNDInterpolator

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/interpnd.cpython-39-darwin.so#None
type: <class 'type'>
Commit: