[Numpy-discussion] numpy.ma.allclose bug

Charles سمير Doutriaux doutriaux1@llnl....
Thu Nov 20 17:26:27 CST 2008


The following shows a bug in numpy.ma.allclose:

import numpy
import numpy.ma

a = numpy.arange(100)
b=numpy.reshape(a,(10,10))
print b
c=numpy.ma.masked_greater(b,98)
print c.count()
numpy.ma.allclose(b,1)
numpy.ma.allclose(c,1)


Since c is masked it fails

I think it should pass returning either False or True, not sure what  
it should return in case all the elements are equal to 1 (except of  
course the masked one)

Note that the following works:

numpy.ma.allclose(c,numpy.ma.ones(c.shape))

So I'm good for now


Thanks,

C>




More information about the Numpy-discussion mailing list