[Numpy-discussion] New patch for MA

Sasha ndarray at mac.com
Thu Apr 6 16:11:01 CDT 2006

I have applied the patch with minor modifications. See <

 Here are a few suggestions for posting patches.

1. If you are using svn, please post output of "svn diff" in the project
root directory (the directory that *contains* "numpy", not the "numpy"
2. If appropriate, add unit tests to an existing file instead of creating a
new one. (In case of ma, the correct file is test_ma.py).
3. If you follow recommendation #1, this will happen automatically, if you
cannot use svn for some reason, concatenate the output of diff for code and
test in the same patch file.

Here are some topics for discussion.

1. I've initially implemented some ma array methods by wrapping existing
module level functions.  I am not sure this is the best approach to
implement new methods. It is probably cleaner to implement them as methods
and provide wrappers at the module level similar to oldnumeric.

2. I am not sure cumprod and cumsum should fill masked elements with 1 and
0.  I would think the result should be masked if any prior element along the
axis being accumulated is masked.  To ignore masked elements, filled can be
called explicitly before cum[prod|sum].  One of the problems with filling by
default is that 1 or 0 are not appropriate values for object arrays (for
example, "" is an appropriate fill value for cumsum of an array of strings).

On 3/28/06, Pierre GM <pgmdevlist at mailcan.com> wrote:
> Folks,
> You can find a new patch for MA on the wiki
> http://projects.scipy.org/scipy/numpy/attachment/wiki/MaskedArray/ma-200603280900.patch
> along with a test suite.
> The 'clip' method should now work with array arguments. Were also added
> cumsum, cumprod, std, var and squeeze.
> I'll deal with flags, setflags, setfield, dump and others when I'll have a
> better idea of how it works -- which probably won't happen anytime soon,
> as I
> don't really have time to dig in the code for these functions. AAMOF, I'm
> more interested in checking/patching some other aspects of numpy for MA
> (eg,
> mlab...)
> Once again, please send me your comments and suggestions.
> Thx for everything
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060406/0a3fdbbc/attachment.html 

More information about the Numpy-discussion mailing list