[Scipy-tickets] [SciPy] #1161: nanstd chokes on negative axis

SciPy Trac scipy-tickets@scipy....
Wed Apr 21 19:57:08 CDT 2010


#1161: nanstd chokes on negative axis
-------------------------+--------------------------------------------------
 Reporter:  kwgoodman    |       Owner:  somebody
     Type:  defect       |      Status:  new     
 Priority:  normal       |   Milestone:  0.8.0   
Component:  scipy.stats  |     Version:  0.7.0   
 Keywords:               |  
-------------------------+--------------------------------------------------
 nanstd chokes on negative axis because of these two lines:
 {{{
 shape = np.arange(x.ndim).tolist()
 shape.remove(axis)
 }}}
 Example:
 {{{
 >> from scipy.stats import nanstd
 >> x = np.array([1,2,3])
 >> nanstd(x)  # <--- good
    1.0
 >> nanstd(x, axis=0)  # <--- good
    1.0
 >> nanstd(x, axis=-1)  # <--- BAD
 ---------------------------------------------------------------------------
 ValueError: list.remove(x): x not in list
 }}}
 Suggested fix:
 {{{
 shape = range(x.ndim)
 shape.remove(shape[axis])
 }}}

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1161>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list