[Scipy-tickets] [SciPy] #1204: optimize.curve_fit doesn't handle a single parameter

SciPy Trac scipy-tickets@scipy....
Thu Jun 17 08:03:26 CDT 2010


#1204: optimize.curve_fit doesn't handle a single parameter
------------------------------+---------------------------------------------
 Reporter:  warren.weckesser  |       Owner:  somebody
     Type:  defect            |      Status:  new     
 Priority:  normal            |   Milestone:  0.8.0   
Component:  scipy.optimize    |     Version:  0.7.0   
 Keywords:                    |  
------------------------------+---------------------------------------------
 Reported by Martin Paesold on the scipy-user mailing list:
 {{{
 I ran into trouble as I tried to fit data using only one fitting
 parameter.  The functions '_general_function' and
 '_weigted_general_function' in the module
 python2.6/site-packages/scipy/optimize/minpack.py throw an TypeError.

 I use Python 2.6.5 -- EPD 6.2-1 (32-bit) on Ubuntu 9.10

 I attached a file that produces the error. I think the problem is that
 the argument 'params' of the above functions is passed to the model
 used for the fit as 'function(xdata, *params)'. It seems that 'params'
 can be scalar which causes the TypeError when calling 'function'. I
 don't see why that happens, but for now I could solve my problem if
 '_general_function' and '_weigted_general_function' check whether
 'params' is scalar and cast it to a list if so:
 'if isscalar(params): params = [params]'.
 }}}

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


More information about the Scipy-tickets mailing list