scipy.spatial.KDTree.query_ball_tree

KDTree.query_ball_tree(other, r, p=2.0, eps=0)

Find all pairs of points whose distance is at most r

Parameters :

other : KDTree

The tree containing points to search against

r : positive float

The maximum distance

p : float 1<=p<=infinity

Which Minkowski norm to use

eps : nonnegative float

Approximate search. Branches of the tree are not explored if their nearest points are further than r/(1+eps), and branches are added in bulk if their furthest points are nearer than r*(1+eps).

Returns :

results : list of lists

For each element self.data[i] of this tree, results[i] is a list of the indices of its neighbors in other.data.

This Page