Changes between Version 25 and Version 26 of MaskedArray

Show
Ignore:
Timestamp:
10/28/06 05:58:52 (7 years ago)
Author:
pierregm
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MaskedArray

    v25 v26  
    156156The new {{{maskedarray}}} [attachment:maskedarray.py package ] is what I eventually come up with. The main differences with the initial {{{numpy.core.ma}}} package are that {{{MaskedArray}}} is now a subclass of {{{ndarray}}} and that the {{{_data}}} section can now be any subclass of {{{ndarray}}} (well, it should work in most cases, some tweaking might required here and there). Apart from a couple of issues listed below, the behavior of the new {{{MaskedArray}}} class reproduces the old one. It is quite likely to be significantly slower, though: I was more interested into a clear organization than in performance, so I tended to use wrappers liberally. I'm sure  we can improve that rather easily. Note that I didn't try to time any methods. 
    157157I also attach a unittest suite ([attachment:test_maskedarray.py here]), modeled after the standard numpy one, along with some utilities for testing ([attachment:masked_testutils.py here]). The old {{{test_ma}}} can also be run with the new package but it does fail in some places, see below. 
     158 
     159Note that if the subclass has some special methods and attributes, they are not propagated to the masked version: this would require a modification of the {{{__getattribute__}}} method (first trying {{{ndarray.__getattribute__}}}, then trying {{{self._data.__getattribute__}}} if an exception is raised in the first place), which really slows things down.  
    158160 
    159161=== Main differences === 
     
    208210  A basic consequence is that {{{matplotlib}}} will not recognize new masked arrays as such. The file {{{matplotlib/numerix/ma/__init__.py}}} must be modified to call the new package instead of {{{numpy.core.ma}}}. 
    209211 
     212=== Revision notes === 
     21310/28/2006 : Updated {{{put}}}, deleted {{{putmask}}} to match numpy 1.0 
    210214 
    211215=== Masked records ===