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

2009-11-10 Thread Peter Schmidtke
On Tue, 10 Nov 2009 16:07:32 -0800, Christopher Barker 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? > > scipy.spatial.KDTr

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 http://mail.scipy.or

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

2009-11-10 Thread Robert Kern
On Wed, Nov 11, 2009 at 01:15, David Cournapeau 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 API may be easier (both Obj

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

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 wrote: > Anne Archibald wrote: > > 2009/11/10 Christopher Barker : > > >> 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-10 Thread Christopher Barker
Anne Archibald wrote: > 2009/11/10 Christopher Barker : >> 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 > su

Re: [Numpy-discussion] Import error in builds of 7726

2009-11-10 Thread David Cournapeau
Chris wrote: > I am building Numpy on OSX 10.6 using a recent update > from SVN (r7726). Though I was able to build the package > successfully, the resulting package generates an ImportError: > > import umath > ImportError: dlopen(/Library/Python/2.6/site-packages/ > numpy-1.4.0.dev7726-py2.6-m

[Numpy-discussion] Import error in builds of 7726

2009-11-10 Thread Chris
I am building Numpy on OSX 10.6 using a recent update from SVN (r7726). Though I was able to build the package successfully, the resulting package generates an ImportError: import umath ImportError: dlopen(/Library/Python/2.6/site-packages/ numpy-1.4.0.dev7726-py2.6-macosx-10.6- universal.egg/

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

2009-11-10 Thread josef . pktd
On Tue, Nov 10, 2009 at 7:48 PM, Anne Archibald wrote: > 2009/11/10 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). > > This is an eminently re

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 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

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

2009-11-10 Thread James Bergstra
On Tue, Nov 10, 2009 at 8:17 PM, Christopher Barker 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 >> >> It

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.

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

2009-11-10 Thread James Bergstra
On Tue, Nov 10, 2009 at 7:07 PM, Christopher Barker 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() seems like it's bui

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

2009-11-10 Thread Anne Archibald
2009/11/10 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). This is an eminently reasonable thing to want, and KDTree should support it. Unfortunatel

[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 kdt

Re: [Numpy-discussion] Solaris Sparc build broken

2009-11-10 Thread David Cournapeau
On Wed, Nov 11, 2009 at 6:18 AM, Michael Droettboom wrote: > I don't know if your 'long double' detection code is complete yet, but I > thought I'd share the current build output on one of our Solaris > machines.  It looks like it may just be a typo difference between > 'IEEE_QUAD_BE' in long_doub

Re: [Numpy-discussion] Solaris Sparc build broken

2009-11-10 Thread Michael Droettboom
I don't know if your 'long double' detection code is complete yet, but I thought I'd share the current build output on one of our Solaris machines. It looks like it may just be a typo difference between 'IEEE_QUAD_BE' in long_double_representation() and 'IEEE_QUAD_16B_BE' in setup.py, but I wa

Re: [Numpy-discussion] Numpy Array of dtype=object with strings and floats question

2009-11-10 Thread Darryl Wallace
Hello! On Tue, Nov 10, 2009 at 2:23 PM, Pierre GM wrote: > > On Nov 10, 2009, at 1:09 PM, Darryl Wallace wrote: > > > Hello again, > > > > The best way so far that's come to my attention is to use: > > > > numpy.ma.masked_object > > Will only work for masking one specific string, as you've notic

Re: [Numpy-discussion] Numpy Array of dtype=object with strings and floats question

2009-11-10 Thread Pierre GM
On Nov 10, 2009, at 1:09 PM, Darryl Wallace wrote: > Hello again, > > The best way so far that's come to my attention is to use: > > numpy.ma.masked_object Will only work for masking one specific string, as you've noticed. > > Can anyone help me so that all strings are found in the array with

Re: [Numpy-discussion] Numpy Array of dtype=object with strings and floats question

2009-11-10 Thread Darryl Wallace
Thanks for the help, I'll test out this simple example. On Tue, Nov 10, 2009 at 2:28 PM, Keith Goodman wrote: > On Tue, Nov 10, 2009 at 11:14 AM, Keith Goodman > wrote: > > On Tue, Nov 10, 2009 at 10:53 AM, Darryl Wallace > > wrote: > >> I currently do as you suggested. But when the dataset

Re: [Numpy-discussion] Numpy Array of dtype=object with strings and floats question

2009-11-10 Thread Keith Goodman
On Tue, Nov 10, 2009 at 11:28 AM, Keith Goodman wrote: > On Tue, Nov 10, 2009 at 11:14 AM, Keith Goodman wrote: >> On Tue, Nov 10, 2009 at 10:53 AM, Darryl Wallace >> wrote: >>> I currently do as you suggested.  But when the dataset size becomes large, >>> it gets to be quite slow due to the ove

Re: [Numpy-discussion] Numpy Array of dtype=object with strings and floats question

2009-11-10 Thread Keith Goodman
On Tue, Nov 10, 2009 at 11:14 AM, Keith Goodman wrote: > On Tue, Nov 10, 2009 at 10:53 AM, Darryl Wallace > wrote: >> I currently do as you suggested.  But when the dataset size becomes large, >> it gets to be quite slow due to the overhead of python looping. > > Are you using a for loop? Is so,

Re: [Numpy-discussion] Numpy Array of dtype=object with strings and floats question

2009-11-10 Thread Darryl Wallace
Hello, On Tue, Nov 10, 2009 at 1:32 PM, Gökhan Sever wrote: > On Tue, Nov 10, 2009 at 12:09 PM, Darryl Wallace > wrote: > > Hello again, > > The best way so far that's come to my attention is to use: > > numpy.ma.masked_object > > The problem with this is that it's looking for a specific instan

Re: [Numpy-discussion] Numpy Array of dtype=object with strings and floats question

2009-11-10 Thread Gökhan Sever
On Tue, Nov 10, 2009 at 12:09 PM, Darryl Wallace wrote: > Hello again, > The best way so far that's come to my attention is to use: > numpy.ma.masked_object > The problem with this is that it's looking for a specific instance of an > object.  So if the user had some elements of their array that we

Re: [Numpy-discussion] Numpy Array of dtype=object with strings and floats question

2009-11-10 Thread Darryl Wallace
Hello again, The best way so far that's come to my attention is to use: numpy.ma.masked_object The problem with this is that it's looking for a specific instance of an object. So if the user had some elements of their array that were, for example, "randomString" , then it would not be picked up