[Numpy-discussion] Broadcasting doesn't work with divide after tile
Wed Feb 1 14:09:54 CST 2012
2012/2/1 martin großhauser <firstname.lastname@example.org>
> 2012/2/1 martin großhauser <email@example.com>:
> > Hello,
> > when I try in my script to divide a masked array by a scalar I get an
> > error. The instruction is:
> >>> sppa = sp / 100.
> > sp is a masked array with ndim = 3.
> > error is:
> > Traceback (most recent call last):
> > File "/media/nethome/Work/workspace/interimEnso/src/mlBudget.py",
> > line 95, in <module>
> > sppa = sp / 100.
> > File "/usr/lib/pymodules/python2.7/numpy/ma/core.py", line 3673, in
> > return divide(self, other)
> > File "/usr/lib/pymodules/python2.7/numpy/ma/core.py", line 1072, in
> > m |= ma
> > ValueError: invalid return array shape
> > The interesting thing is that this error only occurs after a tiling
> >>> sp4d = N.tile(sp, (ninterf, 1, 1, 1))
> > If I do the division before the tiling I don't get an error. There's
> > also no error if I do the division with N.divide(sp, 100.).
> > Also printing the array sp after tiling doesn't work, while it works
> > before. If I debug the script with eclipse/PyDev, in the variables
> > window I get the message "Unable to get repr for <class
> > 'numpy.ma.core.MaskedArray'>" for the sp array after tiling.
> > The tiling operation shouldn't change the array, should it? Is this a
> > bug, or is it expected behaviour?
> > Regards,
> > Martin Groszhauser
> I forgot to mention that I'm using Numpy 1.5.1 from Ubuntu 11.04
I can't reproduce this bug with the latest numpy from github master.
Perhaps it has been fixed by now?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion