[Numpy-discussion] finding close together points.
Christopher Barker
Chris.Barker@noaa....
Tue Nov 10 18:07:32 CST 2009
Hi all,
I have a bunch of points in 2-d space, and I need to find out which
pairs of points are within a certain distance of one-another (regular
old Euclidean norm).
scipy.spatial.KDTree.query_ball_tree() seems like it's built for this.
However, I'm a bit confused. The first argument is a kdtree, but I'm
calling it as a method of a kdtree -- I want to know which points in the
tree I already have are closer that some r from each-other.
If I call it as:
tree.query_ball_tree(tree, r)
I get a big list, that has all the points in it (some of them paired up
with close neighbors.) It appears I'm getting the distances between all
the points in the tree and itself, as though they were different trees.
This is slow, takes a bunch of memory, and I then have to parse out the
list to find the ones that are paired up.
Is there a way to get just the close ones from the single tree?
thanks,
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov
More information about the NumPy-Discussion
mailing list