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 wrote: > On Tue, Mar 30, 2010 at 16:35, Ryan May wrote: >> On Tue, Mar 30, 2010 at 3:16 PM, Friedrich Romstedt >> wrote: > >>> x *= ((x <= 23) | (x >= 45))  . >> >> Interesting. In an ideal world, I'd love to see why exactly that is, >> because I don'

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 : > On Tue, Mar 30, 2010 at 3:16 PM, Friedrich Romstedt > 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 don't think multiplication should b

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 wrote: > On Tue, Mar 30, 2010 at 3:16 PM, Friedrich Romstedt > 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 should be faster than a boolean > op.

Re: [Numpy-discussion] Interpolation question

2010-03-30 Thread Friedrich Romstedt
2010/3/30 Andrea Gavana : > 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% more or less) show

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 wrote: > 2010/3/30 Ryan May : >> On Tue, Mar 30, 2010 at 11:12 AM, Alan G Isaac 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

Re: [Numpy-discussion] Fourier transform

2010-03-30 Thread Pascal
Le Mon, 29 Mar 2010 16:12:56 -0600, Charles R Harris a écrit : > 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 i

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 : > On Tue, Mar 30, 2010 at 11:12 AM, Alan G Isaac 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[(23 > Or a version that seems a

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 : >> 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 >>> i

Re: [Numpy-discussion] Interpolation question

2010-03-30 Thread Friedrich Romstedt
2010/3/30 Andrea Gavana : > 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 get the >> same re

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 w

Re: [Numpy-discussion] Interpolation question

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

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

Re: [Numpy-discussion] Replacing NANs

2010-03-30 Thread Angus McMorland
On 30 March 2010 14:59, Vishal Rana 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 you want to replace

[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 http://mail.scipy.or

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) i

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] 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 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[(23http://mail.scipy.org/mailman/listinfo/numpy-discussion

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[(23http://mail.scipy.org/mailman/listinfo/numpy-discussion

[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 ___ NumPy-Dis

Re: [Numpy-discussion] indexing question

2010-03-30 Thread josef . pktd
On Tue, Mar 30, 2010 at 10:13 AM, Tom K. 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]: import numpy as np

Re: [Numpy-discussion] indexing question

2010-03-30 Thread Robert Kern
On Tue, Mar 30, 2010 at 09:46, Charles R Harris wrote: > > > On Tue, Mar 30, 2010 at 8:13 AM, Tom K. 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 t

Re: [Numpy-discussion] indexing question

2010-03-30 Thread Charles R Harris
On Tue, Mar 30, 2010 at 8:13 AM, Tom K. 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]: import numpy as np

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

[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]: x[:,0,0,0,:

[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, an

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

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 wrote: > 2010/3/30 David Cournapeau : >> 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

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, >> f2py

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=\'

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

2010-03-30 Thread Pauli Virtanen
2010/3/30 David Cournapeau : > 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, and implementing it