Re: [Numpy-discussion] Efficient way of binning points and, applying functions to these groups

2012-12-26 Thread Eric Emsellem
Thanks Ralf! this module looks great in fact. I didn't know it existed, and in fact It is only available in Scipy 0.11.0 (had to install from source since an Ubuntu 12.04 bin is not available). Too bad that the User-defined function only accepts one single array. If that function should take m

Re: [Numpy-discussion] dtype "reduction"

2012-12-26 Thread Nathaniel Smith
On Wed, Dec 26, 2012 at 8:09 PM, Nicolas Rougier wrote: > > > Hi all, > > > I'm looking for a way to "reduce" dtype1 into dtype2 (when it is possible of > course). > Is there some easy way to do that by any chance ? > > > dtype1 = np.dtype( [ ('vertex', [('x', 'f4'), >

[Numpy-discussion] numpy.testing.asserts and masked array

2012-12-26 Thread Chao YUE
Dear all, I found here http://mail.scipy.org/pipermail/numpy-discussion/2009-January/039681.html that to use* numpy.ma.testutils.assert_almost_equal* for masked array assertion, but I cannot find the np.ma.testutils module? Am I getting somewhere wrong? my numpy version is 1.6.2 thanks! Chao --

[Numpy-discussion] dtype "reduction"

2012-12-26 Thread Nicolas Rougier
Hi all, I'm looking for a way to "reduce" dtype1 into dtype2 (when it is possible of course). Is there some easy way to do that by any chance ? dtype1 = np.dtype( [ ('vertex', [('x', 'f4'), ('y', 'f4'), ('z', 'f4')]),

Re: [Numpy-discussion] Efficient way of binning points and applying functions to these groups

2012-12-26 Thread Ralf Gommers
On Wed, Dec 26, 2012 at 10:09 AM, Eric Emsellem wrote: > Hi! > > I am looking for an efficient way of doing some simple binning of points > and then applying some functions to points within each bin. > That's exactly what scipy.stats.binned_statistic does: http://docs.scipy.org/doc/scipy-dev/refe

Re: [Numpy-discussion] Efficient way of binning points and applying functions to these groups

2012-12-26 Thread Daπid
This looks like the perfect work for cython. It it's great opp optimizing loops. Another option is the new Numba, an automatic compiler. David. El 26/12/2012 10:09, "Eric Emsellem" escribió: > Hi! > > I am looking for an efficient way of doing some simple binning of points > and then applying so

[Numpy-discussion] Efficient way of binning points and applying functions to these groups

2012-12-26 Thread Eric Emsellem
Hi! I am looking for an efficient way of doing some simple binning of points and then applying some functions to points within each bin. I have tried several ways, including crude looping over the indices, or using digitize (see below) but I cannot manage to get it as efficient as I need it to