[Numpy-discussion] Question on numpy.ma.masked_values

Pierre GM pgmdevlist at gmail.com
Thu Mar 15 15:12:40 EDT 2012


Ciao Gökhan,
AFAIR, shrink is used only to force a collapse of a mask full of False, not
to force the creation of such a mask.
Now, it should work as you expected, meaning that it needs to be fixed.
Could you open a ticket? And put me in copy, just in case.
Anyhow:
Your trick is a tad dangerous, as it erases the previous mask. I'd prefer
to create x w/ a full mask, then use masked_values w/ shrink=False... Now,
if you're sure there's no masked values, go for it.
Cheers
On Mar 15, 2012 7:56 PM, "Gökhan Sever" <gokhansever at gmail.com> wrote:

> Hello,
>
> From the masked_values() documentation ->
> http://docs.scipy.org/doc/numpy/reference/generated/numpy.ma.masked_values.html
>
> I10 np.ma.masked_values(x, 1.5)
> O10
> masked_array(data = [ 1.   1.1  2.   1.1  3. ],
>              mask = False,
>        fill_value = 1.5)
>
>
> I12 np.ma.masked_values(x, 1.5, shrink=False)
> O12
> masked_array(data = [ 1.   1.1  2.   1.1  3. ],
>              mask = False,
>        fill_value = 1.5)
>
> Shouldn't setting the 'shrink' to False return an array of False values
> for the mask field?
> If not so, how can I return a set of False values if my masking condition
> is not met?
>
> Using:
> I16 np.__version__
> O16 '2.0.0.dev-7e202a2'
>
> Thanks.
>
>
> --
> Gökhan
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20120315/937bcc21/attachment.html>


More information about the NumPy-Discussion mailing list