Vous êtes un professionnel et vous avez besoin d'une formation ?
Deep Learning avec Python
et Keras et Tensorflow
Voir le programme détaillé
Module « scipy.interpolate »
Classe « CloughTocher2DInterpolator »
Informations générales
Héritage
builtins.object
NDInterpolatorBase
CloughTocher2DInterpolator
Définition
class CloughTocher2DInterpolator(NDInterpolatorBase):
help(CloughTocher2DInterpolator)
CloughTocher2DInterpolator(points, values, tol=1e-6).
Piecewise cubic, C1 smooth, curvature-minimizing interpolator in 2D.
.. versionadded:: 0.9
Methods
-------
__call__
Parameters
----------
points : ndarray of floats, shape (npoints, ndims); or Delaunay
2-D array of data point coordinates, or a precomputed Delaunay triangulation.
values : ndarray of float or complex, shape (npoints, ...)
N-D array of data values at `points`. The length of `values` along the
first axis must be equal to the length of `points`. Unlike some
interpolators, the interpolation axis cannot be changed.
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``.
tol : float, optional
Absolute/relative tolerance for gradient estimation.
maxiter : int, optional
Maximum number of iterations in gradient estimation.
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 constructing a piecewise cubic
interpolating Bezier polynomial on each triangle, using a
Clough-Tocher scheme [CT]_. The interpolant is guaranteed to be
continuously differentiable.
The gradients of the interpolant are chosen so that the curvature
of the interpolating surface is approximatively minimized. The
gradients necessary for this are estimated using the global
algorithm described in [Nielson83]_ and [Renka84]_.
.. note:: For data on a regular grid use `interpn` instead.
Examples
--------
We can interpolate values on a 2D plane:
>>> from scipy.interpolate import CloughTocher2DInterpolator
>>> import numpy as np
>>> 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 = CloughTocher2DInterpolator(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.
LinearNDInterpolator :
Piecewise linear interpolator in N > 1 dimensions.
NearestNDInterpolator :
Nearest-neighbor interpolator in N > 1 dimensions.
interpn : Interpolation on a regular grid or rectilinear grid.
RegularGridInterpolator : Interpolator on a regular or rectilinear grid
in arbitrary dimensions (`interpn` wraps this
class).
References
----------
.. [1] http://www.qhull.org/
.. [CT] See, for example,
P. Alfeld,
''A trivariate Clough-Tocher scheme for tetrahedral data''.
Computer Aided Geometric Design, 1, 169 (1984);
G. Farin,
''Triangular Bernstein-Bezier patches''.
Computer Aided Geometric Design, 3, 83 (1986).
.. [Nielson83] G. Nielson,
''A method for interpolating scattered data based upon a minimum norm
network''.
Math. Comp., 40, 253 (1983).
.. [Renka84] R. J. Renka and A. K. Cline.
''A Triangle-based C1 interpolation method.'',
Rocky Mountain J. Math., 14, 223 (1984).
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__,
__getstate__,
__hash__,
__reduce__,
__reduce_ex__,
__repr__,
__setattr__,
__sizeof__,
__str__
Vous êtes un professionnel et vous avez besoin d'une formation ?
Deep Learning avec Python
et Keras et Tensorflow
Voir le programme détaillé
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 :