Re: [Numpy-discussion] Indexing with a list...

2009-08-08 Thread T J
On Sat, Aug 8, 2009 at 10:09 PM, David Warde-Farley wrote: > On 9-Aug-09, at 12:36 AM, T J wrote: > > z = array([1,2,3,4]) > z[[1]] >> array([1]) > z[(1,)] >> 1 >> > In the special case of scalar indices they're treated as if they are > length-1 tuples. The behaviour you're seeing is th

Re: [Numpy-discussion] Indexing with a list...

2009-08-08 Thread David Warde-Farley
On 9-Aug-09, at 12:36 AM, T J wrote: z = array([1,2,3,4]) z[[1]] > array([1]) z[(1,)] > 1 > > I'm just curious: What is the motivation for this differing behavior? When you address, i.e. an element in 2D array with a[2,3] you are actually indexing z with a tuple object (2,3). The

[Numpy-discussion] Indexing with a list...

2009-08-08 Thread T J
>>> z = array([1,2,3,4]) >>> z[[1]] array([1]) >>> z[(1,)] 1 I'm just curious: What is the motivation for this differing behavior? Is it a necessary consequence of, for example, the following: >>> z[z<3] array([1,2]) ___ NumPy-Discussion mailing list N

Re: [Numpy-discussion] Specifying Index Programmatically

2009-08-08 Thread T J
On Sat, Aug 8, 2009 at 8:54 PM, Neil Martinsen-Burrell wrote: > > The ellipsis is a built-in python constant called Ellipsis.  The colon > is a slice object, again a python built-in, called with None as an > argument.  So, z[...,2,:] == z[Ellipsis,2,slice(None)]. > Very helpful! Thank you. I did

Re: [Numpy-discussion] reduce function of vectorize doesn't respect dtype?

2009-08-08 Thread T J
On Fri, Aug 7, 2009 at 11:54 AM, T J wrote: > The reduce function of ufunc of a vectorized function doesn't seem to > respect the dtype. > def a(x,y): return x+y b = vectorize(a) c = array([1,2]) b(c, c)  # use once to populate b.ufunc d = b.ufunc.reduce(c) c.dtype, ty

Re: [Numpy-discussion] Specifying Index Programmatically

2009-08-08 Thread Neil Martinsen-Burrell
On 2009-08-08 22:46 , T J wrote: > I have an array, and I need to index it like so: > > z[...,x,:] > > How can I write code which will index z, as above, when x is not known > ahead of time. For that matter, the particular dimension I am querying > is not known either. In case this is still c

[Numpy-discussion] Specifying Index Programmatically

2009-08-08 Thread T J
I have an array, and I need to index it like so: z[...,x,:] How can I write code which will index z, as above, when x is not known ahead of time. For that matter, the particular dimension I am querying is not known either. In case this is still confusing, I am looking for the NumPy way to do

[Numpy-discussion] memmap, write through and flush

2009-08-08 Thread Tom Kuiper
There is something curious here. The second flush() fails. Can anyone explain this? Tom --- code snippet ... # create a memmap with dtype and shape that matches the data fp = np.memmap(filename, dtype='float32', mode='w+', shape=(3,4)) print "Initial me

Re: [Numpy-discussion] Merging datetime, Yes or No

2009-08-08 Thread Travis Oliphant
You are welcome to merge it but I fear it is not stable enough. I'd like to spend more time with it first. -Travis -- (mobile phone of) Travis Oliphant Enthought, Inc. 1-512-536-1057 http://www.enthought.com On Aug 7, 2009, at 9:23 PM, Charles R Harris wrote: > I ask again, > > Datetime is

Re: [Numpy-discussion] Merging datetime, Yes or No

2009-08-08 Thread Charles R Harris
On Sat, Aug 8, 2009 at 10:33 AM, Pierre GM wrote: > > On Aug 7, 2009, at 11:23 PM, Charles R Harris wrote: > > > I ask again, > > > > Datetime is getting really stale and hasn't been touched recently. > > Do the datetime folks want it merged or not, because it's getting to > > be a bit of work. >

Re: [Numpy-discussion] Merging datetime, Yes or No

2009-08-08 Thread Pierre GM
On Aug 7, 2009, at 11:23 PM, Charles R Harris wrote: > I ask again, > > Datetime is getting really stale and hasn't been touched recently. > Do the datetime folks want it merged or not, because it's getting to > be a bit of work. Chuck, Please check directly w/ Travis O. (and Robert ?), the

Re: [Numpy-discussion] Test failures r7300

2009-08-08 Thread David Cournapeau
On Sat, Aug 8, 2009 at 10:33 PM, wrote: > David Cournapeau wrote: >> On Sat, Aug 8, 2009 at 9:38 PM, wrote: >>> Hi, >>> >>> I got 16 test failures after building r7300 from svn on debian/sid/i386. >>> Seems all related to complex linear algebra modules. >> >> Are you using atlas ? (numpy.show_con

Re: [Numpy-discussion] Test failures r7300

2009-08-08 Thread lukshuntim
David Cournapeau wrote: > On Sat, Aug 8, 2009 at 9:38 PM, wrote: >> Hi, >> >> I got 16 test failures after building r7300 from svn on debian/sid/i386. >> Seems all related to complex linear algebra modules. > > Are you using atlas ? (numpy.show_config() output) Yes, it's libatlas-sse2 3.6.0-24 d

Re: [Numpy-discussion] Test failures r7300

2009-08-08 Thread David Cournapeau
On Sat, Aug 8, 2009 at 9:38 PM, wrote: > Hi, > > I got 16 test failures after building r7300 from svn on debian/sid/i386. > Seems all related to complex linear algebra modules. Are you using atlas ? (numpy.show_config() output) If so, did you compile it by yourself ? Did you compile everything w

[Numpy-discussion] Test failures r7300

2009-08-08 Thread lukshuntim
Hi, I got 16 test failures after building r7300 from svn on debian/sid/i386. Seems all related to complex linear algebra modules. Here's the error messages: Running unit tests for numpy NumPy version 1.4.0.dev7300 NumPy is installed in /var/opt/py/lib/python2.5/site-packages/numpy Python version

Re: [Numpy-discussion] Power distribution

2009-08-08 Thread Emmanuelle Gouillart
On Fri, Aug 07, 2009 at 11:55:45PM -0400, josef.p...@gmail.com wrote: > On Fri, Aug 7, 2009 at 10:17 PM, wrote: > > Thanks! That helps a lot. > Thanks for improving the docs. Many thanks for taking the time of finding out what this distribution really is, and improving the docs. I was also puzzl

Re: [Numpy-discussion] ATLAS, NumPy and Threading

2009-08-08 Thread David Cournapeau
Peter Jeremy wrote: > [Apologies if anyone sees this twice - the first copy appears to have > disappeared into a black hole] > > Should ATLAS be built with or without threading support for use with > NumPy? The NumPy documentation just says that ATLAS will be used if > found but gives no indicatio

[Numpy-discussion] ATLAS, NumPy and Threading

2009-08-08 Thread Peter Jeremy
[Apologies if anyone sees this twice - the first copy appears to have disappeared into a black hole] Should ATLAS be built with or without threading support for use with NumPy? The NumPy documentation just says that ATLAS will be used if found but gives no indication of how ATLAS should be built.

Re: [Numpy-discussion] How to preserve number of array dimensions when taking a slice?

2009-08-08 Thread David Warde-Farley
On 8-Aug-09, at 12:53 AM, Dr. Phillip M. Feldman wrote: > > I'd like to be able to make a slice of a 3-dimensional array, doing > something > like the following: > > Y= X[A, B, C] > > where A, B, and C are lists of indices. This works, but has an > unexpected > side-effect. When A, B, or C is