[Numpy-discussion] Calculating density based on distance

2012-01-14 Thread Thiago Franco de Moraes
Hi all, I have the following problem: Given a array with dimension Nx3, where N is generally greater than 1.000.000, for each item in this array I have to calculate its density, Where its density is the number of items from the same array with distance less than a given r. The items are the

Re: [Numpy-discussion] Calculating density based on distance

2012-01-14 Thread Benjamin Root
On Saturday, January 14, 2012, Thiago Franco de Moraes totonixs...@gmail.com wrote: Hi all, I have the following problem: Given a array with dimension Nx3, where N is generally greater than 1.000.000, for each item in this array I have to calculate its density, Where its density is the

Re: [Numpy-discussion] Calculating density based on distance

2012-01-14 Thread Sturla Molden
Den 14.01.2012 21:52, skrev Thiago Franco de Moraes: Is there a better and faster way of doing that? Is there something in my Cython implementation I can do to perform better? You need to use a kd-tree to make the computation run in O(n log n) time instead of O(n**2). scipy.spatial.cKDTree

[Numpy-discussion] np.zeros(2, 'S') returns empty strings.

2012-01-14 Thread Charles R Harris
This sort of makes sense, but is it the 'correct' behavior? In [20]: zeros(2, 'S') Out[20]: array(['', ''], dtype='|S1') It might be more consistent to return '0' instead, as in In [3]: zeros(2, int).astype('S') Out[3]: array(['0', '0'], dtype='|S24') Chuck

Re: [Numpy-discussion] np.zeros(2, 'S') returns empty strings.

2012-01-14 Thread Benjamin Root
On Sat, Jan 14, 2012 at 4:12 PM, Charles R Harris charlesr.har...@gmail.com wrote: This sort of makes sense, but is it the 'correct' behavior? In [20]: zeros(2, 'S') Out[20]: array(['', ''], dtype='|S1') It might be more consistent to return '0' instead, as in In [3]: zeros(2,

Re: [Numpy-discussion] np.zeros(2, 'S') returns empty strings.

2012-01-14 Thread Benjamin Root
On Sat, Jan 14, 2012 at 4:16 PM, Benjamin Root ben.r...@ou.edu wrote: On Sat, Jan 14, 2012 at 4:12 PM, Charles R Harris charlesr.har...@gmail.com wrote: This sort of makes sense, but is it the 'correct' behavior? In [20]: zeros(2, 'S') Out[20]: array(['', ''], dtype='|S1') It

[Numpy-discussion] Fix for ticket #1973

2012-01-14 Thread Charles R Harris
I've put up a pull request for a fix to ticket #1973. Currently the fix simply propagates the maskna flag when the *.astype method is called. A more complicated option would be to add a maskna keyword to specify whether the output is masked or not or propagates the type of the source, but that

[Numpy-discussion] Negative indexing.

2012-01-14 Thread Nathan Faggian
Hi, I am finding it less than useful to have the negative index wrapping on nd-arrays. Here is a short example: import numpy as np a = np.zeros((3, 3)) a[:,2] = 1000 print a[0,-1] print a[0,-1] print a[-1,-1] In all cases 1000 is printed out. What I am after is a way to say please don't wrap

Re: [Numpy-discussion] np.zeros(2, 'S') returns empty strings.

2012-01-14 Thread josef . pktd
On Sat, Jan 14, 2012 at 5:25 PM, Benjamin Root ben.r...@ou.edu wrote: On Sat, Jan 14, 2012 at 4:16 PM, Benjamin Root ben.r...@ou.edu wrote: On Sat, Jan 14, 2012 at 4:12 PM, Charles R Harris charlesr.har...@gmail.com wrote: This sort of makes sense, but is it the 'correct' behavior? In

Re: [Numpy-discussion] GSOC

2012-01-14 Thread Charles R Harris
On Thu, Dec 29, 2011 at 2:36 PM, Ralf Gommers ralf.gomm...@googlemail.comwrote: On Thu, Dec 29, 2011 at 9:50 PM, Charles R Harris charlesr.har...@gmail.com wrote: Hi All, I thought I'd raise this topic just to get some ideas out there. At the moment I see two areas that I'd like to see

Re: [Numpy-discussion] Calculating density based on distance

2012-01-14 Thread Thiago Franco Moraes
No dia Sábado, 14 de Janeiro de 2012, Benjamin rootben.r...@ou.edu escreveu: On Saturday, January 14, 2012, Thiago Franco de Moraes totonixs...@gmail.com wrote: Hi all, I have the following problem: Given a array with dimension Nx3, where N is generally greater than 1.000.000, for each

Re: [Numpy-discussion] np.zeros(2, 'S') returns empty strings.

2012-01-14 Thread Charles R Harris
On Sat, Jan 14, 2012 at 5:21 PM, josef.p...@gmail.com wrote: On Sat, Jan 14, 2012 at 5:25 PM, Benjamin Root ben.r...@ou.edu wrote: On Sat, Jan 14, 2012 at 4:16 PM, Benjamin Root ben.r...@ou.edu wrote: On Sat, Jan 14, 2012 at 4:12 PM, Charles R Harris charlesr.har...@gmail.com wrote:

Re: [Numpy-discussion] np.zeros(2, 'S') returns empty strings.

2012-01-14 Thread Paul Anton Letnes
On 15. jan. 2012, at 01:21, josef.p...@gmail.com wrote: On Sat, Jan 14, 2012 at 5:25 PM, Benjamin Root ben.r...@ou.edu wrote: On Sat, Jan 14, 2012 at 4:16 PM, Benjamin Root ben.r...@ou.edu wrote: On Sat, Jan 14, 2012 at 4:12 PM, Charles R Harris charlesr.har...@gmail.com wrote: This