Re: [Numpy-discussion] Search array in array

2013-07-29 Thread Nicola Creati
On 07/29/2013 10:27 PM, Gabe Schwartz wrote: > C = (A[..., np.newaxis, np.newaxis] == B) > rows = (C.sum(axis=(1,2,3)) >= B.shape[1]).nonzero()[0] Hello, thank you, it's not fast but really nice. Nicola -- _____

[Numpy-discussion] Search array in array

2013-07-29 Thread Nicola Creati
[14, 21]] I need to search rows of A that contain elements of each row of B regardless of the order of the elements in B. The searched results is: [2, 6] . Thanks. Nicola -- _ Nicola Creati Istituto Nazionale di Oceanogra

Re: [Numpy-discussion] Fromfile Issue

2012-03-09 Thread Nicola Creati
Il 09/03/2012 14:33, Warren Weckesser ha scritto: On Fri, Mar 9, 2012 at 7:26 AM, Nicola Creati <mailto:ncre...@inogs.it>> wrote: Hello, I'm writing a library able to read LAS lidar files. I generally use it under Linux without any problems. I'm now testing

[Numpy-discussion] Fromfile Issue

2012-03-09 Thread Nicola Creati
Hello, I'm writing a library able to read LAS lidar files. I generally use it under Linux without any problems. I'm now testing my library on a Windows 7 64 bit computer and I meet some problems reading the file. I generally use fromfile function to read the file. I noted that the fromfile ret

[Numpy-discussion] Binning

2011-12-22 Thread Nicola Creati
desired bin size assigning to each cell (bin) the minimum z of all points that fall in that cell(bin). Moreover I need indexes of points that fall in each cell(bin). Is there any way to accomplish this task in numpy? Thanks. Nicola Creati -- Nicola Creati Istituto Nazionale di Oceanografia e

[Numpy-discussion] Sum over array elements

2010-04-12 Thread Nicola Creati
Hello, I want to calculate, given a one dimension array, the sum over every two elements of the array. I found this working solution: a = N.arange(10) b = a.reshape(a, (5, 2)) c = b.sum(axis=1) Is there any better solution? Thanks, Nicola Creati

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

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

[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