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

2011-12-10 Thread Vicente Sole
_Python_Guide/8.18/contents.html > is more up-to-date and we are on github too: > https://github.com/DiamondLightSource > > Peter > > > On 9 December 2011 13:05, Vicente Sole wrote: >> Quoting Robert Kern : >> >>> On Fri, Dec 9, 2011 at 11:00, Yang Zhang wrote: &

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

2011-12-09 Thread Vicente Sole
Quoting Robert Kern : > On Fri, Dec 9, 2011 at 11:00, Yang Zhang 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 solution (in fact I dislike it) bu

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 : > Dear all, > > I want to change some v

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

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

2010-06-09 Thread Vicente Sole
. Armando Quoting 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? >>> >>> che

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

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.

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[A>0] = X Armando Quoting gerardob : > > 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 matrix B by traversi

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

2010-01-18 Thread Vicente Sole
Quoting Bruce Southey : > On 01/18/2010 12:47 PM, Vicente Sole wrote: >> Quoting Bruce Southey : >> >>> >>> 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'