2012/2/1 martin großhauser <[email protected]> > 2012/2/1 martin großhauser <[email protected]>: > > 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 > __div__ > > return divide(self, other) > > File "/usr/lib/pymodules/python2.7/numpy/ma/core.py", line 1072, in > __call__ > > m |= ma > > ValueError: invalid return array shape > > > > The interesting thing is that this error only occurs after a tiling > instruction: > >>> 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 > (1.5.1-1ubuntu2). >
I can't reproduce this bug with the latest numpy from github master. Perhaps it has been fixed by now? Ben Root
_______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
