scipy 1.8.0 Pypi GitHub Homepage
Other Docs
BackRef

To remove in the future –– scipy.spatial

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

.. currentmodule:: scipy.spatial
    

Spatial transformations

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

Nearest-neighbor queries

.. autosummary:: 
    :toctree:generated/
    KDTree      -- class for efficient nearest-neighbor queries
    cKDTree     -- class for efficient nearest-neighbor queries (faster implementation)
    Rectangle

Distance metrics are contained in the scipy.spatial.distance submodule.

Delaunay triangulation, convex hulls, and Voronoi diagrams

.. autosummary:: 
    :toctree:generated/
    Delaunay    -- compute Delaunay triangulation of input points
    ConvexHull  -- compute a convex hull for input points
    Voronoi     -- compute a Voronoi diagram hull from input points
    SphericalVoronoi -- compute a Voronoi diagram from input points on the surface of a sphere
    HalfspaceIntersection -- compute the intersection points of input halfspaces

Plotting helpers

.. autosummary:: 
    :toctree:generated/
    delaunay_plot_2d     -- plot 2-D triangulation
    convex_hull_plot_2d  -- plot 2-D convex hull
    voronoi_plot_2d      -- plot 2-D Voronoi diagram
.. seealso:: :ref:`Tutorial <qhulltutorial>`
    

Simplex representation

The simplices (triangles, tetrahedra, etc.) appearing in the Delaunay tessellation (N-D simplices), convex hull facets, and Voronoi ridges (N-1-D simplices) are represented in the following scheme:

tess = Delaunay(points)
hull = ConvexHull(points)
voro = Voronoi(points)

# coordinates of the jth vertex of the ith simplex
tess.points[tess.simplices[i, j], :]        # tessellation element
hull.points[hull.simplices[i, j], :]        # convex hull facet
voro.vertices[voro.ridge_vertices[i, j], :] # ridge between Voronoi cells

For Delaunay triangulations and convex hulls, the neighborhood structure of the simplices satisfies the condition: tess.neighbors[i,j] is the neighboring simplex of the ith simplex, opposite to the j -vertex. It is -1 in case of no neighbor.

Convex hull facets also define a hyperplane equation:

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

Similar hyperplane equations for the Delaunay triangulation correspond to the convex hull facets on the corresponding N+1-D paraboloid.

The Delaunay triangulation objects offer a method for locating the simplex containing a given point, and barycentric coordinate computations.

Functions

.. autosummary:: 
    :toctree:generated/
    tsearch
    distance_matrix
    minkowski_distance
    minkowski_distance_p
    procrustes
    geometric_slerp

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

.. autosummary:: 
    :toctree:generated/
    QhullError

Examples

See :

Back References

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

scipy

45 Elements
scipy.spatial.distance.canberra
scipy.spatial._kdtree.KDTree.count_neighbors
scipy.spatial.distance.dice
scipy.spatial.distance.braycurtis
scipy.spatial.distance.euclidean
scipy.spatial.transform._rotation.Rotation
scipy.spatial._qhull.HalfspaceIntersection
scipy.spatial._kdtree.minkowski_distance
scipy.spatial.distance.yule
scipy.spatial.distance.sokalmichener
scipy.spatial._qhull.ConvexHull
scipy.spatial.distance.hamming
scipy.spatial.distance.jensenshannon
scipy.spatial._kdtree.minkowski_distance_p
scipy.spatial.distance.sqeuclidean
scipy.spatial._kdtree.KDTree.query_ball_tree
scipy.spatial._qhull.tsearch
scipy.spatial.distance.minkowski
scipy.spatial.distance.kulczynski1
scipy.spatial._qhull.Voronoi
scipy.spatial._geometric_slerp.geometric_slerp
scipy.spatial.distance.kulsinski
scipy.spatial.distance.jaccard
scipy.spatial.distance.chebyshev
scipy.spatial.distance.cdist
scipy.spatial._kdtree.KDTree.query_ball_point
scipy.spatial.transform._rotation_spline.RotationSpline
scipy.spatial.distance.mahalanobis
scipy.spatial.distance.rogerstanimoto
scipy.spatial._plotutils.voronoi_plot_2d
scipy.spatial._kdtree.KDTree.query
scipy.spatial._kdtree.KDTree.query_pairs
scipy.spatial.distance.russellrao
scipy.spatial.distance.cosine
scipy.spatial._qhull.Delaunay
scipy.spatial._plotutils.convex_hull_plot_2d
scipy.spatial.transform._rotation.Slerp
scipy.spatial.distance.directed_hausdorff
scipy.spatial._plotutils.delaunay_plot_2d
scipy.spatial._kdtree.distance_matrix
scipy.spatial._kdtree.KDTree.sparse_distance_matrix
scipy.spatial.distance.seuclidean
scipy.spatial.distance.sokalsneath
scipy.spatial._procrustes.procrustes
scipy.spatial.distance.cityblock

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/spatial/__init__.py#0
type: <class 'module'>
Commit: