[SciPy-User] Bottleneck

Keith Goodman kwgoodman@gmail....
Tue Nov 30 19:24:07 CST 2010


On Tue, Nov 30, 2010 at 5:09 PM, Fabrice Silva <silva@lma.cnrs-mrs.fr> wrote:
> Le mardi 30 novembre 2010 à 16:13 -0800, Keith Goodman a écrit :
>> That's a great test!
>>
>> Could it be that older version of scipy.stats.nanstd can't handle
>> negative axes? In case that's the problem I added ndim to negative
>> axes before passing to scipy.stats.nanstd in the latest commit. Care
>> to try it?
>
>        In [12]: sp.nanstd(a, axis=-1)
>        ---------------------------------------------------------------------------
>        ValueError                                Traceback (most recent call last)
>        /home/fab/<ipython console> in <module>()
>        /usr/lib/python2.6/dist-packages/scipy/stats/stats.pyc in nanstd(x, axis, bias)
>            302     if axis!=0:
>            303         shape = np.arange(x.ndim).tolist()
>        --> 304         shape.remove(axis)
>            305         shape.insert(0,axis)
>            306         x = x.transpose(tuple(shape))
>
>        ValueError: list.remove(x): x not in list
>
>
> In fact -1 is not in the generated list (l303)
>
> See http://projects.scipy.org/scipy/ticket/1161 (closed), but the fix
> did not reach my machine by now...

Ha! I filed that ticket. With the latest commit of Bottleneck, I no
longer pass negative indices to scipy.stats.nanstd. But I bet your old
version of scipy.stats.nanstd chokes on axis=None too. I could ravel
and set axis to 0 for axis=None input. If you find that works, I can
make the change.


More information about the SciPy-User mailing list