[Numpy-discussion] Masked array - follow up

Sasha ndarray at mac.com
Wed Mar 22 12:27:00 CST 2006


Your patch proposes to add an optional argument "flag_missing=False"
to the trace method.  As you explain, "`flag_missing` is True and some
diagonal values are masked, returns  `masked`."  This feature deserves
some careful discussion before it is accepted. I would think this
feature is unnecessary because a.fill(0).trace() is a better way to
express the desired result than a.trace(flag_missing=False). (Your
implementation is equivalent to a.data.trace(), which is clearly wrong
because masked elements are likely to contain garbage.)

-- sasha

PS: BTW, your implementation is incorrect.  Currently ma assumes that
"masked" is a singleton, so return MaskedArray(0, int, mask=1) is not
the same as return masked.  Also m = getmask(a) should probably be m =

On 3/21/06, Pierre GM <pgmdevlist at mailcan.com> wrote:
> Folks,
> First of all, many thanks to who implemented the ndim in the latest
> numpy.core.ma version.
> I ran into some other missing features with masked arrays. I updated the wiki
> page, and attached a suggestion for a patch:
> http://projects.scipy.org/scipy/numpy/wiki/MaskedArray
> The few modifications seem to work for me, but I guess they should be
> double/triple-checked. In any case, comments and ideas are more than welcome.
> Thanks again
> P.
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting language
> that extends applications into web and mobile media. Attend the live webcast
> and join the prime developer group breaking into this new coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion

More information about the Numpy-discussion mailing list