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

2010-03-30 Thread Pauli Virtanen
2010/3/30 David Cournapeau da...@silveregg.co.jp 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,

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

2010-03-30 Thread Pauli Virtanen
2010/3/30 David Cournapeau da...@silveregg.co.jp: 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 ? This allowed 2to3 to also port the various setup*.py files and numpy.distutils,

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

2010-03-30 Thread Dag Sverre Seljebotn
David Warde-Farley wrote: 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\'' %

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

2010-03-30 Thread Dag Sverre Seljebotn
Dag Sverre Seljebotn wrote: David Warde-Farley wrote: 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,

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

2010-03-30 Thread Ryan May
On Tue, Mar 30, 2010 at 1:09 AM, Pauli Virtanen p...@iki.fi wrote: 2010/3/30 David Cournapeau da...@silveregg.co.jp: 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 ? This

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

2010-03-30 Thread Pauli Virtanen
ti, 2010-03-30 kello 07:18 -0600, Ryan May kirjoitti: Out of curiosity, is there something wrong with the support for 2to3 that already exists within distutils? (Other than it just being distutils) http://bruynooghe.blogspot.com/2010/03/using-lib2to3-in-setuppy.html That AFAIK converts only

[Numpy-discussion] SciPy 2010: Vote on Tutorials Sprints

2010-03-30 Thread Amenity Applewhite
Email not displaying correctly? View it in your browser. Hello Amenity, Spring is upon us and arrangements for SciPy 2010 are in full swing. We're already nearing on some important deadlines for conference participants: April 11th is the deadline for submitting an abstract for a paper,

[Numpy-discussion] indexing question

2010-03-30 Thread Tom K.
This one bit me again, and I am trying to understand it better so I can anticipate when it will happen. What I want to do is get rid of singleton dimensions, and index into the last dimension with an array. In [1]: import numpy as np In [2]: x=np.zeros((10,1,1,1,14,1024)) In [3]:

Re: [Numpy-discussion] indexing question

2010-03-30 Thread Alan G Isaac
On 3/30/2010 10:13 AM, Tom K. wrote: What I want to do is get rid of singleton dimensions, and index into the last dimension with an array. x=np.zeros((10,1,1,1,14,1024)) np.squeeze(x).shape (10, 14, 1024) hth, Alan Isaac ___ NumPy-Discussion

Re: [Numpy-discussion] indexing question

2010-03-30 Thread Charles R Harris
On Tue, Mar 30, 2010 at 8:13 AM, Tom K. t...@kraussfamily.org wrote: This one bit me again, and I am trying to understand it better so I can anticipate when it will happen. What I want to do is get rid of singleton dimensions, and index into the last dimension with an array. In [1]:

Re: [Numpy-discussion] indexing question

2010-03-30 Thread Robert Kern
On Tue, Mar 30, 2010 at 09:46, Charles R Harris charlesr.har...@gmail.com wrote: On Tue, Mar 30, 2010 at 8:13 AM, Tom K. t...@kraussfamily.org wrote: This one bit me again, and I am trying to understand it better so I can anticipate when it will happen. What I want to do is get rid of

Re: [Numpy-discussion] indexing question

2010-03-30 Thread josef . pktd
On Tue, Mar 30, 2010 at 10:13 AM, Tom K. t...@kraussfamily.org wrote: This one bit me again, and I am trying to understand it better so I can anticipate when it will happen. What I want to do is get rid of singleton dimensions, and index into the last dimension with an array. In [1]:

[Numpy-discussion] Set values of a matrix within a specified range to zero

2010-03-30 Thread Sean Mulcahy
Hello all, I'm relatively new to numpy. I'm working with text images as 512x512 arrays. I would like to set elements of the array whose value fall within a specified range to zero (eg 23 x 45). Any advice is much appreciated. Sean ___

Re: [Numpy-discussion] Set values of a matrix within a specified range to zero

2010-03-30 Thread Alan G Isaac
On 3/30/2010 12:56 PM, Sean Mulcahy wrote: 512x512 arrays. I would like to set elements of the array whose value fall within a specified range to zero (eg 23 x 45). x[(23x)*(x45)]=0 hth, Alann Isaac ___ NumPy-Discussion mailing list

Re: [Numpy-discussion] Set values of a matrix within a specified range to zero

2010-03-30 Thread Ryan May
On Tue, Mar 30, 2010 at 11:12 AM, Alan G Isaac ais...@american.edu wrote: On 3/30/2010 12:56 PM, Sean Mulcahy wrote: 512x512 arrays.  I would like to set elements of the array whose value fall within a specified range to zero (eg 23  x  45). x[(23x)*(x45)]=0 Or a version that seems a bit

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

2010-03-30 Thread David Warde-Farley
Hey Dag, On 30-Mar-10, at 5:02 AM, Dag Sverre Seljebotn wrote: Well, you can pass -fdefault-real-8 and then write .pyf headers where real(8) is always given explicitly. Actually I've gotten it to work this way, with real(8) in the wrappers. BUT... for some reason it requires me to set the

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

2010-03-30 Thread David Warde-Farley
On 30-Mar-10, at 2:14 PM, David Warde-Farley wrote: Hey Dag, On 30-Mar-10, at 5:02 AM, Dag Sverre Seljebotn wrote: Well, you can pass -fdefault-real-8 and then write .pyf headers where real(8) is always given explicitly. Actually I've gotten it to work this way, with real(8) in the

[Numpy-discussion] Replacing NANs

2010-03-30 Thread Vishal Rana
Hi, In an array I want to replace all NANs with some number say 100, I found a method* **nan_to_num *but it only replaces with zero. Any solution for this? * *Thanks Vishal ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] Replacing NANs

2010-03-30 Thread Angus McMorland
On 30 March 2010 14:59, Vishal Rana ranavis...@gmail.com wrote: Hi, In an array I want to replace all NANs with some number say 100, I found a method nan_to_num but it only replaces with zero. Any solution for this? ar[np.isnan(ar)] = my_num where ar is your array and my_num is the number

Re: [Numpy-discussion] Replacing NANs

2010-03-30 Thread Zachary Pincus
In an array I want to replace all NANs with some number say 100, I found a method nan_to_num but it only replaces with zero. Any solution for this? Indexing with a mask is one approach here: a[numpy.isnan(a)] = 100 also cf. numpy.isfinite as well in case you want the same with infs. Zach

Re: [Numpy-discussion] Replacing NANs

2010-03-30 Thread Vishal Rana
That was quick! Thanks Angus and Zachary On Tue, Mar 30, 2010 at 11:59 AM, Vishal Rana ranavis...@gmail.com wrote: Hi, In an array I want to replace all NANs with some number say 100, I found a method* **nan_to_num *but it only replaces with zero. Any solution for this? * *Thanks Vishal

Re: [Numpy-discussion] Interpolation question

2010-03-30 Thread Kevin Dunn
Andrea Gavana andrea.gavana at gmail.com writes: 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.gavana at gmail.com Subject: [Numpy-discussion] Interpolation question To: Discussion of Numerical

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

2010-03-30 Thread David Warde-Farley
On 30-Mar-10, at 5:02 AM, Dag Sverre Seljebotn wrote: Well, you can pass -fdefault-real-8 and then write .pyf headers where real(8) is always given explicitly. Okay, the answer (without setting the F77 environment variable) is basically to expect real-8's in the .pyf file and compile the

Re: [Numpy-discussion] Interpolation question

2010-03-30 Thread Friedrich Romstedt
2010/3/30 Andrea Gavana andrea.gav...@gmail.com: On 29 March 2010 23:44, Friedrich Romstedt wrote: When you have nice results using 40 Rbfs for each time instant, this procedure means that the values for one time instant will not be influenced by adjacent-year data.  I.e., you would probably

Re: [Numpy-discussion] Interpolation question

2010-03-30 Thread Andrea Gavana
Hi Friedrich All, On 30 March 2010 21:48, Friedrich Romstedt wrote: 2010/3/30 Andrea Gavana andrea.gav...@gmail.com: On 29 March 2010 23:44, Friedrich Romstedt wrote: When you have nice results using 40 Rbfs for each time instant, this procedure means that the values for one time instant

Re: [Numpy-discussion] Set values of a matrix within a specified range to zero

2010-03-30 Thread Friedrich Romstedt
2010/3/30 Ryan May rma...@gmail.com: On Tue, Mar 30, 2010 at 11:12 AM, Alan G Isaac ais...@american.edu wrote: On 3/30/2010 12:56 PM, Sean Mulcahy wrote: 512x512 arrays.  I would like to set elements of the array whose value fall within a specified range to zero (eg 23  x  45).

Re: [Numpy-discussion] Fourier transform

2010-03-30 Thread Pascal
Le Mon, 29 Mar 2010 16:12:56 -0600, Charles R Harris charlesr.har...@gmail.com a écrit : 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?

Re: [Numpy-discussion] Set values of a matrix within a specified range to zero

2010-03-30 Thread Ryan May
On Tue, Mar 30, 2010 at 3:16 PM, Friedrich Romstedt friedrichromst...@gmail.com wrote: 2010/3/30 Ryan May rma...@gmail.com: On Tue, Mar 30, 2010 at 11:12 AM, Alan G Isaac ais...@american.edu wrote: On 3/30/2010 12:56 PM, Sean Mulcahy wrote: 512x512 arrays.  I would like to set elements of the

Re: [Numpy-discussion] Interpolation question

2010-03-30 Thread Friedrich Romstedt
2010/3/30 Andrea Gavana andrea.gav...@gmail.com: However, from the first 100 or so interpolated simulations, I could gather these findings: 1) Interpolations on *cumulative* productions on oil and gas are extremely good, with a maximum range of relative error of -3% / +2%: most of them (95%

Re: [Numpy-discussion] Set values of a matrix within a specified range to zero

2010-03-30 Thread Robert Kern
On Tue, Mar 30, 2010 at 16:35, Ryan May rma...@gmail.com wrote: On Tue, Mar 30, 2010 at 3:16 PM, Friedrich Romstedt friedrichromst...@gmail.com wrote: x *= ((x = 23) | (x = 45))  . Interesting. In an ideal world, I'd love to see why exactly that is, because I don't think multiplication

Re: [Numpy-discussion] Set values of a matrix within a specified range to zero

2010-03-30 Thread Friedrich Romstedt
2010/3/30 Ryan May rma...@gmail.com: On Tue, Mar 30, 2010 at 3:16 PM, Friedrich Romstedt friedrichromst...@gmail.com wrote: We recently found out that it executes faster using: x *= ((x = 23) | (x = 45))  . Interesting. In an ideal world, I'd love to see why exactly that is, because I

Re: [Numpy-discussion] Set values of a matrix within a specified range to zero

2010-03-30 Thread Ryan May
On Tue, Mar 30, 2010 at 3:40 PM, Robert Kern robert.k...@gmail.com wrote: On Tue, Mar 30, 2010 at 16:35, Ryan May rma...@gmail.com wrote: On Tue, Mar 30, 2010 at 3:16 PM, Friedrich Romstedt friedrichromst...@gmail.com wrote: x *= ((x = 23) | (x = 45))  . Interesting. In an ideal world, I'd