[Scipy-tickets] [SciPy] #1131: Scipy Stats ppf for Lognormal fails on array-like 'loc' or 'scale'

SciPy Trac scipy-tickets@scipy....
Mon Mar 15 14:49:27 CDT 2010

#1131: Scipy Stats ppf for Lognormal fails on array-like 'loc' or 'scale'
 Reporter:  catintp                                |       Owner:  somebody
     Type:  defect                                 |      Status:  new     
 Priority:  normal                                 |   Milestone:  0.8.0   
Component:  scipy.stats                            |     Version:  0.7.0   
 Keywords:  ppf, parameters, loc, scale, mismatch  |  
 The user code attached below causes an error in scipy, because the code
 does not appear to be able to handle array-like inputs for either "loc" or
 "scale".  Fix requires changing either the code or the documentation and
 docstring for the functions/methods.

 The trouble starts in valarray() in distributions.py in stats, which calls
 repeat([value],product(shape-of-cond)) with a big array. This causes
 reshape() in fromnumeric.py in numpy.core to throw an exception due to
 trying to fit 999x999x1 data elements into a 999x1 array.

 (a) The call to valarray() to set up the output array by replicating the
 value of the expression "self.a*scale+loc" produces an array with
 shape=(999,999,1), which the code tries to resize to (999,1).

 (b) Immediately after the output array is initialized, there are two calls
 to place(). The first one inserts self.badvalue in rows with invalid
 inputs. The second one attempts to insert a placeholder value equal to
 "self.b*scale+loc" whenever q==1 (and everything else OK). When either
 scale or loc is an array-like, you get an error condition that this
 expression is too deep to insert using place().

 I would be available to discuss this further, or to delete this issue if
 it has already been reported/fixed.  I could not figure out how to search
 for an existing report on this issue, but I will learn before I submit
 anything else.

 Charles the clueless newbie

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

More information about the Scipy-tickets mailing list