Re: [Numpy-discussion] Download page still points to SVN

2012-02-06 Thread Scott Sinclair
On 6 February 2012 21:41, Ralf Gommers wrote: > > > On Mon, Feb 6, 2012 at 8:17 AM, Scott Sinclair > wrote: >> >> On 5 February 2012 13:07, Ralf Gommers >> wrote: >> > >> > Does it need to be a new repo, or would permissions on >> > https://github.com/numpy/numpy.scipy.org work as well? >> >> Ye

Re: [Numpy-discussion] numpy.fft.irfftn fails apparently unexpectedly

2012-02-06 Thread Torgil Svensson
irfftn is an optimization for real input and does not take complex input. You have to use numpy.fft.ifftn instead: import numpy a_shape = (63, 4, 98) a = numpy.complex128(numpy.random.rand(*a_shape)+\ > ... 1j*numpy.random.rand(*a_shape)) axes = [0, 2] numpy.

Re: [Numpy-discussion] avoiding loops when downsampling arrays

2012-02-06 Thread eat
Hi, Sorry for my latest post, hands way too quick ;( On Mon, Feb 6, 2012 at 9:16 PM, Moroney, Catherine M (388D) < catherine.m.moro...@jpl.nasa.gov> wrote: > Hello, > > I have to write a code to downsample an array in a specific way, and I am > hoping that > somebody can tell me how to do this w

Re: [Numpy-discussion] Structure of polynomial module

2012-02-06 Thread Charles R Harris
2012/2/6 Stéfan van der Walt > Hi all, > > I noticed the following docstring on ``np.polynomial.polyval``: > > In [116]: np.polynomial.polyval? > File: /home/stefan/src/numpy/numpy/lib/utils.py > Definition: np.polynomial.polyval(*args, **kwds) > Docstring: > `polyval` is deprecated! > Plea

Re: [Numpy-discussion] avoiding loops when downsampling arrays

2012-02-06 Thread eat
Hi, On Mon, Feb 6, 2012 at 9:16 PM, Moroney, Catherine M (388D) < catherine.m.moro...@jpl.nasa.gov> wrote: > Hello, > > I have to write a code to downsample an array in a specific way, and I am > hoping that > somebody can tell me how to do this without the nested do-loops. Here is > the problem

Re: [Numpy-discussion] fast method to to count a particular value in a large matrix

2012-02-06 Thread David Cournapeau
On Mon, Feb 6, 2012 at 1:17 AM, Wes McKinney wrote: > > Whenever I get motivated enough I'm going to make a pull request on > NumPy with something like khash.h and start fixing all the O(N log N) > algorithms floating around that ought to be O(N). NumPy should really > have a "match" function sim

Re: [Numpy-discussion] datetime64 format parameter?

2012-02-06 Thread John Salvatier
That makes sense. I figured that ambiguity was the reason it was removed. Thank you for the explanation. I'm a big fan of your work. John On Mon, Feb 6, 2012 at 1:18 PM, Mark Wiebe wrote: > Hey John, > > NumPy doesn't provide this, because it's already provided by the > datetime.date.strftime

Re: [Numpy-discussion] Moving to gcc 4.* for win32 installers ?

2012-02-06 Thread David Cournapeau
On Sat, Feb 4, 2012 at 3:55 PM, Ralf Gommers wrote: > > > On Wed, Dec 14, 2011 at 6:50 PM, Ralf Gommers > wrote: >> >> >> >> On Wed, Dec 14, 2011 at 3:04 PM, David Cournapeau >> wrote: >>> >>> On Tue, Dec 13, 2011 at 3:43 PM, Ralf Gommers >>> wrote: >>> > On Sun, Oct 30, 2011 at 12:18 PM, David

Re: [Numpy-discussion] avoiding loops when downsampling arrays

2012-02-06 Thread Sturla Molden
> > # Make a 4D view of this data, such that b[i,j] > # is a 2D block with shape (4,4) (e.g. b[0,0] is > # the same as a[:4, :4]). > b = as_strided(a, shape=(a.shape[0]/4, a.shape[1]/4, 4, 4), >strides=(4*a.strides[0], 4*a.strides[1], a.strides[0], > a.strides[1])) > Yes :-) B

Re: [Numpy-discussion] datetime64 format parameter?

2012-02-06 Thread Mark Wiebe
Hey John, NumPy doesn't provide this, because it's already provided by the datetime.date.strftime function in Python: http://docs.python.org/library/datetime.html#datetime.date.strftime One reason this format isn't supported automatically is that parsing "MM/dd/YY" is inherently ambiguous, and t

Re: [Numpy-discussion] avoiding loops when downsampling arrays

2012-02-06 Thread Sturla Molden
The last t1 on each lineis of course t2. Sorry for the typo. Hard to code on an ipad ;-) Sturla Sendt fra min iPad Den 6. feb. 2012 kl. 22:12 skrev Sturla Molden : > > Something like this: > > m,n = data.shape > x = data.reshape((m,n//4,4)) > z = (x[0::4,...] >= t1) & (x[0::4,...] <= t1) >

Re: [Numpy-discussion] avoiding loops when downsampling arrays

2012-02-06 Thread Sturla Molden
Something like this: m,n = data.shape x = data.reshape((m,n//4,4)) z = (x[0::4,...] >= t1) & (x[0::4,...] <= t1) z |= (x[1::4,...] >= t1) & (x[1::4,...] <= t1) z |= (x[2::4,...] >= t1) & (x[2::4,...] <= t1) z |= (x[3::4,...] >= t1) & (x[3::4,...] <= t1) found = np.any(z, axis=2) Sturla Sendt f

Re: [Numpy-discussion] avoiding loops when downsampling arrays

2012-02-06 Thread Warren Weckesser
On Mon, Feb 6, 2012 at 2:57 PM, Sturla Molden wrote: > Short answer: Create 16 view arrays, each with a stride of 4 in both > dimensions. Test them against the conditions and combine the tests with an > |= operator. Thus you replace the nested loop with one that has only 16 > iterations. Or resha

Re: [Numpy-discussion] avoiding loops when downsampling arrays

2012-02-06 Thread Sturla Molden
Short answer: Create 16 view arrays, each with a stride of 4 in both dimensions. Test them against the conditions and combine the tests with an |= operator. Thus you replace the nested loop with one that has only 16 iterations. Or reshape to 3 dimensions, the last with length 4, and you can do

[Numpy-discussion] datetime64 format parameter?

2012-02-06 Thread John Salvatier
Hello, Is there a way to specify a format for the datetime64 constructor? The constructor doesn't have a doc. I have dates in a file with the format "MM/dd/YY". datetime64 used to be able to parse these in 1.6.1 but the dev version throws an error. Cheers, John ___

Re: [Numpy-discussion] (no subject)

2012-02-06 Thread Brett Olsen
The namespace is different. If you want to use numpy.sin(), for example, you would use: import numpy as np np.sin(angle) or from numpy import * sin(angle) I generally prefer the first option because then I don't need to worry about multiple imports writing on top of each other (i.e., having te

Re: [Numpy-discussion] Download page still points to SVN

2012-02-06 Thread Ralf Gommers
On Mon, Feb 6, 2012 at 8:17 AM, Scott Sinclair wrote: > On 5 February 2012 13:07, Ralf Gommers > wrote: > > > >> On 20/01/12 08:49, Scott Sinclair wrote: > >> > On 19 January 2012 21:48, Fernando Perez > wrote: > >> >> We've moved to the following setup with ipython, which works very > well > >>

Re: [Numpy-discussion] fast method to to count a particular value in a large matrix

2012-02-06 Thread Naresh
David: from 9-10 minutes to about 2-3 seconds, it's amazing! Thanks, Naresh ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

[Numpy-discussion] (no subject)

2012-02-06 Thread Debashish Saha
basic difference between the commands: import numpy as np from numpy import * ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

[Numpy-discussion] Structure of polynomial module

2012-02-06 Thread Stéfan van der Walt
Hi all, I noticed the following docstring on ``np.polynomial.polyval``: In [116]: np.polynomial.polyval? File: /home/stefan/src/numpy/numpy/lib/utils.py Definition: np.polynomial.polyval(*args, **kwds) Docstring: `polyval` is deprecated! Please import polyval from numpy.polynomial.polynomia

[Numpy-discussion] avoiding loops when downsampling arrays

2012-02-06 Thread Moroney, Catherine M (388D)
Hello, I have to write a code to downsample an array in a specific way, and I am hoping that somebody can tell me how to do this without the nested do-loops. Here is the problem statement: Segment a (MXN) array into 4x4 squares and set a flag if any of the pixels in that 4x4 square meet a cer

[Numpy-discussion] numpy.fft.irfftn fails apparently unexpectedly

2012-02-06 Thread Henry Gomersall
Is the following behaviour expected: >>> import numpy >>> a_shape = (63, 4, 98) >>> a = numpy.complex128(numpy.random.rand(*a_shape)+\ ... 1j*numpy.random.rand(*a_shape)) >>> >>> axes = [0, 2] >>> >>> numpy.fft.irfftn(a, axes=axes) Traceback (most recent call last): File "", line 1, in

[Numpy-discussion] matrix indexing

2012-02-06 Thread Naresh Pai
I have two large matrices, say, ABC and DEF, each with a shape of 7000 by 4500. I have another list, say, elem, containing 850 values from ABC. I am interested in finding out the corresponding values in DEF where ABC has elem and store them *separately*. The code that I am using is: for i in range

Re: [Numpy-discussion] "ValueError: total size of new array must be unchanged" only on Windows

2012-02-06 Thread Chris Barker
On Sun, Feb 5, 2012 at 10:41 AM, Paolo wrote: > I solved using 'rb' instead of 'r' option in the open file task. > > that would do it, if it's binary data, but you might as well so it "right": > matrix="".join(f.readlines()) > > readlines is giving you a list of the data, as separated by newlin