[NumPy-Tickets] [NumPy] #2035: Broadcasting with masked array doesn't work with divide (after tile instruction)

NumPy Trac numpy-tickets@scipy....
Mon Feb 20 13:47:15 CST 2012


#2035: Broadcasting with masked array doesn't work with divide (after tile
instruction)
------------------------------+---------------------------------------------
 Reporter:  elephantterrible  |       Owner:  somebody   
     Type:  defect            |      Status:  new        
 Priority:  normal            |   Milestone:  Unscheduled
Component:  Other             |     Version:  1.6.1      
 Keywords:                    |  
------------------------------+---------------------------------------------
Changes (by rgommers):

  * milestone:  1.6.2 => Unscheduled


Old description:

> Broadcasting in a division does not work after a tile instruction.
>
> See attached script to reproduce.
>
> If the tile instruction is commented out, the division works.
> Division also works if numpy.divide() is used, or if there's no masked
> value.
>
> Python gives the following error:
>
> Traceback (most recent call last):
>   File "ma_tiling_issue.py", line 18, in <module>
>     a/100. #raises ValueError: invalid return array shape
>   File "/usr/local/lib/python2.7/dist-packages/numpy/ma/core.py", line
> 3654, in __div__
>     return divide(self, other)
>   File "/usr/local/lib/python2.7/dist-packages/numpy/ma/core.py", line
> 1078, in __call__
>     m |= ma
> ValueError: non-broadcastable output operand with shape (3,3,3) doesn't
> match the broadcast shape (1,3,3,3)
>
> The error occurs in all numpy versions (1.5.1, 1.6.1, 2.0.0.dev) with
> python 2.7.1
>
> The original bug discussion is on numpy-discuss:
> http://www.mail-archive.com/numpy-discussion@scipy.org/msg35146.html

New description:

 Broadcasting in a division does not work after a tile instruction.

 See attached script to reproduce.

 If the tile instruction is commented out, the division works.
 Division also works if numpy.divide() is used, or if there's no masked
 value.

 Python gives the following error:
 {{{
 Traceback (most recent call last):
   File "ma_tiling_issue.py", line 18, in <module>
     a/100. #raises ValueError: invalid return array shape
   File "/usr/local/lib/python2.7/dist-packages/numpy/ma/core.py", line
 3654, in __div__
     return divide(self, other)
   File "/usr/local/lib/python2.7/dist-packages/numpy/ma/core.py", line
 1078, in __call__
     m |= ma
 ValueError: non-broadcastable output operand with shape (3,3,3) doesn't
 match the broadcast shape (1,3,3,3)
 }}}

 The error occurs in all numpy versions (1.5.1, 1.6.1, 2.0.0.dev) with
 python 2.7.1

 The original bug discussion is on numpy-discuss:
 http://www.mail-archive.com/numpy-discussion@scipy.org/msg35146.html

--

Comment:

 <reformat description>

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/2035#comment:2>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list