Re: [Numpy-discussion] numpy masked array oddity

2008-05-05 Thread Pierre GM
On Monday 05 May 2008 15:35:35 Eric Firing wrote: > What I meant was that I don't see that such a ravelled version of a > matrix would be likely to make sense in a linear algebra context, so > leaving it as a matrix is likely to cause confusion rather than > convenience. Still, it would be consist

Re: [Numpy-discussion] numpy masked array oddity

2008-05-05 Thread Eric Firing
Pierre GM wrote: > On Monday 05 May 2008 15:10:56 Eric Firing wrote: >> Pierre GM wrote: >>> * An alternative would be to force the output of MaskedArray.compressed() >>> to type(MaskedArray._baseclass), where the _baseclass attribute is the >>> class of the underlying array: usually it's only ndar

Re: [Numpy-discussion] numpy masked array oddity

2008-05-05 Thread Pierre GM
On Monday 05 May 2008 15:10:56 Eric Firing wrote: > Pierre GM wrote: > > * An alternative would be to force the output of MaskedArray.compressed() > > to type(MaskedArray._baseclass), where the _baseclass attribute is the > > class of the underlying array: usually it's only ndarray, but it can be >

Re: [Numpy-discussion] numpy masked array oddity

2008-05-05 Thread Eric Firing
Pierre GM wrote: > On Monday 05 May 2008 13:19:40 Russell E. Owen wrote: >> The object returned by maskedArray.compressed() appears to be a normal >> numpy array (based on repr output), but in reality it has some >> surprising differences: > > Russell: > > * I assume you're not using the latest v

Re: [Numpy-discussion] numpy masked array oddity

2008-05-05 Thread Pierre GM
On Monday 05 May 2008 13:19:40 Russell E. Owen wrote: > The object returned by maskedArray.compressed() appears to be a normal > numpy array (based on repr output), but in reality it has some > surprising differences: Russell: * I assume you're not using the latest version of numpy, are you ? If

Re: [Numpy-discussion] numpy masked array oddity

2008-05-05 Thread Christopher Barker
Robert Kern wrote: > I don't know the reason why it's not an ndarray, but you don't have to > copy the data again to get one: > > c = ma.compressed().view(numpy.ndarray) would: c - numpy.asarray(ma.compressed()) work too? -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Respons

Re: [Numpy-discussion] numpy masked array oddity

2008-05-05 Thread Robert Kern
On Mon, May 5, 2008 at 12:19 PM, Russell E. Owen <[EMAIL PROTECTED]> wrote: > The object returned by maskedArray.compressed() appears to be a normal > numpy array (based on repr output), but in reality it has some > surprising differences: > > import numpy > a = numpy.arange(10, dtype=int) > b

[Numpy-discussion] numpy masked array oddity

2008-05-05 Thread Russell E. Owen
The object returned by maskedArray.compressed() appears to be a normal numpy array (based on repr output), but in reality it has some surprising differences: import numpy a = numpy.arange(10, dtype=int) b = numpy.zeros(10) b[1] = 1 b[3] = 1 ma = numpy.core.ma.array(a, mask=b, dtype=float) print