[Numpy-discussion] masked array with mask an instance of numpy.memmap

Glen W. Mabey Glen.Mabey@swri....
Tue Mar 27 17:04:41 CDT 2007


On Tue, Mar 27, 2007 at 05:54:05PM -0400, Pierre GM wrote:
> On Tuesday 27 March 2007 17:42:18 Glen W. Mabey wrote:
> > However, using a memmap for the mask value seems to load the entire
> > object into memory, even if it is already of type bool.
> >
> > How hard would it be to change that behavior?
> 
> Oh, I have no idea about that...

Anyone else care to comment on this?

> > Also, it seems that median() is not implemented on masked arrays?
> 
> Great minds meet, I just uploaded some very basic stats functions for the new 
> implementation of masked array in the scipy SVN.

Whoa.  You didn't mean numpy SVN, I take it.  So, will numpy.median not
ever take into account the mask?

And, how recently did you upload them?  I updated scipy today and I
still get:

In [41]:scipy.stats.median( ma_data[100:,1] )
Out[41]:1989792384.0

In [42]:numpy.median( ma_data[100:,1].filled() )
Out[42]:1989792384.0

In [43]:ma_data[100:,1]
Out[43]:
array(data =
 [ 8829714.  -1000000.   7007859.  ...,  3921109.5  3815157.   4447688.  ],
      mask =
 [False  True False ..., False False False],
              fill_value=-1000000.0)


> > Is there some method for a masked array like ravel() but that only
> > includes the non-masked values?
> 
> Yep, compressed(). 

Perfect.  Thank you.

--
Glen W. Mabey

"Happiness in marriage and parenthood can exceed a thousand times any 
 other happiness."
  -- James Esdras Faust


More information about the Numpy-discussion mailing list