|
|
@ -1,4 +1,4 @@ |
|
|
|
# $Id: fitting.py,v 1.3 2010-11-05 02:28:20 wirawan Exp $ |
|
|
|
# $Id: fitting.py,v 1.4 2011-04-05 19:20:01 wirawan Exp $ |
|
|
|
# |
|
|
|
# |
|
|
|
# wpylib.math.fitting module |
|
|
|
# wpylib.math.fitting module |
|
|
|
# Created: 20100120 |
|
|
|
# Created: 20100120 |
|
|
@ -121,7 +121,7 @@ class fit_result(dict): |
|
|
|
pass |
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
def fit_func(Funct, Data=None, Guess=None, x=None, y=None, |
|
|
|
def fit_func(Funct, Data=None, Guess=None, x=None, y=None, |
|
|
|
debug=10, |
|
|
|
debug=0, |
|
|
|
outfmt=1, |
|
|
|
outfmt=1, |
|
|
|
method='leastsq', opts={}): |
|
|
|
method='leastsq', opts={}): |
|
|
|
""" |
|
|
|
""" |
|
|
@ -192,6 +192,7 @@ def fit_func(Funct, Data=None, Guess=None, x=None, y=None, |
|
|
|
print Guess |
|
|
|
print Guess |
|
|
|
|
|
|
|
|
|
|
|
if method == 'leastsq': |
|
|
|
if method == 'leastsq': |
|
|
|
|
|
|
|
# modified Levenberg-Marquardt algorithm |
|
|
|
rslt = leastsq(fun_err, |
|
|
|
rslt = leastsq(fun_err, |
|
|
|
x0=Guess, # initial coefficient guess |
|
|
|
x0=Guess, # initial coefficient guess |
|
|
|
args=(x,y), # data onto which the function is fitted |
|
|
|
args=(x,y), # data onto which the function is fitted |
|
|
|