Re: [Numpy-discussion] Long-standing issue with using numpy in embedded CPython

2011-12-09 Thread Vicente Sole
Quoting Robert Kern robert.k...@gmail.com: On Fri, Dec 9, 2011 at 11:00, Yang Zhang yanghates...@gmail.com wrote: Thanks for the clarification.  Alas.  So is there no simple workaround to making numpy work in environments such as Jepp? I don't think so, no. It is far from being an optimal

Re: [Numpy-discussion] what python module to modify NetCDF data?

2011-10-08 Thread Vicente Sole
Hi, I have never seen myself a NetCDF file but if your NetCDF file is using HDF5 as format (possible since NetCDF 4 if I am not mistaken), you should be able to use h5py or PyTables to access and or modify it. Best regards, Armando Quoting Chao YUE chaoyue...@gmail.com: Dear all, I

Re: [Numpy-discussion] Simple problem. Is it possible without a loop?

2010-06-09 Thread Vicente Sole
Correct. I thought just multiplying by -1 and inverting the logical condition would give me the same output. This makes exactly what I want: x= numpy.arange(10.) delta=3 y=[x[0]] for value in x: ... if (value-y[-1]) delta: ...y.append(value) ... y [0., 4., 8.] Armando

Re: [Numpy-discussion] Simple problem. Is it possible without a loop?

2010-06-09 Thread Vicente Sole
? Well a loop or list comparison seems like a good choice to me. It is much more obvious at the expense of two LOCs. Did you profile the two possibilities and are they actually performance-critical? cheers The second is between 8 and ten times faster on my machine. import numpy import

Re: [Numpy-discussion] Simple problem. Is it possible without a loop?

2010-06-09 Thread Vicente Sole
. Armando Quoting Vicente Sole s...@esrf.fr: ? Well a loop or list comparison seems like a good choice to me. It is much more obvious at the expense of two LOCs. Did you profile the two possibilities and are they actually performance-critical? cheers The second is between 8 and ten times

Re: [Numpy-discussion] Simple problem. Is it possible without a loop?

2010-06-09 Thread Vicente Sole
Quoting josef.p...@gmail.com: but the two options don't produce the same result in general, the cumsum version doesn't restart from zero, I think try x0 = np.random.randint(5,size=30).cumsum() with delta=3 I don't see a way around recursive looping The x0 data are already sorted. It was

Re: [Numpy-discussion] Matrix operation.

2010-04-02 Thread Vicente Sole
With A and X being arrays: B=numpy.zeros(A.shape, A.dtype) B[A0] = X Armando Quoting gerardob gberbeg...@gmail.com: Let A be a square matrix of 0's and 1's, and let X be a one dimesional vector. The length of X is equal to the number of 1's that A has. I would like to produce a new

Re: [Numpy-discussion] performance matrix multiplication vs. matlab

2010-01-18 Thread Vicente Sole
Quoting Bruce Southey bsout...@gmail.com: On 01/18/2010 12:47 PM, Vicente Sole wrote: Quoting Bruce Southey bsout...@gmail.com: If you obtain the code from any package then you are bound by the terms of that code. So while a user might not be 'inconvenienced' by the LGPL, they are required