On Mon, Sep 20, 2010 at 1:05 PM, Robert Kern <robert.k...@gmail.com> wrote:
> Are you asking about when masked arrays are casted to ndarrays (and > thus losing the mask information)? Most times when a function uses > asarray() or array() to explicitly cast the inputs to an ndarray. The > reason that np.mean() gives the same result as np.ma.mean() is that it > simply defers to the .mean() method on the object, so it works as > expected on a masked array. Many other functions will not. > > -- > Robert Kern > Right guess. It is important for me to able to preserve masked array properties of an array. Otherwise losing the mask information yields unexpected results in some of my calculations. I could see from np.mean?? that mean function is indeed the object method. Also in /numpy/ma there is a conversion for np.zeros(). I guess in any case it is the user's responsibility to make sure that the operations are performed on a desired array type. -- Gökhan
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion