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 p.zaff...@yahoo.it 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

[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

[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

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

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

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

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 stu...@molden.no 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

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 fra min iPad

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 stu...@molden.no: Something like this: m,n = data.shape x = data.reshape((m,n//4,4)) z = (x[0::4,...] = t1) (x[0::4,...]

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

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 :-) Being

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 ralf.gomm...@googlemail.com wrote: On Wed, Dec 14, 2011 at 6:50 PM, Ralf Gommers ralf.gomm...@googlemail.com wrote: On Wed, Dec 14, 2011 at 3:04 PM, David Cournapeau courn...@gmail.com wrote: On Tue, Dec 13, 2011 at 3:43 PM, Ralf Gommers

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 mwwi...@gmail.com wrote: Hey John, NumPy doesn't provide this, because it's already provided by the

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

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] Structure of polynomial module

2012-02-06 Thread Charles R Harris
2012/2/6 Stéfan van der Walt ste...@sun.ac.za 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

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 without

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.fft.ifftn(a, axes=axes) Or

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

2012-02-06 Thread Scott Sinclair
On 6 February 2012 21:41, Ralf Gommers ralf.gomm...@googlemail.com wrote: On Mon, Feb 6, 2012 at 8:17 AM, Scott Sinclair scott.sinclair...@gmail.com wrote: On 5 February 2012 13:07, Ralf Gommers ralf.gomm...@googlemail.com wrote: Does it need to be a new repo, or would permissions on