[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

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

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-

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,josef.p...@gmail.com wrote: On Sat, Mar 27, 2010 at 1:00 PM, Ryan Mayrma...@gmail.com wrote: On Mon, Mar 22, 2010 at 8:14 AM, Ryan Mayrma...@gmail.com wrote: On Sun, Mar 21, 2010 at 11:57

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 courn...@gmail.comwrote: 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

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

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 bsout...@gmail.com 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

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

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 Southeybsout...@gmail.com 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,

[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

Re: [Numpy-discussion] Fourier transform

2010-03-29 Thread Robert Kern
On Mon, Mar 29, 2010 at 16:00, Pascal pascal...@parois.net 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

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! Thank you

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 andrea.gav...@gmail.com Subject: [Numpy-discussion] Interpolation question To: Discussion of Numerical Python numpy-discussion@scipy.org Message-ID:        

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 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! Thank you Robert

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 thought -- core

[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

Re: [Numpy-discussion] Fourier transform

2010-03-29 Thread Charles R Harris
On Mon, Mar 29, 2010 at 3:00 PM, Pascal pascal...@parois.net 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

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 useful thing to try.

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 such that they each go from 0

Re: [Numpy-discussion] Interpolation question

2010-03-29 Thread Friedrich Romstedt
2010/3/29 Andrea Gavana andrea.gav...@gmail.com: 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).

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 nad...@visionsense.comwrote: 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)

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 andrea.gav...@gmail.com: 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

Re: [Numpy-discussion] Interpolation question

2010-03-29 Thread Robert Kern
On Mon, Mar 29, 2010 at 17:57, Andrea Gavana andrea.gav...@gmail.com 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

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] 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