Find all points within distance r of point(s) x.
Parameters : | x : array_like, shape tuple + (self.m,)
r : positive float
p : float, optional
eps : nonnegative float, optional
|
---|---|
Returns : | results : list or array of lists
|
Notes
If you have many points whose neighbors you want to find, you may save substantial amounts of time by putting them in a cKDTree and using query_ball_tree.
Examples
>>> from scipy import spatial
>>> x, y = np.mgrid[0:4, 0:4]
>>> points = zip(x.ravel(), y.ravel())
>>> tree = spatial.cKDTree(points)
>>> tree.query_ball_point([2, 0], 1)
[4, 8, 9, 12]