constrain fit params to positive vals in CP
This commit is contained in:
@@ -619,7 +619,7 @@ def interactive_otwcpchart(powerdf,promember=0):
|
||||
# there is no Paul's law for OTW
|
||||
|
||||
# Fit the data to thee parameter CP model
|
||||
fitfunc = lambda pars,x: pars[0]/(1+(x/pars[2])) + pars[1]/(1+(x/pars[3]))
|
||||
fitfunc = lambda pars,x: pars[0]/(1+(x/pars[2])) + pars[1]/(1+(x/abs(pars[3])))
|
||||
errfunc = lambda pars,x,y: fitfunc(pars,x)-y
|
||||
|
||||
p0 = [500,350,10,8000]
|
||||
@@ -636,6 +636,7 @@ def interactive_otwcpchart(powerdf,promember=0):
|
||||
p1 = [p0[0]/factor,p0[1]/factor,p0[2],p0[3]]
|
||||
|
||||
|
||||
p1 = [abs(p) for p in p1]
|
||||
fitt = pd.Series(10**(4*np.arange(100)/100.))
|
||||
|
||||
fitpower = fitfunc(p1,fitt)
|
||||
|
||||
Reference in New Issue
Block a user