Re: [Numpy-discussion] finding close together points.

2009-11-16 Thread Anne Archibald
2009/11/16 Christopher Barker chris.bar...@noaa.gov: Anne Archibald wrote: 2009/11/13 Christopher Barker chris.bar...@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

Re: [Numpy-discussion] finding close together points.

2009-11-13 Thread Christopher Barker
Anne Archibald wrote: 2009/11/10 Christopher Barker chris.bar...@noaa.gov: 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). This is now implemented in SVN. Wow! great -- you sounded

Re: [Numpy-discussion] finding close together points.

2009-11-13 Thread Anne Archibald
2009/11/13 Christopher Barker chris.bar...@noaa.gov: Anne Archibald wrote: 2009/11/10 Christopher Barker chris.bar...@noaa.gov: 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). This

Re: [Numpy-discussion] finding close together points.

2009-11-12 Thread Christopher Barker
Peter Schmidtke wrote: On Tue, 10 Nov 2009 16:07:32 -0800, Christopher Barker chris.bar...@noaa.gov wrote: 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). How big is your set

Re: [Numpy-discussion] finding close together points.

2009-11-12 Thread Christopher Barker
David Cournapeau wrote: I would love having a core C library of containers - I'm all for that. However, I think that a very, very common need is simply for a growable numpy array. It seems this would actually be pretty darn easy (again, for someone familiar with the code!). IIUC, it would

Re: [Numpy-discussion] finding close together points.

2009-11-12 Thread Charles R Harris
On Thu, Nov 12, 2009 at 10:01 AM, Christopher Barker chris.bar...@noaa.govwrote: Peter Schmidtke wrote: On Tue, 10 Nov 2009 16:07:32 -0800, Christopher Barker chris.bar...@noaa.gov wrote: I have a bunch of points in 2-d space, and I need to find out which pairs of points are within a

Re: [Numpy-discussion] finding close together points.

2009-11-12 Thread Christopher Barker
Lou Pecora wrote: Maybe I'm missing something simple, but if your array of 2D points is static, well, not quite. a KD tree for 2D nearest neighbor seems like over kill. You might want to try the simple approach of using boxes of points to narrow things down by sorting on the first

Re: [Numpy-discussion] finding close together points.

2009-11-12 Thread Charles R Harris
On Thu, Nov 12, 2009 at 10:32 AM, Christopher Barker chris.bar...@noaa.govwrote: David Cournapeau wrote: I would love having a core C library of containers - I'm all for that. However, I think that a very, very common need is simply for a growable numpy array. It seems this would

Re: [Numpy-discussion] finding close together points.

2009-11-12 Thread Robert Kern
On Thu, Nov 12, 2009 at 11:39, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Nov 12, 2009 at 10:32 AM, Christopher Barker chris.bar...@noaa.gov wrote: David Cournapeau wrote: I would love having a core C library of containers - I'm all for that. However, I think that a very,

Re: [Numpy-discussion] finding close together points.

2009-11-12 Thread Lou Pecora
- Original Message From: Christopher Barker chris.bar...@noaa.gov To: Discussion of Numerical Python numpy-discussion@scipy.org Sent: Thu, November 12, 2009 12:37:37 PM Subject: Re: [Numpy-discussion] finding close together points. Lou Pecora wrote: a KD tree for 2D nearest neighbor

Re: [Numpy-discussion] finding close together points.

2009-11-12 Thread Anne Archibald
2009/11/12 Lou Pecora lou_boog2...@yahoo.com: - Original Message From: Christopher Barker chris.bar...@noaa.gov To: Discussion of Numerical Python numpy-discussion@scipy.org Sent: Thu, November 12, 2009 12:37:37 PM Subject: Re: [Numpy-discussion] finding close together points

Re: [Numpy-discussion] finding close together points.

2009-11-12 Thread Christopher Barker
Robert Kern wrote: Didn't we already do this? http://www.mail-archive.com/numpy-discussion@scipy.org/msg21010.html Indeed we did. What I posted then ( and have improved a bit now). Is a Python version. Written in Python, it has an advantage of using less memory for a big array, but is

Re: [Numpy-discussion] finding close together points.

2009-11-12 Thread Charles R Harris
On Thu, Nov 12, 2009 at 12:52 PM, Christopher Barker chris.bar...@noaa.govwrote: Robert Kern wrote: Didn't we already do this? http://www.mail-archive.com/numpy-discussion@scipy.org/msg21010.html Indeed we did. What I posted then ( and have improved a bit now). Is a Python version.

Re: [Numpy-discussion] finding close together points.

2009-11-12 Thread Charles R Harris
On Thu, Nov 12, 2009 at 3:30 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Nov 12, 2009 at 12:52 PM, Christopher Barker chris.bar...@noaa.gov wrote: Robert Kern wrote: Didn't we already do this? http://www.mail-archive.com/numpy-discussion@scipy.org/msg21010.html

Re: [Numpy-discussion] finding close together points.

2009-11-12 Thread Christopher Barker
Charles R Harris wrote: So what you buy with an array implementation is the space/time efficiency of not having to allocate python types to put on the list. But you probably need to go through a python type at some point anyway, When writing Python, yes (though maybe not if you are

Re: [Numpy-discussion] finding close together points.

2009-11-12 Thread Christopher Barker
Charles R Harris wrote: And here is a pep http://www.python.org/dev/peps/pep-3128/%20 That link was broken, try this one: http://www.python.org/dev/peps/pep-3128/ -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/ORR(206) 526-6959 voice

Re: [Numpy-discussion] finding close together points.

2009-11-12 Thread Anne Archibald
2009/11/11 Christopher Barker chris.bar...@noaa.gov: Anne Archibald wrote: 2009/11/10 Christopher Barker chris.bar...@noaa.gov: 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).

Re: [Numpy-discussion] finding close together points.

2009-11-11 Thread Lou Pecora
- Original Message From: Christopher Barker chris.bar...@noaa.gov To: Discussion of Numerical Python numpy-discussion@scipy.org Sent: Tue, November 10, 2009 7:07:32 PM Subject: [Numpy-discussion] finding close together points. Hi all, I have a bunch of points in 2-d space, and I need

Re: [Numpy-discussion] finding close together points.

2009-11-11 Thread Charles R Harris
On Tue, Nov 10, 2009 at 11:15 PM, David Cournapeau da...@ar.media.kyoto-u.ac.jp wrote: Charles R Harris wrote: I think Python lists are basically just expanding arrays and pointers are cheap. Where you might lose is in creating python objects to put in the list and not having ufuncs and

[Numpy-discussion] finding close together points.

2009-11-10 Thread Christopher Barker
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

Re: [Numpy-discussion] finding close together points.

2009-11-10 Thread Anne Archibald
2009/11/10 Christopher Barker chris.bar...@noaa.gov: 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). This is an eminently reasonable thing to want, and KDTree should support

Re: [Numpy-discussion] finding close together points.

2009-11-10 Thread James Bergstra
On Tue, Nov 10, 2009 at 7:07 PM, Christopher Barker chris.bar...@noaa.gov wrote: 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()

Re: [Numpy-discussion] finding close together points.

2009-11-10 Thread Christopher Barker
James Bergstra wrote: In some cases a brute-force approach is also good. true. If r is a matrix of shape Nx2: (r*r).sum(axis=1) -2 * numpy.dot(r, r.T) + (r*r).sum(axis=1).reshape((r.shape[0], 1)) thresh**2 It's brute force, but it takes advantage of fast matrix multiplication. I'm

Re: [Numpy-discussion] finding close together points.

2009-11-10 Thread James Bergstra
On Tue, Nov 10, 2009 at 8:17 PM, Christopher Barker chris.bar...@noaa.gov wrote: James Bergstra wrote: In some cases a brute-force approach is also good. true. If r is a matrix of shape Nx2: (r*r).sum(axis=1) -2 * numpy.dot(r, r.T) + (r*r).sum(axis=1).reshape((r.shape[0], 1)) thresh**2

Re: [Numpy-discussion] finding close together points.

2009-11-10 Thread David Goldsmith
Also, is it not returning distances between points and themselves? Or am I misinterpreting it? DG On Tue, Nov 10, 2009 at 5:17 PM, Christopher Barker chris.bar...@noaa.govwrote: James Bergstra wrote: In some cases a brute-force approach is also good. true. If r is a matrix of shape

Re: [Numpy-discussion] finding close together points.

2009-11-10 Thread josef . pktd
On Tue, Nov 10, 2009 at 7:48 PM, Anne Archibald peridot.face...@gmail.com wrote: 2009/11/10 Christopher Barker chris.bar...@noaa.gov: 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

Re: [Numpy-discussion] finding close together points.

2009-11-10 Thread Christopher Barker
Anne Archibald wrote: 2009/11/10 Christopher Barker chris.bar...@noaa.gov: 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). This is an eminently reasonable thing to want, and

Re: [Numpy-discussion] finding close together points.

2009-11-10 Thread Charles R Harris
On Tue, Nov 10, 2009 at 10:51 PM, Christopher Barker chris.bar...@noaa.govwrote: Anne Archibald wrote: 2009/11/10 Christopher Barker chris.bar...@noaa.gov: 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

Re: [Numpy-discussion] finding close together points.

2009-11-10 Thread David Cournapeau
Charles R Harris wrote: I think Python lists are basically just expanding arrays and pointers are cheap. Where you might lose is in creating python objects to put in the list and not having ufuncs and the rest of the numpy machinery. If you don't need the machinery, lists are probably not a

Re: [Numpy-discussion] finding close together points.

2009-11-10 Thread Robert Kern
On Wed, Nov 11, 2009 at 01:15, David Cournapeau da...@ar.media.kyoto-u.ac.jp wrote:    - The Apple Core Foundation (I have to check the Apple license is ok). No. The APSL is not DFSG-free. It is more complex, but is designed with objective-C in mind, meaning integration with the C python

Re: [Numpy-discussion] finding close together points.

2009-11-10 Thread David Cournapeau
Robert Kern wrote: No. The APSL is not DFSG-free. It was too good to be true, I guess. http://c-algorithms.sourceforge.net/ Thanks for the link, David ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] finding close together points.

2009-11-10 Thread Peter Schmidtke
On Tue, 10 Nov 2009 16:07:32 -0800, Christopher Barker chris.bar...@noaa.gov wrote: 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). How big is your set of points?