[Numpy-discussion] ANN: MaskedArray as a subclass of ndarray - followup
pgmdevlist at gmail.com
Tue Jan 2 09:31:33 EST 2007
I've updated this famous reimplementation of maskedarray I keep ranting about.
A new feature has been introduced : hard_mask.
When a masked array is created with the flag hard_mask=True, the mask can only
grow, not shrink. In other terms, masked values cannot be unmasked.
The flag hard_mask is set to False by default. You can toggle the behavior
the `harden_mask` and `soften_mask` methods.
>>> import maskedarray as MA
>>> x=MA.array([1,2,3],mask=[1,0,0], hard_mask=True)
>>> print x
[-- 2 3]
>>> print x
[999 2 3]
I also put the file `timer_comparison.py`, that runs some unittests with each
(numpy.core.ma and maskedarray), and outputs the minimum times.
On my machine, there doesn't seem to be a lot of differences, maskedarray
being slightly faster.
However, I'm not sure whether I can really trust the results. What would be
the best way to compare
the relative performances of numpy.core.ma and maskedarray ? Should I run
tests on a function basis ?
Thanks in advance for any idea/suggestion.
More information about the NumPy-Discussion