[SciPy-User] Bug of sp.optimize.curve_fit

Martin Paesold martin.paesold@googlemail....
Thu Jun 17 01:24:49 CDT 2010


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]'.


Martin Paesold

6 Clementi Road
#01-07 Amicus Student Hostel
Singapore 129 741

+65 9448 8914
-------------- next part --------------
A non-text attachment was scrubbed...
Name: min_bug.py
Type: text/x-python
Size: 426 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/scipy-user/attachments/20100617/4bf8a1ab/attachment.py 

More information about the SciPy-User mailing list