![]() I can't explain how scidavis finds its parameters, but according to the definitions as I understand them, scipy is finding parameters with lower least squares residuals than scidavis: import numpy as npĭata = np.loadtxt('test.dat').reshape((-1,3)) My guess is that neither algorithm is converging toward a good fit, so it is not surprising that the results do not match. The green line is the result of scidavis. Your posted data does not look anything like f(x,a,b) = np.exp(a*np.log(x)+np.log(b)) Do i have to change anything, in order to calculate the fit correctly? Or what am i doing wrong?Įdit: here is an example of a data file (x,y,yerr) 3.942387e-02 1.987800e+00 5.513165e-01 I read something about that the errors are included as weights. But if i set yerr to the uncertainties of the data file i get some disturbing results. Popt, pcov = curve_fit(func, x, y,sigma=yerr)įitterL = kmpfit.Fitter(residuals=residualsL, data=(x,y,yerr))Īnd when i am trying to fit the data with one of those without uncertainties (i.e setting yerr=1), everything works just fine and the results are identical with the ones from scidavis. I tried curve_fit with def func(x, a, b): ![]() As a reference if the fit results are properly, i compare the python results with the ones from Scidavis I need to do a linear fit on that data in loglog scale. The data are labeled in python as x,y and yerr. I am trying to fit some data points with y uncertainties in python. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |