[Numpy-discussion] np.seterr doesn't work for masked array?
Fri Dec 14 08:15:52 CST 2012
On Fri, Dec 14, 2012 at 1:57 PM, Chao YUE <firstname.lastname@example.org> wrote:
> Dear all,
> I tried to capture the zero divide error when I divide a masked array by
> another. It seems that np.seterr is not working for masked array?
> when I do np.divide on two masked array, it directly put the zero divides
> part as being masked. The np.seterr works if the two arrays for dividing are
> not masked arrays.
> could anyone explain? thanks!!
numpy.ma uses np.seterr(divide='ignore', invalid='ignore') for most of
its operations, so it is overriding your settings. This is usually
desirable since many of the masked values will be trip these errors
spuriously even though they will be masked out in the result.
More information about the NumPy-Discussion