Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/scipy/spatial/__init__.py: 100%
14 statements
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-12 06:31 +0000
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-12 06:31 +0000
1"""
2=============================================================
3Spatial algorithms and data structures (:mod:`scipy.spatial`)
4=============================================================
6.. currentmodule:: scipy.spatial
8Spatial transformations
9=======================
11These are contained in the `scipy.spatial.transform` submodule.
13Nearest-neighbor queries
14========================
15.. autosummary::
16 :toctree: generated/
18 KDTree -- class for efficient nearest-neighbor queries
19 cKDTree -- class for efficient nearest-neighbor queries (faster implementation)
20 Rectangle
22Distance metrics
23================
25Distance metrics are contained in the :mod:`scipy.spatial.distance` submodule.
27Delaunay triangulation, convex hulls, and Voronoi diagrams
28==========================================================
30.. autosummary::
31 :toctree: generated/
33 Delaunay -- compute Delaunay triangulation of input points
34 ConvexHull -- compute a convex hull for input points
35 Voronoi -- compute a Voronoi diagram hull from input points
36 SphericalVoronoi -- compute a Voronoi diagram from input points on the surface of a sphere
37 HalfspaceIntersection -- compute the intersection points of input halfspaces
39Plotting helpers
40================
42.. autosummary::
43 :toctree: generated/
45 delaunay_plot_2d -- plot 2-D triangulation
46 convex_hull_plot_2d -- plot 2-D convex hull
47 voronoi_plot_2d -- plot 2-D Voronoi diagram
49.. seealso:: :ref:`Tutorial <qhulltutorial>`
52Simplex representation
53======================
54The simplices (triangles, tetrahedra, etc.) appearing in the Delaunay
55tessellation (N-D simplices), convex hull facets, and Voronoi ridges
56(N-1-D simplices) are represented in the following scheme::
58 tess = Delaunay(points)
59 hull = ConvexHull(points)
60 voro = Voronoi(points)
62 # coordinates of the jth vertex of the ith simplex
63 tess.points[tess.simplices[i, j], :] # tessellation element
64 hull.points[hull.simplices[i, j], :] # convex hull facet
65 voro.vertices[voro.ridge_vertices[i, j], :] # ridge between Voronoi cells
67For Delaunay triangulations and convex hulls, the neighborhood
68structure of the simplices satisfies the condition:
69``tess.neighbors[i,j]`` is the neighboring simplex of the ith
70simplex, opposite to the ``j``-vertex. It is -1 in case of no neighbor.
72Convex hull facets also define a hyperplane equation::
74 (hull.equations[i,:-1] * coord).sum() + hull.equations[i,-1] == 0
76Similar hyperplane equations for the Delaunay triangulation correspond
77to the convex hull facets on the corresponding N+1-D
78paraboloid.
80The Delaunay triangulation objects offer a method for locating the
81simplex containing a given point, and barycentric coordinate
82computations.
84Functions
85---------
87.. autosummary::
88 :toctree: generated/
90 tsearch
91 distance_matrix
92 minkowski_distance
93 minkowski_distance_p
94 procrustes
95 geometric_slerp
97Warnings / Errors used in :mod:`scipy.spatial`
98----------------------------------------------
99.. autosummary::
100 :toctree: generated/
102 QhullError
103"""
105from ._kdtree import *
106from ._ckdtree import *
107from ._qhull import *
108from ._spherical_voronoi import SphericalVoronoi
109from ._plotutils import *
110from ._procrustes import procrustes
111from ._geometric_slerp import geometric_slerp
113# Deprecated namespaces, to be removed in v2.0.0
114from . import ckdtree, kdtree, qhull
116__all__ = [s for s in dir() if not s.startswith('_')]
118from . import distance, transform
120__all__ += ['distance', 'transform']
122from scipy._lib._testutils import PytestTester
123test = PytestTester(__name__)
124del PytestTester