Antonino Ingargiola edited Fitting.tex  about 8 years ago

Commit id: 4b06320beba1ffe430664e30cdfc2b1d4f4c0c1e

deletions | additions      

       

\begin{lstlisting}  dplot(ds, hist_fret, show_model=True)  \end{lstlisting}  For more examples on fitting bursts data and plotting results, refer to the  fitting section of the \usalex notebook (\href{http://nbviewer.jupyter.org/github/tritemio/FRETBursts_notebooks/blob/master/notebooks/FRETBursts%20-%20us-ALEX%20smFRET%20burst%20analysis.ipynb#FRET-fit:-in-depth-example}{link}),  the \textit{Fitting Framework} section of the documentation  (\href{http://fretbursts.readthedocs.org/en/latest/fit.html}{link})  as well as the documentation for \verb|bursts_fitter| function   (\href{http://fretbursts.readthedocs.org/en/latest/plugins.html#fretbursts.burstlib_ext.bursts_fitter}{link}).  \paragraph{Python details}  Models returned by FRETBursts's factory functions (\verb|mfit.factory_*|)  are \verb|lmfit.Model| objects (\href{https://lmfit.github.io/lmfit-py/model.html}{link}).  Custom models can be created by calling \verb|lmfit.Model| directly.  When an \verb|lmfit.Model| is fitted, it returns a \verb|ModelResults| object  (\href{https://lmfit.github.io/lmfit-py/model.html#the-modelresult-class}{link}),  which contains all information related to the fit (model, data,  parameters with best values and uncertainties) and useful methods to operate on fit results.  FRETBursts puts a \verb|ModelResults| object of each excitation spot in the list  \verb|ds.E_fitter.fit_res|.  For instance, to obtain the reduced $\chi^2$ value of the E histogram fit in a  single-spot measurement \verb|d|, we use the following command:  \begin{lstlisting}  d.E_fitter.fit_res[0].redchi  \end{lstlisting}  Other useful attributes are \verb|aic| and \verb|bic| which contain the  Akaike information criterion (AIC) and the Bayes Information criterion (BIC).  AIC and BIC allow comparing different models and  selecting the most appropriate for the data at hand.  Example of definition and modification of fit models are provided in  the aforementioned \usalex notebook.  Users can also refer to the comprehensive lmfit's documentation  (\href{http://lmfit.github.io/lmfit-py/}{link}).