Re: [Numpy-discussion] Py3k: making a py3k compat header available in installed numpy for scipy

2010-03-29 Thread Pauli Virtanen
2010/3/30 David Cournapeau > Pauli Virtanen wrote: [clip] > > At least, I don't see what I would like to change there. The only thing > > I wouldn't perhaps like to have in the long run are the PyString and > > possibly PyInt redefinition macros. > > I would also prefer a new name, instead of macr

Re: [Numpy-discussion] Dealing with roundoff error

2010-03-29 Thread Mike Sarahan
Thank you all for your suggestions. I ended up multiplying by 10 and rounding, while casting the array to an int. Certainly not the most universal solution, but it worked for my data. code, for anyone searching for examples: np.array(np.round((hlspec[:,0]-offset)*10),dtype=np.int) -Mike On Sun

[Numpy-discussion] Making a 2to3 distutils command ?

2010-03-29 Thread David Cournapeau
Hi, Currently, when building numpy with python 3, the 2to3 conversion happens before calling any distutils command. Was there a reason for doing it as it is done now ? I would like to make a proper numpy.distutils command for it, so that it can be more finely controlled (in particular, using t

Re: [Numpy-discussion] Py3k: making a py3k compat header available in installed numpy for scipy

2010-03-29 Thread David Cournapeau
Pauli Virtanen wrote: > ma, 2010-03-29 kello 19:13 +0900, David Cournapeau kirjoitti: >> I have worked on porting scipy to py3k, and it is mostly working. One >> thing which would be useful is to install something similar to >> npy_3kcompat.h in numpy, so that every scipy extension could share the

Re: [Numpy-discussion] Interpolation question

2010-03-29 Thread Robert Kern
On Mon, Mar 29, 2010 at 17:57, Andrea Gavana wrote: > HI Friedrich & All, > > On 29 March 2010 23:44, Friedrich Romstedt wrote: >> Something completely different: Are you going to do more simulations? > > 110% surely undeniably yes. The little interpolation tool I have is > just a proof-of-concep

Re: [Numpy-discussion] Interpolation question

2010-03-29 Thread Andrea Gavana
HI Friedrich & All, On 29 March 2010 23:44, Friedrich Romstedt wrote: > 2010/3/29 Andrea Gavana : >> If anyone is interested in a follow up, I have tried a time-based >> interpolation of my oil profile (and gas and gas injection profiles) >> using those 40 interpolators (and even more, up to 400,

Re: [Numpy-discussion] Applying formula to all in an array which hasvalue from previous

2010-03-29 Thread Vishal Rana
Thanks Nadav! On Mon, Mar 29, 2010 at 4:07 AM, Nadav Horesh wrote: > The general guideline: > > Suppose the function definition is: > > def func(x,y): ># x and y are scalars >bla bla bla ... >return z # a scalar > > So, > > import numpy as np > > vecfun = np.vectorize(func) > > vecfu

Re: [Numpy-discussion] Interpolation question

2010-03-29 Thread Friedrich Romstedt
2010/3/29 Andrea Gavana : > If anyone is interested in a follow up, I have tried a time-based > interpolation of my oil profile (and gas and gas injection profiles) > using those 40 interpolators (and even more, up to 400, one every > month of fluid flow simulation time step). > > I wasn't expectin

Re: [Numpy-discussion] Interpolation question

2010-03-29 Thread Andrea Gavana
On 29 March 2010 23:13, Brennan Williams wrote: > Andrea Gavana wrote: >> Hi Chris and All, >> >> On 29 March 2010 22:35, Christopher Barker wrote: >> >>> Andrea Gavana wrote: >>> >> Scaling each axis by its standard deviation is a typical first start. >> Shifting and scaling the values suc

Re: [Numpy-discussion] Interpolation question

2010-03-29 Thread Brennan Williams
Andrea Gavana wrote: > Hi Chris and All, > > On 29 March 2010 22:35, Christopher Barker wrote: > >> Andrea Gavana wrote: >> > Scaling each axis by its standard deviation is a typical first start. > Shifting and scaling the values such that they each go from 0 to 1 is > another u

Re: [Numpy-discussion] Fourier transform

2010-03-29 Thread Charles R Harris
On Mon, Mar 29, 2010 at 3:00 PM, Pascal wrote: > Hi, > > Does anyone have an idea how fft functions are implemented? Is it pure > python? based on BLAS/LAPACK? or is it using fftw? > > I successfully used numpy.fft in 3D. I would like to know if I can > calculate a specific a plane using the nump

[Numpy-discussion] numpy.distutils/f2py: forcing 8-bit reals

2010-03-29 Thread David Warde-Farley
Hi, In my setup.py, I have from numpy.distutils.misc_util import Configuration fflags= '-fdefault-real-8 -ffixed-form' config = Configuration( 'foo', parent_package=None, top_path=None, f2py_options='--f77flags=\'%s\' --f90flags=\'%s\'' % (fflags, fflags) ) However I am sti

Re: [Numpy-discussion] Interpolation question

2010-03-29 Thread Christopher Barker
Andrea Gavana wrote: >>> Scaling each axis by its standard deviation is a typical first start. >>> Shifting and scaling the values such that they each go from 0 to 1 is >>> another useful thing to try. >> Ah, magnifico! Thank you Robert and Friedrich, it seems to be working >> now... One other tho

Re: [Numpy-discussion] Interpolation question

2010-03-29 Thread Andrea Gavana
Hi Chris and All, On 29 March 2010 22:35, Christopher Barker wrote: > Andrea Gavana wrote: Scaling each axis by its standard deviation is a typical first start. Shifting and scaling the values such that they each go from 0 to 1 is another useful thing to try. >>> Ah, magnifico! Than

Re: [Numpy-discussion] Interpolation question

2010-03-29 Thread Andrea Gavana
Hi Brennan & All, On 29 March 2010 00:46, Brennan Williams wrote: > Andrea Gavana wrote: >> As for your question, the parameter are not spread completely >> randomly, as this is a collection of simulations done over the years, >> trying manually different scenarios, without having in mind a proper

Re: [Numpy-discussion] Interpolation question

2010-03-29 Thread Andrea Gavana
Hi Kevin, On 29 March 2010 01:38, Kevin Dunn wrote: >> Message: 5 >> Date: Sun, 28 Mar 2010 00:24:01 + >> From: Andrea Gavana >> Subject: [Numpy-discussion] Interpolation question >> To: Discussion of Numerical Python >> Message-ID: >>         >> Content-Type: text/plain; charset=ISO-8859-1

Re: [Numpy-discussion] Interpolation question

2010-03-29 Thread Andrea Gavana
Hi All, On 29 March 2010 00:59, Andrea Gavana wrote: > On 29 March 2010 00:34, Robert Kern wrote: >> Scaling each axis by its standard deviation is a typical first start. >> Shifting and scaling the values such that they each go from 0 to 1 is >> another useful thing to try. > > Ah, magnifico! Tha

Re: [Numpy-discussion] Fourier transform

2010-03-29 Thread Robert Kern
On Mon, Mar 29, 2010 at 16:00, Pascal wrote: > Hi, > > Does anyone have an idea how fft functions are implemented? Is it pure > python? based on BLAS/LAPACK? or is it using fftw? Using FFTPACK converted from FORTRAN to C. -- Robert Kern "I have come to believe that the whole world is an enigma

[Numpy-discussion] Fourier transform

2010-03-29 Thread Pascal
Hi, Does anyone have an idea how fft functions are implemented? Is it pure python? based on BLAS/LAPACK? or is it using fftw? I successfully used numpy.fft in 3D. I would like to know if I can calculate a specific a plane using the numpy.fft. I have in 3D: r(x, y, z)=\sum_h^N-1 \sum_k^M-1 \sum_

Re: [Numpy-discussion] numpy.trapz() doesn't respect subclass

2010-03-29 Thread Bruce Southey
On 03/29/2010 10:17 AM, Ryan May wrote: > On Mon, Mar 29, 2010 at 8:00 AM, Bruce Southey wrote: > >> On 03/27/2010 01:31 PM, Ryan May wrote: >> >>> Because of the call to asarray(), the mask is completely discarded and >>> you end up with identical results to an unmasked array, >>> which

Re: [Numpy-discussion] numpy.trapz() doesn't respect subclass

2010-03-29 Thread Ryan May
Hi, I decided that having actual code that does what I want and keeps backwards compatibility (and adds tests) might be better than arguing semantics. I've updated my patch to: * Uses the array.sum() method instead of add.reduce to make subclasses fully work (this was still breaking masked array

Re: [Numpy-discussion] numpy.trapz() doesn't respect subclass

2010-03-29 Thread Ryan May
On Mon, Mar 29, 2010 at 8:00 AM, Bruce Southey wrote: > On 03/27/2010 01:31 PM, Ryan May wrote: >> Because of the call to asarray(), the mask is completely discarded and >> you end up with identical results to an unmasked array, >> which is not what I'd expect.  Worse, the actual numeric value of

Re: [Numpy-discussion] Py3k: making a py3k compat header available in installed numpy for scipy

2010-03-29 Thread Pauli Virtanen
ma, 2010-03-29 kello 19:13 +0900, David Cournapeau kirjoitti: > I have worked on porting scipy to py3k, and it is mostly working. One > thing which would be useful is to install something similar to > npy_3kcompat.h in numpy, so that every scipy extension could share the > compat header. Is the cur

Re: [Numpy-discussion] Py3k: making a py3k compat header available in installed numpy for scipy

2010-03-29 Thread Charles R Harris
On Mon, Mar 29, 2010 at 4:13 AM, David Cournapeau wrote: > Hi, > > I have worked on porting scipy to py3k, and it is mostly working. One > thing which would be useful is to install something similar to > npy_3kcompat.h in numpy, so that every scipy extension could share the > compat header. Is the

Re: [Numpy-discussion] numpy.trapz() doesn't respect subclass

2010-03-29 Thread Bruce Southey
On 03/27/2010 01:31 PM, Ryan May wrote: > On Sat, Mar 27, 2010 at 11:12 AM, wrote: > >> On Sat, Mar 27, 2010 at 1:00 PM, Ryan May wrote: >> >>> On Mon, Mar 22, 2010 at 8:14 AM, Ryan May wrote: >>> On Sun, Mar 21, 2010 at 11:57 PM, wrote: > On Mon, Mar 2

Re: [Numpy-discussion] Applying formula to all in an array which hasvalue from previous

2010-03-29 Thread Nadav Horesh
The general guideline: Suppose the function definition is: def func(x,y): # x and y are scalars bla bla bla ... return z # a scalar So, import numpy as np vecfun = np.vectorize(func) vecfun.ufunc.accumulate(array((0,1,2,3,4,5,6,7,8,9)) Nadav. -Original Message- From

Re: [Numpy-discussion] Why this Difference in Importing NumPy 1.2 vs 1.4?

2010-03-29 Thread Wayne Watson
Yes, that is very likely the solution. It's clear that the module is in the list. I say likely, since I've never done it before and there always seems to be something that gets overlooked in what seems to be something so simple. :-) However, my colleague is on XP. Ah, same idea there. I find

[Numpy-discussion] Py3k: making a py3k compat header available in installed numpy for scipy

2010-03-29 Thread David Cournapeau
Hi, I have worked on porting scipy to py3k, and it is mostly working. One thing which would be useful is to install something similar to npy_3kcompat.h in numpy, so that every scipy extension could share the compat header. Is the current python 3 compatibility header usable "in the wild", or will