Re: [Numpy-discussion] Extract subset from an array

2010-02-17 Thread Nicola Creati
Francesc Alted wrote: > A Wednesday 17 February 2010 08:34:06 Nicola Creati escrigué: > >> Any kind of improvement is really appreciated. >> > > Well, if you cannot really transpose your matrix, numexpr can also serve as a > good accelerator: > > In [1]: import numpy as np > > In [2]: impo

Re: [Numpy-discussion] Extract subset from an array

2010-02-17 Thread Francesc Alted
A Wednesday 17 February 2010 08:34:06 Nicola Creati escrigué: > Any kind of improvement is really appreciated. Well, if you cannot really transpose your matrix, numexpr can also serve as a good accelerator: In [1]: import numpy as np In [2]: import numexpr as ne In [3]: x_min, x_max, y_min, y_

Re: [Numpy-discussion] Extract subset from an array

2010-02-16 Thread Nicola Creati
Neil Crighton wrote: > Francesc Alted pytables.org> writes: > > >> In [10]: array = np.random.random((3, 1000)) >> >> then the time drops significantly: >> >> In [11]: time (array[0]>x_min) & (array[0]y_min) & >> (array[1]> CPU times: user 0.15 s, sys: 0.01 s, total: 0.16 s >> Wall time: 0

Re: [Numpy-discussion] Extract subset from an array

2010-02-16 Thread Neil Crighton
Francesc Alted pytables.org> writes: > In [10]: array = np.random.random((3, 1000)) > > then the time drops significantly: > > In [11]: time (array[0]>x_min) & (array[0]y_min) & > (array[1] CPU times: user 0.15 s, sys: 0.01 s, total: 0.16 s > Wall time: 0.16 s > Out[12]: array([False, Fals

Re: [Numpy-discussion] Extract subset from an array

2010-02-16 Thread Francesc Alted
A Tuesday 16 February 2010 13:42:37 Nicola Creati escrigué: > Hello, > I need to extract a subset from a Nx3 array. Each row has x, y, and z > coordinates. > The subset is just a portion of the array in which the following > condition realizes > > x_min < x < x_max and y_min < y < y_max > > The p

Re: [Numpy-discussion] Extract subset from an array

2010-02-16 Thread Robert Kern
On Tue, Feb 16, 2010 at 06:42, Nicola Creati wrote: > Hello, > I need to extract a subset from a Nx3 array. Each row has x, y, and z > coordinates. > The subset is just a portion of the array in which the following > condition realizes > > x_min < x < x_max and y_min < y < y_max > > The problem re

[Numpy-discussion] Extract subset from an array

2010-02-16 Thread Nicola Creati
Hello, I need to extract a subset from a Nx3 array. Each row has x, y, and z coordinates. The subset is just a portion of the array in which the following condition realizes x_min < x < x_max and y_min < y < y_max The problem reduce to the extraction of points inside a rectangular box defined