[Numpy-discussion] finding close together points.

Anne Archibald peridot.faceted at gmail.com
Mon Nov 16 19:25:26 EST 2009


2009/11/16 Christopher Barker <Chris.Barker at noaa.gov>:
> Anne Archibald wrote:
>> 2009/11/13 Christopher Barker <Chris.Barker at noaa.gov>:
>>> Wow! great -- you sounded interested, but I had no idea you'd run out
>>> and do it! thanks! we'll check it out.
>
> well, it turns out the Python version is unacceptably slow. However, we
> found we could use ckdtree, and use:
>
> tree.query(points,
>             2, # Number of points to return per point given.
>             distance_upper_bound = distance_tolerance,
>            )
>
> This gives us a set of pairs of points closer than our distance
> tolerance -- it includes duplicates, of course, but even when we filter
> those in pure python, it's is nice and speedy.
>
> It looks like it would be pretty easy to add this to the Cython code,
> but it's working now for us, so...

You probably noticed this, but I should remind you that if a point has
more than one nearby neighbor, this may not give you what you wanted.
In particular, if there are three points all within the fixed distance
from each other, you may not find all three pairs this way.

Anne

> Thanks again,
>
> -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 at noaa.gov
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>



More information about the NumPy-Discussion mailing list