[SciPy-dev] PEP: Improving the basic statistical functions in Scipy
josef.pktd@gmai...
josef.pktd@gmai...
Fri Feb 27 17:27:49 CST 2009
On Fri, Feb 27, 2009 at 6:01 PM, Eric Firing <efiring@hawaii.edu> wrote:
> Pierre GM wrote:
>> On Feb 27, 2009, at 4:52 PM, josef.pktd@gmail.com wrote:
>>> For most of the current statistical functions, with the exception of
>>> different tie handling, I think that we can expand the _chk_asarray to
>>> do the necessary preprocessing.
>>
>> Mmh. _chk_asarray will always return a MA. Is it what you want? Are you
>>
>> An idea is then to use the 'usemask' parameter I was talking about
>> earlier:
>> * if usemask is False (default), return a ndarray
>> * If usemask is True, return a MA
>> * if the input is a MA (w/ or w/o missing values), set usemask to
>> True, and mask the NaNs/Infs first w/ ma.fix_invalid.
>
> This may not be appropriate for scipy, but for my own purposes I
> included a third option for the similar "masked" kwarg in a simple stats
> class:
>
> http://currents.soest.hawaii.edu/hg/hgwebdir.cgi/pycurrents/file/7b4103d34cc8/num/stats.py#l1
>
> masked='auto' makes the output masked if and only if the input is masked.
>
> Eric
>
Yes, your class looks similar to what I have in mind. But I didn't see
a license statement to know whether I'm allowed to look. Also, your
broadcastable (squeeze) option looks like a very useful idea.
Two differences that I think of are to have the main part in ndarrays
while your _y is a masked array, and at this stage we won't switch to
classes for the basic statistical functions. Additionally, if I
rewrite these functions I would like to get also weights in.
Josef
More information about the Scipy-dev
mailing list