[Numpy-discussion] Maskedarray implementations

Pierre GM pgmdevlist@gmail....
Fri Aug 24 20:08:48 CDT 2007


On Friday 24 August 2007 20:49:17 David Goldsmith wrote:
> Pierre GM wrote:
> > * Does anyone see any *disadvantages* to this aspect of maskedarray
> > relative to numpy.ma?
>
> What *is* numpy.ma derived from?

If you're talking about numpy.ma arrays:

A numpy.ma.MaskedArray is an independent object consisting of two ndarrays 
(one for the data, one for the mask). 
A maskedarray.MaskedArray is a ndarray with another ndarray as attribute (the 
mask). Therefore, it inherits the methods of a ndarray.

>>>import numpy, maskedarray
>>>x = numpy.ma.array([1,2,3],mask=[1,0,0])
>>>type(x._data),type(x._mask)
(<type 'numpy.ndarray'>, <type 'numpy.ndarray'>)
>>>x.view(numpy.ndarray)
NotImplementedError: not yet implemented for numpy.ma arrays

>>>x = maskedarray.array([1,2,3],mask=[1,0,0])
(<type 'numpy.ndarray'>, <type 'numpy.ndarray'>)
>>>x.view(numpy.ndarray)
array([1, 2, 3])

If you're talking about the package itself:
numpy.ma derives from the corresponding Numeric module, written by Paul 
Dubois. The maskedarray implementation relies quite heavily on Paul's work, I 
can't thank him enough.


More information about the Numpy-discussion mailing list