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

1""" 

2============================================================= 

3Spatial algorithms and data structures (:mod:`scipy.spatial`) 

4============================================================= 

5 

6.. currentmodule:: scipy.spatial 

7 

8Spatial transformations 

9======================= 

10 

11These are contained in the `scipy.spatial.transform` submodule. 

12 

13Nearest-neighbor queries 

14======================== 

15.. autosummary:: 

16 :toctree: generated/ 

17 

18 KDTree -- class for efficient nearest-neighbor queries 

19 cKDTree -- class for efficient nearest-neighbor queries (faster implementation) 

20 Rectangle 

21 

22Distance metrics 

23================ 

24 

25Distance metrics are contained in the :mod:`scipy.spatial.distance` submodule. 

26 

27Delaunay triangulation, convex hulls, and Voronoi diagrams 

28========================================================== 

29 

30.. autosummary:: 

31 :toctree: generated/ 

32 

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 

38 

39Plotting helpers 

40================ 

41 

42.. autosummary:: 

43 :toctree: generated/ 

44 

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 

48 

49.. seealso:: :ref:`Tutorial <qhulltutorial>` 

50 

51 

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:: 

57 

58 tess = Delaunay(points) 

59 hull = ConvexHull(points) 

60 voro = Voronoi(points) 

61 

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 

66 

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. 

71 

72Convex hull facets also define a hyperplane equation:: 

73 

74 (hull.equations[i,:-1] * coord).sum() + hull.equations[i,-1] == 0 

75 

76Similar hyperplane equations for the Delaunay triangulation correspond 

77to the convex hull facets on the corresponding N+1-D 

78paraboloid. 

79 

80The Delaunay triangulation objects offer a method for locating the 

81simplex containing a given point, and barycentric coordinate 

82computations. 

83 

84Functions 

85--------- 

86 

87.. autosummary:: 

88 :toctree: generated/ 

89 

90 tsearch 

91 distance_matrix 

92 minkowski_distance 

93 minkowski_distance_p 

94 procrustes 

95 geometric_slerp 

96 

97Warnings / Errors used in :mod:`scipy.spatial` 

98---------------------------------------------- 

99.. autosummary:: 

100 :toctree: generated/ 

101 

102 QhullError 

103""" 

104 

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 

112 

113# Deprecated namespaces, to be removed in v2.0.0 

114from . import ckdtree, kdtree, qhull 

115 

116__all__ = [s for s in dir() if not s.startswith('_')] 

117 

118from . import distance, transform 

119 

120__all__ += ['distance', 'transform'] 

121 

122from scipy._lib._testutils import PytestTester 

123test = PytestTester(__name__) 

124del PytestTester