[SciPy-dev] are masked array statistical function hidden intentionally?

Pierre GM pgmdevlist@gmail....
Wed Nov 19 08:09:56 CST 2008

> Currently the MA related functions are split over two files, and  
> users would
> have to know which function is in which module.

Indeed. I tried to follow the basic stats organization.

> Should we create a namespace stats.ma that imports all of mstats and  
> mmorestats?
> Then stats.ma can be imported and included in stats,__init__.__all__.

Sounds a cool idea, but I'd prefer to rename stats.mstats.py as  
stats.mstats_basic and stats.mmorestats as stats.mstats_extras, and  
call the namespace stats.mstats (I have a lot of code that use `import  
stats.mstats as mstats`, and I don't really want to spend time in a  
few monthstrying to figure why it doesn't work anymore...

> Another question:
> When users want to use masked array version by default, is there a  
> recipe
> to overwrite all corresponding functions in scipy.stats, i.e.  
> something like
> stats.__dict__.update(stats.ma.__dict__   ... but only for public  
> function.
> If users need this often, there could even be a function, like:
> def make_ma_as_default:
>    scipy.stats.__dict__.update    with stats.ma methods

Could be a possibility, but then we need to make sure that the  
standard and masked versions of the functions have exactly the same  
syntax and return the same thing if a ndarray is used as input (I  
suspect it's not always the case...).

If we're to create a new namespace, we could introduce an extra layer  
for the functions that have been checked, while still leaving the  
possibility to access the non-verified functions.
What about something like that:

* stats.mstats.__init__
         from stats.mstats.basic import *
         from stats.mstats.extras import *
         from stats.mstats.basic_unchecked import *
         from stats.mstats.extras_unchecked import *

with `stats.mstats.basic.py` being the new name of  
`stats.mstats.extras` the new name of `stats.mmorestats.py`....

That way, we don't lose any time nor functionality and at term, we'll  
have a fully checked module.

True, I could have done that earlier, but there wasn't that much  
interest into these functions so far, so I just coded what I needed  
and let it at that...

More information about the Scipy-dev mailing list