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>
Charles, That should be fixed in r6087. In your example, the last statement outputs False instead of raising an exception. Note the deprecation warning: instead of fill_value, you want to use masked_equal to decide whether missing values should be considered True or False. Let me know how it goes. P.
On Nov 20, 2008, at 6:26 PM, Charles سمير Doutriaux wrote:
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>
Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion