[Numpy-discussion] Masked arrays: Rationale for "False convention"
robert.kern at gmail.com
Tue Oct 1 06:29:44 EDT 2013
On Tue, Oct 1, 2013 at 3:57 AM, Ondřej Čertík <ondrej.certik at gmail.com>
> I see, that makes sense. So to remember this, the rule is:
> "Specify elements that you want to get masked using True in 'mask'".
Yes. This convention dates back at least to the original MA package in
Numeric; I don't know if Paul Dubois stole it from any previous software.
One way to motivate the convention is to think about doing a binary
operation on masked arrays, which is really the most common kind of thing
one does with masked arrays. The mask of the result is the logical OR of
the two operand masks (barring additional masked elements from domain
violations, 0/0, etc.). I assume that the convention was decided mostly on
what was most convenient and efficient for the common internal operations
for *implementing* the masked arrays and not necessarily matching any
particular intuitions when putting data *into* the masked arrays.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion