Antonino Ingargiola deleted file Background estimation.tex  over 9 years ago

Commit id: 9d2af699e593cbece1f68ab80390a6c94b84b1ec

deletions | additions      

         

\subsection{Background estimation}  \label{sec:bg_calc}  The first step of smFRET analysis involves estimating the background level. For example, to compute the background every 30s, using a minimal timestamp delay threshold of 2 ms for all the photon streams we execute:   \begin{verbatim}  d.calc_bg(bg.exp_fit, time_s=30, tail_min_us=2000)  \end{verbatim}  Here, the first argument is the actual fitting function used to fit the  background in each period and for each photon stream~\ref{sec:bg_intro}. The function   \verb|bg.exp_fit| is fitted to the background using a Maximum Likelihood Estimation   (MLE) of the delays distribution. More fitting functions are available in   \verb|bg| namespace (see the   \href{http://fretbursts.readthedocs.org/en/latest/background.html}  {\texttt{background} module}). The second argument, \verb|time_s|, is the   \textit{background period} (section~\ref{sec:bg_intro}) and the third argument is the threshold above which the distribution is exponential.   It is possible to use different thresholds   for each photon stream passing a \href{https://docs.python.org/2/tutorial/datastructures.html#tuples-and-sequences}{tuple} as \verb|tail_min_us| (instead   of a scalar). For an ALEX measurement the tuple needs to have 5 values   corresponding to thresholds for the 5 photon streams. The list of photon   streams for a \verb|Data| object can be found in the \verb|ph_streams|   attribute (in the present example \verb|d.ph_streams|).   Finally, it is   possible to use a heuristic estimation of the threshold using   \verb|tail_min_us='auto'|. For more details refer to the   \href{http://fretbursts.readthedocs.org/en/latest/data\_class.html#fretbursts.burstlib.Data.calc\_bg}{\texttt{calc\_bg} documentation}.  \subsubsection{Error metric and optimal threshold}  The functions fitted to the background also return an estimation of the quality of fit computed as the distance between the empirical \href{http://en.wikipedia.org/wiki/Cumulative\_distribution\_function}{cumulative distribution function} (CDF) and fitted CDF. Two different distance metrics can be returned. The first is   \href{http://en.wikipedia.org/wiki/Kolmogorov\%E2\%80\%93Smirnov\_test}{Kolgomorov-Smirnov} statistics (the maximum of the difference between the empirical and the fitted CDF) and the second is the \href{http://en.wikipedia.org/wiki/Cram\%C3\%A9r\%E2\%80\%93von\_Mises\_criterion}{Cramer von Mises} statistics corresponding to the integral of the squared residuals (see the code \href{https://github.com/tritemio/FRETBursts/blob/master/fretbursts/background.py#L40}{here}).  In principle, one can find the threshold as the value that minimize the error metric. This approach is implemented by the function \href{http://fretbursts.readthedocs.org/en/latest/plugins.html#fretbursts.burstlib\_ext.calc\_bg\_brute}{calc\_bg\_brute} in the \href{http://fretbursts.readthedocs.org/en/latest/plugins.html}{burstlib\_ext module}. For more information see this notebook[TODO].