Module « scipy.interpolate »
Classe « LinearNDInterpolator »
Informations générales
Héritage
builtins.object
NDInterpolatorBase
LinearNDInterpolator
Définition
class LinearNDInterpolator(NDInterpolatorBase):
Description [extrait de LinearNDInterpolator.__doc__]
LinearNDInterpolator(points, values, fill_value=np.nan, rescale=False)
Piecewise linear interpolant in N > 1 dimensions.
.. versionadded:: 0.9
Methods
-------
__call__
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.
Notes
-----
The interpolant is constructed by triangulating the input data
with Qhull [1]_, and on each triangle performing linear
barycentric interpolation.
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 also
--------
griddata :
Interpolate unstructured D-D data.
NearestNDInterpolator :
Nearest-neighbor interpolation in N dimensions.
CloughTocher2DInterpolator :
Piecewise cubic, C1 smooth, curvature-minimizing interpolant in 2D.
References
----------
.. [1] http://www.qhull.org/
Constructeur(s)
Liste des opérateurs
Opérateurs hérités de la classe object
__eq__,
__ge__,
__gt__,
__le__,
__lt__,
__ne__
Liste des méthodes
Toutes les méthodes
Méthodes d'instance
Méthodes statiques
Méthodes dépréciées
Méthodes héritées de la classe NDInterpolatorBase
__call__, __init_subclass__, __subclasshook__
Méthodes héritées de la classe object
__delattr__,
__dir__,
__format__,
__getattribute__,
__hash__,
__reduce__,
__reduce_ex__,
__repr__,
__setattr__,
__sizeof__,
__str__
Améliorations / Corrections
Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.
Emplacement :
Description des améliorations :