[Numpy-discussion] masked_where broadcasting?

Benjamin Root ben.root at ou.edu
Thu Jul 24 13:53:08 EDT 2014


I ran into this this morning while writing up a new test for matplotlib.
Shouldn't these two arrays be broadcasted automatically or maybe np.ma is
being overly cautious?

    u = np.ma.masked_where((-0.4 < x) & (x < 0.1), u, copy=False)
  File "/home/ben/.local/lib/python2.7/site-packages/numpy/ma/core.py",
line 1806, in masked_where
    " (got %s and %s)" % (cshape, ashape))
IndexError: Inconsistant shape between the condition and the input (got
(10, 1, 1) and (10, 10, 3))

x has shape (10, 1, 1) and u has shape (10, 10, 3).

This is on a recent-ish numpy master.

Cheers!
Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140724/8d9b4920/attachment.html>


More information about the NumPy-Discussion mailing list