How to access the information after the fitting? #62
-
This might rather be a question about coding in python than ramanchada2. But, how can I access the information after I do I see I can get a summary of the parameters if I do: fitres.to_dataframe_peaks() I can get fit statistics and variables for every peak if I do fitres[i], where i would be the peak 0, 1, 2,... I get plots of the peak, fitting and residual if I do fitres[i].plot() and I can get the values of the best fit and residuals if I do fitres[0].best_fit and fitres[0].residual But how do I get the x axis for these fitres[0].best_fit and fitres[0].residual? what other operations can I do over fitres to get what information? Where could I see this? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I didn't know to to access the x-values (those provided during fit) so i found out that it is available in dictionary of user-provided keywords. ax = spe.plot()
ax.plot(fitres[1].userkws['x'], fitres[1].best_fit) Anyway, usually one needs to compare the result with a known y-values at fixed x-position or x-positions may be manually generated. fitres[1].eval(x=np.arange(100, 1000)) I always generated new x-values based on the FWHM / STDEV of leftmost and rightmost peaks of the group. |
Beta Was this translation helpful? Give feedback.
fitres[i]
is of typelmfit.model.ModelResult
. Documentation for lmfit library is available here.I didn't know to to access the x-values (those provided during fit) so i found out that it is available in dictionary of user-provided keywords.
You can reproduce the plot by:
Anyway, usually one needs to compare the result with a known y-values at fixed x-position or x-positions may be manually generated.
I always generated new x-values based on the FWHM / STDEV of leftmost and rightmost peaks of the group.