[Scipy-tickets] [SciPy] #1185: wrapcauchy _cdf IndexError

SciPy Trac scipy-tickets@scipy....
Sat May 29 14:48:09 CDT 2010


#1185: wrapcauchy _cdf IndexError
-------------------------+--------------------------------------------------
 Reporter:  josefpktd    |       Owner:  somebody
     Type:  enhancement  |      Status:  new     
 Priority:  normal       |   Milestone:  0.8.0   
Component:  scipy.stats  |     Version:  0.7.0   
 Keywords:               |  
-------------------------+--------------------------------------------------
 wrapcauchy._cdf is the only _cdf _pdf function that cannot handle a array
 x and a scalar shape parameter

 valp = extract(c1,val)  c1 has shape of x, val has shape of c

 handling this case is not a requirement, but since it is the only function
 for which this doesn't work, it should be fixed

 e.g. broadcast val or c to shape of x,

 val = np.ones_like(x) * val #if this works;

 common trick in distributions is (x==x)*val

 {{{
 >>> stats.wrapcauchy._cdf(np.array([1,2,3.]), np.array(0.031))
 Traceback (most recent call last):
   File "<pyshell#65>", line 1, in <module>
     stats.wrapcauchy._cdf(np.array([1,2,3.]), np.array(0.031))
   File "C:\Josef\_progs\Subversion\scipy-
 trunk_after\trunk\dist\scipy-0.8.0.dev6416.win32\Programs\Python25\Lib
 \site-packages\scipy\stats\distributions.py", line 3801, in _cdf
     valp = extract(c1,val)
   File "C:\Programs\Python25\lib\site-
 packages\numpy\lib\function_base.py", line 1288, in extract
     return _nx.take(ravel(arr), nonzero(ravel(condition))[0])
   File "C:\Programs\Python25\lib\site-packages\numpy\core\fromnumeric.py",
 line 103, in take
     return take(indices, axis, out, mode)
 IndexError: index out of range for array

 >>> stats.wrapcauchy._cdf(np.array([1,2,3.]), np.array([0.031]*3))
 array([ 0.16759771,  0.32716591,  0.47881587])
 }}}

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


More information about the Scipy-tickets mailing list