[Numpy-discussion] sum of a masked array

Darren Dale dd55 at cornell.edu
Wed Sep 1 13:37:08 CDT 2004


smpitts at ou.edu wrote:

>Darren,
>I tried your code on my system: Python 2.2 and numarray 1.0. The type error looks like a bug in the array display code.
>
>  
>
I think you are right:

from numarray.ma import *

Rx = ones((2500,2500))
N = make_mask_none((2500,2500))
Rx = array(Rx,mask=N)
s = sum(sum(Rx))
print s ## this works, s is of type int, rather than maskedarray

(Stephen, I'm guessing you know how to pipe the error messages to a 
file. If you know how to do this with DOS/windows, would you write me 
privately and explain? Thanks for writing back so quickly, by the way.)






More information about the Numpy-discussion mailing list