[Numpy-discussion] f.p. powers and masked arrays

Pierre GM pgmdevlist at mailcan.com
Sat Jun 24 15:12:05 CDT 2006


Michael,

> Is anyone else seeing this?  It should be easy to test.  If so, I
> think it's a bug.

Yeah, I see that as well.
In MA.power(a,b), a temporary mask is created, True for values a<=0.
(check L1577 of the sources, 
`md = make_mask(umath.less_equal (fa, 0), flag=1)`). The combination of this 
temp and the initial mask defines the final mask.

This condition could probably be relaxed to 
`md = make_mask(umath.less(fa, 0), flag=1)`
That way, the a=0 elements wouldn't be masked, and you'd get the proper 
result.

I haven't really time to double-check/create a patch, tough. Meanwhile, 
Michael, you could just modify your numpy/core/ma.py accordingly.





More information about the Numpy-discussion mailing list