[Numpy-discussion] NA masks in the next numpy release?

Benjamin Root ben.root@ou....
Fri Oct 28 15:52:35 CDT 2011


On Fri, Oct 28, 2011 at 3:22 PM, Matthew Brett <matthew.brett@gmail.com>wrote:

> Hi,
>
> On Fri, Oct 28, 2011 at 1:14 PM, Benjamin Root <ben.root@ou.edu> wrote:
> >
> >
> > On Fri, Oct 28, 2011 at 3:02 PM, Matthew Brett <matthew.brett@gmail.com>
> > wrote:
> >>
> >> You and I know that I've got an array with values [99, 100, 3] and a
> >> mask with values [False, False, True].  So maybe I'd like to see what
> >> happens if I take off the mask from the second value.   I know that's
> >> what I want to do, but I don't know how to do it, because you won't
> >> let me manipulate the mask, because I'm not allowed to know that the
> >> NA values come from the mask.
> >>
> >> The alterNEP is just saying - please - be straight with me.   If
> >> you're doing masking, show me the mask, and don't try and hide that
> >> there are stored values underneath.
> >>
> >
> > Considering that you have admitted before to not regularly using masked
> > arrays, I seriously doubt that you would be able to judge whether this is
> a
> > significant detriment or not.  My entire point that I have been making is
> > that Mark's implementation is not the same as the current masked arrays.
> > Instead, it is a cleaner, more mature implementation that gets rid of
> > extraneous "features".
>
> This may explain why we don't seem to be getting anywhere.  I am sure
> that Mark's implementation of masking is great.   We're not talking
> about that.  We're talking about whether it's a good idea to make
> masking look as though it is implementing the ABSENT idea.   That's
> what I think is confusing, and that's the conversation I have been
> trying to pursue.
>
> Best,
>
> Matthew
>

Sorry if I came across too strongly there. No disrespect was intended.

Personally, I think we are getting somewhere.  We have been whittling away
what it is that we do agree upon, and have begun to specify *exactly* what
it is that we disagree on.  I have understand your concern, and -- like I
said in my previous email -- it makes sense from the perspective of
numpy.mausers have had up to now.  But, I re-raise my point that I
have been making
about the need to re-think masked arrays.  If we consider masks as advanced
slicing or boolean indexing, then being unable to access the underlying
values actually makes a lot of sense.

Consider it a contract when I pass a set of data with only certain values
exposed.  Because I passed the data with only those values exposed, then it
must have been entirely my intention to let the function know of only those
values.  It would be a violation of that contract if the function obtained
those masked values.  If I want to communicate both the original values and
a particular mask, then I pass the array and a view with a particular mask.

Maybe it would be helpful that an array can never have its own mask, but
rather, only views can carry masks?

In conclusion, I submit that this is largely a problem that can be solved
with the proper documentation.  New users who never used numpy.ma before do
not have to concern themselves with the old way of thinking and are just
simply taught what masked arrays "are".  Meanwhile, a special section of the
documentation should be made that teaches numpy.ma users how masked arrays
"should be".

Cheers!
Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20111028/243e43c1/attachment.html 


More information about the NumPy-Discussion mailing list