* Bug fixes and documentation update.
This commit is contained in:
@@ -490,7 +490,7 @@ class fit_func_base(object):
|
|||||||
leastsq=dict(xtol=1e-8, epsfcn=1e-6),
|
leastsq=dict(xtol=1e-8, epsfcn=1e-6),
|
||||||
)
|
)
|
||||||
fit_default_opts["lmfit:leastsq"] = dict(xtol=1e-8, epsfcn=1e-6)
|
fit_default_opts["lmfit:leastsq"] = dict(xtol=1e-8, epsfcn=1e-6)
|
||||||
debug = 1
|
debug = 0
|
||||||
dbg_params = 1
|
dbg_params = 1
|
||||||
fit_method = 'fmin'
|
fit_method = 'fmin'
|
||||||
fit_opts = fit_default_opts
|
fit_opts = fit_default_opts
|
||||||
|
|||||||
@@ -11,10 +11,13 @@
|
|||||||
wpylib.math.fitting.funcs_pec module
|
wpylib.math.fitting.funcs_pec module
|
||||||
A library of simple f(x) functions for PEC fitting
|
A library of simple f(x) functions for PEC fitting
|
||||||
|
|
||||||
For use with OO-style x-y curve fitting interface.
|
For use with the OO-style x-y curve fitting interface
|
||||||
|
(fit_func_base).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
|
from wpylib.math.fitting import fit_func_base
|
||||||
|
from wpylib.math.fitting.funcs_simple import fit_harm
|
||||||
|
|
||||||
|
|
||||||
class harm_fit_func(fit_func_base):
|
class harm_fit_func(fit_func_base):
|
||||||
@@ -99,7 +102,7 @@ class morse2_fit_func(fit_func_base):
|
|||||||
imin = numpy.argmin(y)
|
imin = numpy.argmin(y)
|
||||||
harm_params = fit_harm(x[0], y)
|
harm_params = fit_harm(x[0], y)
|
||||||
if self.debug >= 10:
|
if self.debug >= 10:
|
||||||
print "Initial guess by fit_harm gives: ", harm_params
|
print("Initial guess by fit_harm gives: %s" % (harm_params,))
|
||||||
self.guess_params = (y[imin], harm_params[0][1], x[0][imin], 0.01 * harm_params[0][1])
|
self.guess_params = (y[imin], harm_params[0][1], x[0][imin], 0.01 * harm_params[0][1])
|
||||||
return self.guess_params
|
return self.guess_params
|
||||||
def Guess_xy_old(self, x, y):
|
def Guess_xy_old(self, x, y):
|
||||||
@@ -134,7 +137,7 @@ class ext3Bmorse2_fit_func(fit_func_base):
|
|||||||
imin = numpy.argmin(y)
|
imin = numpy.argmin(y)
|
||||||
harm_params = fit_harm(x[0], y)
|
harm_params = fit_harm(x[0], y)
|
||||||
if self.debug >= 10:
|
if self.debug >= 10:
|
||||||
print "Initial guess by fit_harm gives: ", harm_params
|
print("Initial guess by fit_harm gives: %s " % (harm_params,))
|
||||||
self.guess_params = (y[imin], harm_params[0][1], x[0][imin], 0.01 * harm_params[0][1], 0)
|
self.guess_params = (y[imin], harm_params[0][1], x[0][imin], 0.01 * harm_params[0][1], 0)
|
||||||
return self.guess_params
|
return self.guess_params
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ For use with OO-style x-y curve fitting interface.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
|
from wpylib.math.fitting import fit_func_base
|
||||||
|
|
||||||
|
|
||||||
class FermiDirac_fit_func(fit_func_base):
|
class FermiDirac_fit_func(fit_func_base):
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ For use with OO-style x-y curve fitting interface.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
|
from wpylib.math.fitting import fit_func_base
|
||||||
|
|
||||||
|
|
||||||
# Some simple function fitting--to aid fitting the complex ones later
|
# Some simple function fitting--to aid fitting the complex ones later
|
||||||
@@ -114,7 +115,7 @@ class linear_leastsq_fit_func(linear_fit_func):
|
|||||||
# Changed from:
|
# Changed from:
|
||||||
# rslt = fit_linear_weighted(x,y,dy)
|
# rslt = fit_linear_weighted(x,y,dy)
|
||||||
# to:
|
# to:
|
||||||
rslt = (x, y, sigma=None)
|
rslt = linregr2d_SZ(x, y, sigma=dy)
|
||||||
|
|
||||||
self.last_fit = rslt[1]
|
self.last_fit = rslt[1]
|
||||||
# Retrofit for API compatibility: not necessarily meaningful
|
# Retrofit for API compatibility: not necessarily meaningful
|
||||||
@@ -137,6 +138,7 @@ class exp_fit_func(fit_func_base):
|
|||||||
"""
|
"""
|
||||||
dim = 1 # a function with 1-D domain
|
dim = 1 # a function with 1-D domain
|
||||||
param_names = ['A', 'B', 'x0']
|
param_names = ['A', 'B', 'x0']
|
||||||
|
# FIXME: AD HOC PARAMETERS!
|
||||||
A_guess = -2.62681
|
A_guess = -2.62681
|
||||||
B_guess = -9.05046
|
B_guess = -9.05046
|
||||||
x0_guess = 1.57327
|
x0_guess = 1.57327
|
||||||
@@ -182,6 +184,7 @@ class powx_fit_func(fit_func_base):
|
|||||||
"""
|
"""
|
||||||
dim = 1 # a function with 1-D domain
|
dim = 1 # a function with 1-D domain
|
||||||
param_names = ['A', 'B', 'x0']
|
param_names = ['A', 'B', 'x0']
|
||||||
|
# FIXME: AD HOC PARAMETERS!
|
||||||
A_guess = -2.62681
|
A_guess = -2.62681
|
||||||
B_guess = -9.05046
|
B_guess = -9.05046
|
||||||
x0_guess = 1.57327
|
x0_guess = 1.57327
|
||||||
|
|||||||
Reference in New Issue
Block a user