Antonino Ingargiola Tweak fitting section  about 8 years ago

Commit id: 9caec8da3734d3bb0533486b5403ad6abdcc8c96

deletions | additions      

       

\subsection{Population analysis}  \label{sec:fretfit}  The \verb|mfit| fitting module allows fitting burst populations with a model.  Typically, after bursts selection, E or S histograms are fitted to a model.  FRETBursts \verb|mfit| module allows fitting burst populations   with abitrary models.  In general, models this context, a model is an object   specifying a function, the parameters varied during the fit  and optional contraints for these parameters. This concept of model  is taken from \textit{lmfit}~\cite{lmfit}, the underlying library used by  FRETBursts to perform the fits.  Models  can be automatically built created  from any function.  Model parameters need to have an initial value (and optionally  constrains). arbitrary functions. For convenience,  FRETBursts includes a set of allows to use  predefined models such as 1 to 3 Gaussian peaks or 2-Gaussian plus ``bridge''.  Built-in models are created callingthe  a corresponding  factory function (names starting with \verb|mfit.factory_|) which initialize initializes  the parameters withinitial  values and constraints suitable for E and S histogram fit. histograms fits.  (see \href{http://fretbursts.readthedocs.org/en/latest/mfit.html#model-factory-functions}{factory-functions documentation}).  Additionally models can be created from any generic function. \textit{Factory Functions} documentation,   \href{http://fretbursts.readthedocs.org/en/latest/mfit.html#model-factory-functions}{link}).  As an Continuing our  example, in order to fit the E histogram of bursts in the  \verb|ds| variable  with two Gaussian peaks, we use  the following command can be used: command:  \begin{lstlisting}  bext.bursts_fitter(ds, 'E', binwidth=0.03,  model=mfit.factory_two_gaussians())  \end{lstlisting}  Here, \verb|ds| is the variable with the burst data (selected bursts), Changing  \verb|'E'| is the name of with \verb|'S'| will fit  the \textit{Data} field to fit, S histogram instead.  The argument  \verb|binwidth| is specifies  the histogram  bin widthof the histogram  and the argument  \verb|model| is a takes  pre-initialized model used to be used  for fitting.  All fitting results are stored in the\textit{Data} variable (in the  \verb|E_fitter| or  \verb|S_fitter| field). (or \verb|S_fitter|)  attributes of the \verb|Data| variable (here named \verb|ds|).  In order to plot theFRET histogram and the  fitted model, model with the FRET histogram,  we pass the parameter \verb|show_model=True| to \verb|hist_fret| function as follows  (see also section~\ref{sec:plotting}): 

\end{lstlisting}  For more examples on fitting bursts data and plotting results see the  \href{http://nbviewer.ipython.org/urls/raw.github.com/tritemio/FRETBursts_notebooks/master/notebooks/FRETBursts\%2520-\%2520us-ALEX\%2520smFRET\%2520burst\%2520analysis.ipynb}{us-ALEX notebook}.  Refer to μs-ALEX notebook (\href{http://nbviewer.jupyter.org/github/tritemio/FRETBursts_notebooks/blob/master/notebooks/FRETBursts%20-%20us-ALEX%20smFRET%20burst%20analysis.ipynb}{link}).  the \textit{Fitting Framework} section of  theFRETBursts  documentation for (\href{http://fretbursts.readthedocs.org/en/latest/fit.html}{link})  as well as  the different fitting and model options  (\href{http://fretbursts.readthedocs.org/en/latest/fit.html}{Fitting framework} and  \href{http://fretbursts.readthedocs.org/en/latest/plugins.html#fretbursts.burstlib\_ext.bursts\_fitter}{\texttt{bursts\_fitter} function})  and for details on plot customization (  \href{http://fretbursts.readthedocs.org/en/latest/plots.html#fretbursts.burst_plot.hist_fret}{\texttt{hist\_fret} plot function}). \verb|bursts_fitter| function documentation  (\href{http://fretbursts.readthedocs.org/en/latest/plugins.html#fretbursts.burstlib\_ext.bursts\_fitter}{link}).  \paragraph{Python details}  Under the hood, histogram fit in FRETBursts is performed using the 

Fitting an lmfit \verb|Model| returns an object with all the results.  FRETBursts appends the fit result of each channel in the list   \verb|ds.E_fitter.fit_res|.  Example of defining and modifying models for fitting are provided in the μs-ALEX  FRETBursts tutorial. tutorial (\href{http://nbviewer.jupyter.org/github/tritemio/FRETBursts_notebooks/blob/master/notebooks/FRETBursts%20-%20us-ALEX%20smFRET%20burst%20analysis.ipynb}{link}).  Interested users should also refer to the excellent lmfit documentation. documentation  (\href{http://lmfit.github.io/lmfit-py/}{link}).         

\input{preamble} % local LaTeX style  \input{header} % preamble also used by Authorea  \title{\input{title}}  \author{Antonino Ingargiola\thanks{[email protected]} \and Eitan Lerner