Ticket #820 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

numpy.ma.array ignores mask when asembling masked array inputs

Reported by: AndrewStraw Owned by: pierregm
Priority: normal Milestone: 1.2.0
Component: numpy.ma Version: none
Keywords: Cc:

Description

The following test fails with r5283. I assume (perhaps wrongly) that this is a bug. It appears numpy.ma.array has an argument keep_mask, which defaults to True. That implied to me that the expected behavior would have passed this test.

{{{import numpy

x = numpy.arange(10) y = numpy.arange(10)+20 z = numpy.arange(10)+40 x = numpy.ma.masked_where(x>5,x)

X1=numpy.ma.array([x,y,z]) X2=numpy.ma.vstack([x[numpy.newaxis,:],

y[numpy.newaxis,:], z[numpy.newaxis,:]])

assert numpy.ma.allclose(X1.mask,X2.mask) }}}

Change History

Changed 2 years ago by pierregm

  • status changed from new to assigned

In SVN5284, a mask is now constructed from a sequence of masked arrays parsed as input. Please give it a try and let me know whether we can close the ticket.

Changed 2 years ago by AndrewStraw

The change passes my test and I see you included a better one, too. I did note a couple typos in the docstring to the test in r5284 (should be "creating" and "a list"). Despite that nit, I think this bug is closed. Thanks. (Also, apologies for the formatting of my snippet above... Next time I'll be sure to preview.)

Changed 2 years ago by pierregm

  • status changed from assigned to closed
  • resolution set to fixed

OK, excellent ! Thanks a lot for the feedback, I'm closing the tickets (docstrings are another matter...)

Note: See TracTickets for help on using tickets.