[SciPy-Dev] scipy.stats.signaltonoise docstring

David Goldsmith d.l.goldsmith@gmail....
Tue Jun 15 01:00:25 CDT 2010


On Mon, Jun 14, 2010 at 10:52 PM, Robert Kern <robert.kern@gmail.com> wrote:

> On Tue, Jun 15, 2010 at 00:47, David Goldsmith <d.l.goldsmith@gmail.com>
> wrote:
> > Hi, folks!  The docstring for scipy.stats.stats.signaltonoise says that
> if
> > axis == None, the input is first ravel'd, but I see no code that does
> this;
> > here's the code:
> >
> > def signaltonoise(a, axis=0, ddof=0):
> >
> >     """..."""
> >     a = np.asanyarray(a)
> >     m = a.mean(axis)
> >     sd = a.std(axis=axis, ddof=ddof)
> >     return np.where(sd == 0, 0, m/sd)
> >
> >
> > Even though it's not surrounded by an "if axis is None:", I checked the
> > docstring for asanyarray anyway, and there's nothing there about
> > raveling.  So, what gives?
>
> axis=None also ravels for the .mean() and .std() methods. Since the
> rest of the function doesn't touch the input except through the
> results of those methods, the function as a whole treats axis=None as
> raveling.
>
> --
> Robert Kern
>

Gotchya!  Thanks!

DG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20100614/21140a8c/attachment.html 


More information about the SciPy-Dev mailing list