Interesting bug with numpy.ma
27 Sep
2008
27 Sep
'08
8:49 p.m.
All, I've just been pointed to a strange bug in numpy.ma import numpy as np import numpy.ma as ma assert(ma.masked*float(1) is ma.masked) assert(float(1)*ma.masked is ma.masked) assert(ma.masked*np.float(1) is ma.masked) assert(np.float(1)*ma.masked is ma.masked) assert(ma.masked*np.float_(1) is ma.masked) assert(np.float_(1)*ma.masked is ma.masked) The last assertion fails, and I have no idea why. What's the difference between assertions 3 and 5 ? FYI, ma.masked=ma.MaskedArray(0.,dtype=np.float_,mask=True), and MaskedArray has a __array_priority__ of 15. Implementing a __rmul__ doesn't work either. Any idea welcome.
5699
Age (days ago)
5699
Last active (days ago)
0 comments
1 participants
participants (1)
-
Pierre GM