specific model and fit #1016
Replies: 2 comments
-
|
finally I found a solution |
Beta Was this translation helpful? Give feedback.
-
|
@pmartin-upd7 b) If you mean π, do not use c) however, and "also" to both a) and b): when fitting data, scale and order of magnitude matter, and can matter significantly. 64-bit floats only tolerate difference in scale of about 2e-16. Variables used in any fitting method should be on the order of 1e-5 to 1e5 or so. if you have variables that you expect to be on the order of 1.e-10, change units. This is especially true if some variables are at the other extreme of magnitude. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
I would like to use a specific function to fit my data.
This function is coming from the Simmons tunnel transport
equation.I tried to use lmfit to fit my data and to obtain values of barrier height (phi) and thickness (d)
I tried several ways to fit but never work
I defined function as follow:
I extract my data from a txt file
x = chunk[:,0] y = chunk[:,1]/400e-12then define parameters and fit
params = lmfit.Parameters() params.add_many(('d', 20e-10, True, 5e-10, 50e-10, None, None), ('phio', 1.5e-10, True, 0.1e-10, 4e-10, None, None), ('gamma', 0.2, True, 0.1, 0.4, None, None) ) gmodel = Model(Simmons) result = gmodel.fit(data=y, **params, x=x, nan_policy='omit') #dely = result.eval_uncertainty(x=x, sigma = 3)at the beginning I got a NaN error thus I added omit param
then I tried to change the model also but still same error
`
File C:\ProgramData\miniconda3\Lib\site-packages\scipy\optimize_minpack_py.py:430, in leastsq(func, x0, args, Dfun, full_output, col_deriv, ftol, xtol, gtol, maxfev, epsfcn, factor, diag)
427 m = shape[0]
429 if n > m:
--> 430 raise TypeError(f"Improper input: func input vector length N={n} must"
431 f" not exceed func output vector length M={m}")
433 if epsfcn is None:
434 epsfcn = finfo(dtype).eps
TypeError: Improper input: func input vector length N=3 must not exceed func output vector length M=0`
if so have an idea
thanks
Beta Was this translation helpful? Give feedback.
All reactions