Re: [Numpy-discussion] recarray fun

2008-04-30 Thread Anne Archibald
2008/5/1 Travis E. Oliphant <[EMAIL PROTECTED]>: > Stéfan van der Walt wrote: > > 2008/4/30 Christopher Barker <[EMAIL PROTECTED]>: > > > >> Stéfan van der Walt wrote: > >> > That's the way, or just rgba_image.view(numpy.int32). > >> > >> ah -- interestingly, I tried: > >> > >> rgba_imag

Re: [Numpy-discussion] ndarray subclassing

2008-04-30 Thread ctw
On Thu, May 1, 2008, Travis E. Oliphant wrote: > You are just seeing the result of __repr__. The printing code works by > accessing slices of the array. These slices create new instances of > your TestArray class which have a smaller number of dimensions. That's all. Ahh, that makes sense. Th

Re: [Numpy-discussion] recarray fun

2008-04-30 Thread Chris.Barker
Travis E. Oliphant wrote: > Stéfan van der Walt wrote: >> 2008/4/30 Christopher Barker <[EMAIL PROTECTED]>: >>> Since it is optional, shouldn't it be keyword argument? >>> >> Thanks, fixed in r5115. >> >> > This was too hasty. I had considered this before. > > The problem with this is t

Re: [Numpy-discussion] ndarray subclassing

2008-04-30 Thread Travis E. Oliphant
ctw wrote: > Hi! > > I ran into some strange (at least to me) issues with sublasses of > ndarray. The following minimal class definition illustrates the > problem: > > > > import numpy as np > class TestArray(np.ndarray): > def __new__(cls, d

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-30 Thread Charles R Harris
On Wed, Apr 30, 2008 at 9:16 PM, Anne Archibald <[EMAIL PROTECTED]> wrote: > 2008/4/30 Charles R Harris <[EMAIL PROTECTED]>: > > > Some operations on stacks of small matrices are easy to get, for > instance, > > +,-,*,/, and matrix multiply. The last is the interesting one. If A and > B > > are st

Re: [Numpy-discussion] recarray fun

2008-04-30 Thread Travis E. Oliphant
Stéfan van der Walt wrote: > 2008/4/30 Christopher Barker <[EMAIL PROTECTED]>: > >> Stéfan van der Walt wrote: >> > That's the way, or just rgba_image.view(numpy.int32). >> >> ah -- interestingly, I tried: >> >> rgba_image.view(dtype=numpy.int32) >> >> and got: >> >> Traceback (most recent

[Numpy-discussion] ndarray subclassing

2008-04-30 Thread ctw
Hi! I ran into some strange (at least to me) issues with sublasses of ndarray. The following minimal class definition illustrates the problem: import numpy as np class TestArray(np.ndarray): def __new__(cls, data, info=None, dtype=None, co

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-30 Thread Timothy Hochberg
On Wed, Apr 30, 2008 at 8:16 PM, Anne Archibald <[EMAIL PROTECTED]> wrote: > 2008/4/30 Charles R Harris <[EMAIL PROTECTED]>: > > > Some operations on stacks of small matrices are easy to get, for > instance, > > +,-,*,/, and matrix multiply. The last is the interesting one. If A and B > > are stac

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-30 Thread Anne Archibald
2008/4/30 Charles R Harris <[EMAIL PROTECTED]>: > Some operations on stacks of small matrices are easy to get, for instance, > +,-,*,/, and matrix multiply. The last is the interesting one. If A and B > are stacks of matrices with the same number of dimensions with the matrices > stored in the las

Re: [Numpy-discussion] a possible way to implement a plogin system

2008-04-30 Thread David Cournapeau
On Wed, 2008-04-30 at 16:44 -0300, Lisandro Dalcin wrote: > David, in order to put clear what I was proposing to you in previous > mail regarding to implementing plugin systems for numpy, please take a > look at the attached tarball. Thanks for looking at this Lisandro. The problem I see with the

Re: [Numpy-discussion] recarray fun

2008-04-30 Thread Stéfan van der Walt
2008/4/30 Christopher Barker <[EMAIL PROTECTED]>: > Stéfan van der Walt wrote: > > That's the way, or just rgba_image.view(numpy.int32). > > ah -- interestingly, I tried: > > rgba_image.view(dtype=numpy.int32) > > and got: > > Traceback (most recent call last): >File "", line 1, in > Typ

Re: [Numpy-discussion] untenable matrix behavior in SVN

2008-04-30 Thread Charles R Harris
On Tue, Apr 29, 2008 at 1:22 PM, Timothy Hochberg <[EMAIL PROTECTED]> wrote: > > Let me throw out a couple of more thoughts: > > First, there seems to be disagreement about what a row_vector and > column_vector are (and even if they are sensible concepts, but let's leave > that aside for moment).

Re: [Numpy-discussion] recarray fun

2008-04-30 Thread Christopher Barker
Stéfan van der Walt wrote: > That's the way, or just rgba_image.view(numpy.int32). ah -- interestingly, I tried: rgba_image.view(dtype=numpy.int32) and got: Traceback (most recent call last): File "", line 1, in TypeError: view() takes no keyword arguments Since it is optional, shouldn't i

Re: [Numpy-discussion] a possible way to implement a plogin system

2008-04-30 Thread Lisandro Dalcin
Sorry, I forgot to attach the code... On 4/30/08, Lisandro Dalcin <[EMAIL PROTECTED]> wrote: > David, in order to put clear what I was proposing to you in previous > mail regarding to implementing plugin systems for numpy, please take a > look at the attached tarball. > > The plugins are in ch

[Numpy-discussion] a possible way to implement a plogin system

2008-04-30 Thread Lisandro Dalcin
David, in order to put clear what I was proposing to you in previous mail regarding to implementing plugin systems for numpy, please take a look at the attached tarball. The plugins are in charge of implementing the action of generic foo() and bar() functions in C. The example actually implements

Re: [Numpy-discussion] numpy.ma question

2008-04-30 Thread Pierre GM
On Wednesday 30 April 2008 15:25:43 Charles Doutriaux wrote: > that's exactly my understanding thanks for confirming Fixed in 1.1.0dev5114 ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discus

Re: [Numpy-discussion] numpy.ma question

2008-04-30 Thread Charles Doutriaux
that's exactly my understanding thanks for confirming C. Pierre GM wrote: > Charles, > > >> but not: >> import numpy.ma as MA >> a0= MA.array(0)/0 >> a1= MA.array((0,0))/0 >> >> Is that a bug ? >> > > That a0 is MA.masked is not a bug. That a1 should be a (2,) array masked > everywhere s

Re: [Numpy-discussion] recarray fun

2008-04-30 Thread Stéfan van der Walt
Hi Chris 2008/4/30 Christopher Barker <[EMAIL PROTECTED]>: > Someone on the wxPython list posted a nifty recarray example that I > don't quite understand. The idea is to have an array for an RGBA image: > > rgbarec = numpy.dtype({'r':(numpy.uint8,0), > 'g':(numpy.uint8,1

Re: [Numpy-discussion] very simple iteration question.

2008-04-30 Thread Gael Varoquaux
On Wed, Apr 30, 2008 at 11:57:44AM -0700, Christopher Barker wrote: > I think I still like the idea of an iterator (or maybe making rollaxis a > method?), but this works pretty well. Generally, in object oriented programming, you expect a method like rollaxis to modify an object inplace. At least

Re: [Numpy-discussion] numpy.ma question

2008-04-30 Thread Pierre GM
Charles, > but not: > import numpy.ma as MA > a0= MA.array(0)/0 > a1= MA.array((0,0))/0 > > Is that a bug ? That a0 is MA.masked is not a bug. That a1 should be a (2,) array masked everywhere should work, but does not: that's the bug. Thanks for reporting. __

Re: [Numpy-discussion] recarray fun

2008-04-30 Thread Travis E. Oliphant
Christopher Barker wrote: > Hi folks, > > Someone on the wxPython list posted a nifty recarray example that I > don't quite understand. The idea is to have an array for an RGBA image: > > rgbarec = numpy.dtype({'r':(numpy.uint8,0), > 'g':(numpy.uint8,1), >

Re: [Numpy-discussion] very simple iteration question.

2008-04-30 Thread Christopher Barker
Anne Archibald wrote: >> it's much easier to just write > > for subarray in np.rollaxis(A,i): > ... cool, thanks! So the answer to the OPs question: > OK: how do i iterate over an axis other than 0? > > I have a 3D array of data[year, week, location]. I want to iterate > over each year at

[Numpy-discussion] oldnumeric.MA behaviour broken ?

2008-04-30 Thread Charles Doutriaux
HI, import numpy.oldnumeric.ma as MA a0= MA.array(0)/0 sh0=list(a0.shape) sh0.insert(0,1) b0=MA.resize(a0,sh0) Does not work anymore, I believe it used to work It does works using numpy.ma (but i can't subclass these yet...) C. ___ Numpy-discussion

[Numpy-discussion] numpy.ma question

2008-04-30 Thread Charles Doutriaux
Hello i have a quick question about MA ans scalar the following works: import numpy.ma as MA a0= MA.array(0)/1 a1= MA.array((0,0))/1 but not: import numpy.ma as MA a0= MA.array(0)/0 a1= MA.array((0,0))/0 Is that a bug ? I'm using numpy 1.0.5.dev4958 and also whats in trunk right now (1.1.0.dev

[Numpy-discussion] recarray fun

2008-04-30 Thread Christopher Barker
Hi folks, Someone on the wxPython list posted a nifty recarray example that I don't quite understand. The idea is to have an array for an RGBA image: rgbarec = numpy.dtype({'r':(numpy.uint8,0), 'g':(numpy.uint8,1), 'b':(numpy.uint8,2),

Re: [Numpy-discussion] very simple iteration question.

2008-04-30 Thread Anne Archibald
2008/4/30 Christopher Barker <[EMAIL PROTECTED]>: > a g wrote: > > OK: how do i iterate over an axis other than 0? > > This ties in nicely with some of the discussion about interating over > matrices. It ahs been suggested that it would be nice to have iterators > for matrices, so you could do:

Re: [Numpy-discussion] very simple iteration question.

2008-04-30 Thread Christopher Barker
a g wrote: > OK: how do i iterate over an axis other than 0? This ties in nicely with some of the discussion about interating over matrices. It ahs been suggested that it would be nice to have iterators for matrices, so you could do: for row in M.rows: ... and for column in M.cols: ...

Re: [Numpy-discussion] the path forward

2008-04-30 Thread Christopher Barker
Bill Spotz wrote: > On Apr 29, 2008, at 6:01 PM, Keith Goodman wrote: >> break most any package based on matrices (mine). And so I hope that >> such a change wouldn't show up, if at all, until 2.0. > > The only code that should break would be indexing the extracted row/ > column with two indexes.

[Numpy-discussion] [ANN] EuroSciPy Abstracts Deadline Reminder

2008-04-30 Thread Travis Vaught
Greetings, Just a reminder: the abstracts for the EuroSciPy Conference in Leipzig are due by midnight tonight (CST, US [UTC -6]) April, 30. If you'd like to present, please submit your abstract as a PDF, MS Word or plain text file to [EMAIL PROTECTED] For more information on the EuroSciPy

Re: [Numpy-discussion] the path forward

2008-04-30 Thread Bill Spotz
On Apr 29, 2008, at 6:01 PM, Keith Goodman wrote: > I hope that changing x[0,:] is considered a major change since it will > break most any package based on matrices (mine). And so I hope that > such a change wouldn't show up, if at all, until 2.0. The only code that should break would be indexin

Re: [Numpy-discussion] very simple iteration question.

2008-04-30 Thread Damian Eads
Hi Alex, a g wrote: > Hi. This is a very basic question, sorry if it's irritating. If i > didn't find the answer written already somewhere on the site, please > point me to it. That'd be great. You should look at any of the documents below and read up on array slicing. It is perhaps the most

Re: [Numpy-discussion] very simple iteration question.

2008-04-30 Thread Anne Archibald
2008/4/30 a g <[EMAIL PROTECTED]>: > Hi. This is a very basic question, sorry if it's irritating. If i > didn't find the answer written already somewhere on the site, please > point me to it. That'd be great. > > OK: how do i iterate over an axis other than 0? > > I have a 3D array of data[y

Re: [Numpy-discussion] very simple iteration question.

2008-04-30 Thread Nadav Horesh
for i in range(52): week_data = data[:,i,:] OR for week_data in data.transpose(1,0,2): ... Nadav -הודעה מקורית- מאת: [EMAIL PROTECTED] בשם a g נשלח: ד 30-אפריל-08 11:11 אל: numpy-discussion@scipy.org נושא: [Numpy-discussion] very simple iteration question. Hi. This is a ver

Re: [Numpy-discussion] should outer take an output argument?

2008-04-30 Thread Anne Archibald
2008/4/29 Alan G Isaac <[EMAIL PROTECTED]>: > As I was looking at Bill's conjugate gradient posting, > I found myself wondering if there would be a payoff > to an output argument for ``numpy.outer``. (It is fairly > natural to repeatedly recreate the outer product of > the adjusted residuals,

[Numpy-discussion] very simple iteration question.

2008-04-30 Thread a g
Hi. This is a very basic question, sorry if it's irritating. If i didn't find the answer written already somewhere on the site, please point me to it. That'd be great. OK: how do i iterate over an axis other than 0? I have a 3D array of data[year, week, location]. I want to iterate over each

Re: [Numpy-discussion] dot/tensordot limitations

2008-04-30 Thread Charles R Harris
On Tue, Apr 29, 2008 at 4:41 PM, Anne Archibald <[EMAIL PROTECTED]> wrote: > Timothy Hochberg has proposed a generalization of the matrix mechanism > to support manipulating arrays of linear algebra objects. For example, > one might have an array of matrices one wants to apply to an array of > vec