[Numpy-discussion] MA bug or feature?

Paul Dubois pfdubois at gmail.com
Tue Jul 4 17:54:32 EDT 2006


Some things to note:

The mask is copy-on-write. Don't mess with that. You can't just poke values
into an existing mask, it may be shared with other arrays.

I do not agree that there is any 'inconsistency'. It may be someone's
concept of the class that if there is a mask then at least one value is on,
but that was not my design. I believe if you try your ideas you'll find it
slows other people down, if not you.

Perhaps with all of Travis' new machinery, subclassing works. It didn't used
to, and I haven't kept up.


On 7/3/06, Pierre GM <pgmdevlist at mailcan.com> wrote:
>
> Michael,
> I wonder whether the Mask class you suggest is not a bit overkill. There
> should be enough tools in the existing MA module to do what we want. And I
> don't wanna think about compatibility the number of changes in the MA code
> that'd be required (but I'm lazy)...
>
> For the sake of consistency and optimization, I still think it could be
> easier
> (and cleaner) to make `nomask` the default for a MaskedArray without
> masked
> values. That could for example be implemented by forcing `nomask` at the
> creation of the MaskedArray with an extra
> `if mask and not mask.any(): mask=nomask`, or by using Paul's
> make_mask( flag=1) trick.
>
> Masking some specific values could still be done when mask is nomask with
> an
> intermediary MA.getmaskarray() step.
>
> On a side note, modifying an existing mask is a delicate matter.
> Everything's
> OK if you use masks as a way to hide existing data, it's more complex when
> initially you have some holes in your dataset...
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20060704/d2426860/attachment-0001.html>


More information about the NumPy-Discussion mailing list