Antonino Ingargiola Typos  about 8 years ago

Commit id: a07d2b960f757ee772a1f5e4575a968d2642b057

deletions | additions      

       

In ALEX measurements~\cite{Lee_2005}, we can further differentiate between  photons emitted during D and A excitation periods. In FRETBursts the different  selections of photons/timestamps are called ``photon streams'' and they are  specified with a \verb|Ph_sel| object (\href{http://fretbursts.readthedocs.org/en/latest/ph_sel.html}{link}). In non-ALEX smFRET data there are 3 photon streams  (table~\ref{tab:ph_sel_smfret}), while in ALEX data we have 5 base photon  streams (table~\ref{tab:ph_sel_alex}). 

\subsection{The \texttt{Data} Class}  \label{sec:data_intro}  The \verb|Data| class (\href{http://fretbursts.readthedocs.org/en/latest/data_class.html}{link})  is the fundamental data container in FRETBursts. It contains the  measurement data and parameters (attributes) as well as several methods for data analysis (background estimation, burst search, etc...). All analysis results (bursts data, estimated parameters) are also stored  as \verb|Data| attributes.  There are 3 important ``burst counts'' attributes which contains the number of photon detected in donor or acceptor channel  during donor or acceptor excitation (table~\ref{tab:data_n}).  The attributes in table~\ref{tab:data_n} are background-corrected by default. Furthermore, \verb|na| is corrected for leakage and direct excitation (section~\ref{sec:corrcoeff}) if the relative coefficients are specified (by default they are 0).  There is also a closely related attribute named \verb|nda| for donor photons during acceptor excitation. \verb|nda| is normally neglected as it only contains  background. 

(\cite{Eggeling_1998}, \cite{Fries_1998}), involves searching for  $m$ consecutive photons detected during a period shorter than  $\Delta t$. In other words, bursts are regions of the photon stream where the  local rate (computed using $m$ photons) is above a minimum threshold rate. Since a universal criterion to choose the rate threshold and the number of photons $m$ is, as of today, lacking, it has become a common  practice to manually adjust those parameters for each specific measurement. 

FRETBursts allows to perform the burst search on arbitrary selections of photons.  (see section~\ref{sec:ph_streams} for more info on photon stream definitions).  Additionally, Nir~\textit{et al.}~\cite{Nir_2006} proposed DCBS, which can help to mitigate artifacts due to photo-physical effects such as blinking. During DCBS, a search is performed independently on two photon streams and bursts are marked only when both photon streams exhibit a rate higher than the threshold, implementing a sort of AND-gate logic.  Conventionally, the term DCBS refers to a burst search where the two photon streams  are (1) all photons during donor excitation (\verb|Ph_sel(Dex='DAem')|) and (2) acceptor channel photons during acceptor excitation (\verb|Ph_sel(Aex='Aem')|). In FRETBursts the user can choose arbitrary photon streams as input, an in general  we call this kind of search AND-gate burst search. 

For this reason we suggest performing a burst size selection after background  correction, taking into account the γ factor, as discussed in  sections~\ref{sec:burstsizeweights} and~\ref{sec:burstsel}.  In special case, users can also choose to replace or combine the burst selection based on burst size  with another criterion such as burst duration or brightness (see section~\ref{sec:burstsel}). 

\label{sec:burstsizeweights}  The number of photons detected during a burst --the ``burst size''--  is computed using either all photons, or photons detected during donor excitation period. To compute the burst size, FRETBursts uses one of the following formulas:  \begin{equation}  \label{eq:burstsize_dex}  n_{dex} = n_a + \gamma\,n_d \end{equation}  \begin{equation} 

n_t = n_a + \gamma\,n_d + n_{aa}  \end{equation}  \noindent where $n_d$, $n_a$ and $n_{aa}$ are, similarly to the attributes in table~\ref{tab:data_n}, the background-corrected  burst counts in different channels and excitation periods.  $\gamma$, called the ``γ factor'', takes into account  different quantum yields of donor and acceptor dyes and different  photon detection efficiencies between donor and acceptor detection  channels~\cite{Lee_2005}.  Eq.~\ref{eq:burstsize_dex} includes only photons during donor excitation periods, while eq.~\ref{eq:burstsize_allph} includes all photons.  Burst sizes computed according to eq.~\ref{eq:burstsize_dex} or~\ref{eq:burstsize_allph} are called γ-corrected burst sizes.  The burst search algorithm yields a set of bursts whose sizes  approximately follows an exponential distribution.  Bursts with large sizes (which contain most of the information)  are much less frequent than bursts with smaller sizes. For this reason, it is important to select burst sizes larger than a threshold in order  to properly characterize FRET populations (see section~\ref{sec:burstsel}). Selecting bursts by size is a critically important step.  A too low threshold will broaden the FRET populations and introduce  artifacts (spurious peaks and patterns) due to the majority of bursts  having E and S computed from ratios of small integers. Conversely, a too high threshold will result in a lower number of bursts and possibly poor statistics in representing FRET populations.  Additionally, when selecting bursts (see section~\ref{sec:burstsel}), it is important to use γ-corrected burst sizes,  in order to avoid under-representing some FRET sub-populations  due to different quantum yields between donor and acceptor dyes and/or different photon detection efficiencies of donor and acceptor emission.  A simple way to mitigate the dependence on the burst size threshold is  weighting bursts according to their size (i.e. their information content)  so that the bursts with largest sizes will have the largest weights.  The weighting can be used to build weighted histograms or Kernel Density Estimation (KDE) plots. When using weights, the choice of a particular burst size threshold affects the shape of the burst distribution to a lesser extent,  therefore lower thresholds can be used (yielding to better statistics) without broadening the peaks of sub-populations (yielding to better population identification).  \paragraph{Python details}  FRETBursts has the option to weight bursts using γ-corrected burst sizes which optionally include acceptor excitation photons \verb|naa|.  A weight proportional to the burst size is applied by passing the argument \verb|weights='size'| to histogram or KDE plot functions. The \verb|weights|  keyword can be also passed to fitting functions in order to fit the weighted E or S distributions (see section~\ref{sec:fretfit}).  Several other weighting functions (for example quadratical) are listed in the  \verb|fret_fit.get_weights| documentation 

\subsection{Plotting \texttt{Data}}  \label{sec:plotting}  FRETBursts uses matplotlib~\cite{matplotlib}  and seaborn~\cite{seaborn} to provide a wide range of built-in plot functions  (\href{http://fretbursts.readthedocs.org/en/latest/plots.html}{link})  for \verb|Data| objects. 

All built-in plot functions which can be passed to  \verb|dplot| are defined in the  \verb|burst_plot| module (\href{http://fretbursts.readthedocs.org/en/latest/plots.html}{link}).  \paragraph{Python details}  When FRETbursts FRETBursts  is imported, all plot functions are also imported. To facilitate finding the plot functions through auto-completion,  their names start with a standard prefix indicating the  plot type. The prefixes are: \verb|timetrace| for binned timetraces 

scatter plots.  Additional plots can be easily created directly with matplotlib.  By default, in order to speed-up batch processing, FRETBursts notebooks display plots as static images using the \textit{inline} matplotlib backend. User can switch to interactive figures inside the browser by activating the interactive backend with the command \verb|%matplotlib notebook|.  Another option is displaying figures in a new standalone window  using a desktop graphical library such as QT4.  In this case the command to be used is \verb|%matplotlib qt|.  A few plot functions such as \verb|timetrace| and \verb|hist2d_alex| have interactive features which require the QT4 backend. As an example, after switching to the QT4 backend  the following command: 

\noindent  will open a new window with a timetrace plot with overlay of bursts, and an horizontal scroll-bar for quick  "scrolling" throughout time. The user can click on a burst to have the corresponding burst info be printed in the notebook.  Similarly, calling the \verb|hist2d_alex| function with the QT4 backend allows  selecting an area on the E-S histogram using the mouse. 

\end{lstlisting}  The values that identify the region are printed in the notebook and can be passed  to the function \verb|select_bursts.ES| to select bursts inside that region (see section~\ref{sec:burstsel}).         

\section{Conclusions}  \label{sec:conclusions}  FRETBursts provides an open source implementation of state-of-the-art smFRET burst analysis accessible to the whole single-molecule community.  It implements several novel concepts which can lead to significantly more accurate results. Example of novel concepts include  time-dependent background estimation, background dependent burst search threshold,  burst weighting, burst selection based on γ-corrected burst sizes.  More importantly, FRETBursts provides a library of well-tested routines  for timestamps and burst manipulation, making it an ideal environment for   development to  develop  and comparison of compare  novel analytical techniques with minimal effort. We summarize here what we consider to be the strengths  of the FRETBursts software. 

unit and regression testing and continuous integration.  \end{enumerate}  We envision FRETBursts both as a standard burst analysis software as well as a platform for development and assessment of novel algorithms.  We believe that a standard software implementation can improve reproducibilty reproducibility  and promote a faster adpotion adoption  of novel methods while reducing the duplication of efforts among different groups in the single-molecule community.  Finally, FRETBursts open source nature, guarantees that the source code can always be inspected, fixed and improved by any member of the community.         

Typically, after bursts selection, E or S histograms are fitted to a model.  FRETBursts \verb|mfit| module allows fitting histograms of bursts quantities  (i.e. E or S) with arbitrary models. In this context, a model is an object specifying a function, the parameters varied during the fit  and optional contraints constraints  for these parameters. This concept of model is taken from \textit{lmfit}~\cite{lmfit}, the underlying library used by  FRETBursts to perform the fits. 

Built-in models are created calling a corresponding factory function  (names starting with \verb|mfit.factory_|) which initializes the parameters  with values and constraints suitable for E and S histograms fits.  (see \textit{Factory Functions} documentation, \href{http://fretbursts.readthedocs.org/en/latest/mfit.html#model-factory-functions}{link}).  Continuing our example, in order to fit the E histogram of bursts in the 

\end{lstlisting}  Changing \verb|'E'| with \verb|'S'| will fit the S histogram instead.  The argument \verb|binwidth| specifies the histogram bin width and the argument \verb|model| takes pre-initialized model used to be used for  fitting. All fitting results (including best fit values, uncertainties, etc...), are stored in the \verb|E_fitter| (or \verb|S_fitter|)  attributes of the \verb|Data| variable (here named \verb|ds|).  To print a comprehensive summary of the fitting results including 

print(fit_res.fit_report())  \end{lstlisting}  To plot the fitted model together with the FRET histogram as in figure~\ref{fig:histfit}, we pass the parameter \verb|show_model=True| to \verb|hist_fret| function as follows (see section~\ref{sec:plotting} for an introduction to plotting):  \begin{lstlisting} 

For more examples on fitting bursts data and plotting results see the  fitting section of the μs-ALEX 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 \verb|bursts_fitter| function documentation  (\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 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 the 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|.  As an example, to get the reduced $\chi^2$ value of the E histogram fit in a single-spot measurement \verb|d|, we use:  \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)  quantities. AIC and BIC allow to compare different models and  to select the most appropriate for the data at hand.  Example of defining and modifying models for fitting are provided in the afore mentioned μs-ALEX notebook.  Users can also refer to the comprehensive lmfit's documentation  (\href{http://lmfit.github.io/lmfit-py/}{link}).         

\subsection{Open Science and Reproducibility}  In the last 20 years, single molecule FRET (smFRET), has emerged as one of the most  useful techniques in single-molecule spectroscopy~\cite{Weiss_1999,Hohlbein_2014}. Except a few specific ensemble time-resolved measurements~\cite{Lerner_2014,Rahamim_2015}, smFRET unique feature is the ability to resolve conformational changes of biomolecules or measure binding-unbinding kinetics on heterogeneous samples. smFRET measurements on freely diffusing molecules (the focus of this paper) have the advantage of probing molecules and processes without possible perturbation from surface immobilization~\cite{Dahan_1999,Eggeling_1998}. The field of freely-diffusing smFRET data analysis, has seen a number of significant contributions over the years~\cite{Fries_1998,Eggeling_2001,Zhang_2005,Gopich_2005,Lee_2005,Nir_2006,Antonik2006,Gopich_2007,Gopich_2008,Camley_2009,Santoso_2010,Torella_2011,Tomov_2012}. Historically, each research group have implemented its own private version  of analysis software (oftentimes highly dependent on a particular setup  configuration) with almost no collaboration or code sharing.  Even in our group, past smFRET papers merely mention the usage of custom-made software without additional details~\cite{Lee_2005,Nir_2006}.  This situation makes it hard to reproduce and validate and to build upon results from different groups.  Moreover, as new methods are proposed in literature, it is oftentimes hard to quantify their performances.  An independent quantitative assessment  would require a complete reimplementation, an effort a few groups can afford.  As a results, potentially useful analysis improvements  are rarely adopted by the community at large.  In contrast with other consolidated traditions such as sharing protocols and samples, for scientific software,  we have relegated ourselves to islands of non-communication.  From a more general stance, non-availabilty non-availability  of codes used for scientific results, hinders reproducibility, makes it impossible to review and validate the software correctness  and prevents improvements and extensions by other scientists.  This situation, common in many disciplines, represents a real impediment to the scientific progress.  Since pioneering work of Donoho group in the 90's~\cite{Buckheit_1995},  it has become evident that developing and maintaining open source scientific software  for reproducible research is a critical requirement of modern sciencific scientific  enterprice~\cite{Ince_2012,Vihinen_2015}. %Peer-reviewed publications describing such software are also necessary~\cite{Pradal_2013}, %although the debate is still open on the most effective model for peer-reviewing this  %class of publications~\cite{Check_Hayden_2013,Check_Hayden_2015} %(\href{https://software-carpentry.org/blog/2015/04/quality-is-free-getting-there-isnt.html}{Willson 2015})  %(\href{https://www.mozillascience.org/effective-code-review-for-journals}{Mills 2015})  %(\href{http://ivory.idyll.org/blog/2015-we-live-in-a-bubble.html}{Brown 2015} and \href{http://ivory.idyll.org/blog/on-code-review-of-scientific-code.html}{2013}).  Facing these issues, we developed FRETBursts, an open source Python software for burst analysis of freely-diffusing  single-molecule FRET experiments. With FRETBursts we provide a tool that is available to any scientist  to use, inspect and modify. FRETBursts is suitable for routine state-of-the-art analysis of smFRET data but also represents an ideal platform for quantitative comparison of different methods in burst analysis.  To facilitate reproducibility of complete analysis  workflows, FRETBursts execution model is based on Juyter Notebook~\cite{Shen_2014}.  A notebook contains a narrative, input paramenters, parameters,  code and results in a single document that is easy to share and re-execute.  To minimize chance of bugs we employ modern software engineering techniques  such as unit testing and continuous integration.  FRETBursts is hosted and openly developed on GitHub~\cite{Blischak_2016,Prli__2012}, where users can send comments, report issues or contribute code.  In a parallel effort, we recently introduced Photon-HDF5,  a open file format for timestamp-based single-molecule fluorescence experiments~\cite{Ingargiola2016}. Together with Photon-HDF5,  FRETBursts contributes to the ecosystem  of open tools for reproducible science in the single-molecule field. 

\subsection{Paper Overview}  This paper is an introduction to smFRET burst analysis and FRETBursts usage.  Therefore, after a brief overview of FRETBursts features (section~\ref{sec:overview}),  we introduce core smFRET burst analysis concepts and terminology (section~\ref{sec:concepts}). These concepts are used throughout the paper  so reading section~\ref{sec:concepts} is highly recommended. 

The aim is elucidating the specificities and trade-off of various approaches  with enough details to empowers reader new to the field to customize the analysis to their own needs.  For the most advanced use-case, section~\ref{sec:bva} walks the reader thorough implementing  Burst Variance Analysis (BVA)~\cite{Torella_2011} as an example of manipulating timestamps and burst data.  Finally, in section~\ref{sec:conclusions}, we summarize what we believe to be  the strengths of FRETBursts software. 

In order to make the text accessible to the widest number of readers,  we concentrated python-specific details in special subsections titled  \textit{Python details}. These subsections provide deeper insights for readers  already familiar with python and can be safely skipped otherwise. Finally, note that all commands here reported can be found in the accompanying notebooks (\href{https://github.com/tritemio/fretbursts_paper}{link}).         

\subsection{Development and Contributions}  \label{sec:dev}  Errors are an inevitable reality in any reasonably complex software. It is therefore critical to implement countermeasures to  minimize the probability of introducing bugs and their potential impact~\cite{Prli__2012, Wilson_2014}.  We strive to follow modern best-practices in software development which are summarized below.  FRETBursts (and the entire python ecosystem it depends on) is open source 

All these services would be extremely costly, if available \textit{tout court},  for a proprietary software or platform~\cite{Freeman_2015}.  We highly value source code readability, a property which can reduce the number of bugs by facilitating understanding and verifying the code.  For this purpose, FRETBursts code-base is well commented (more that 35\%  of source code), follows the PEP8 python code style rules (\href{https://www.python.org/dev/peps/pep-0008/}{link}),  and has docstrings in napoleon format (\href{http://sphinxcontrib-napoleon.readthedocs.org/}{link}). 

\href{https://readthedocs.org/}{ReadTheDocs.org}.  Unit tests cover most of the core algorithms, ensuring consistency and  minimizing the probability of introducing bugs. The TravisCI (\href{http://travis-ci.org}{link}) continuous integration service, executes the full test suite on each commit, timely reporting errors.  As a rule, whenever a bug is discovered, the fix also includes a new test  to ensure that the same bug cannot happen in the future.  In addition to the unit tests, we include a regression-test notebook  (\href{https://github.com/tritemio/FRETBursts/blob/master/notebooks/dev/tests/FRETBursts%20-%20Regression%20tests.ipynb}{link})  to easily compares numerical results between two versions of FRETBursts. Additionally, the tutorials themselves are executed before each release as  an additional test layer to ensure that no errors or regressions are introduced.  FRETBursts is openly developed using the GitHub platform.  The authors encourage users to use GitHub issues for questions, discussions  and bug reports, and to submit patches through GitHub pull requests.  Contributors of any level of expertize expertise  are welcome in the projects and publicly acknowledged.  Contributions can be as simple as pointing out deficiencies in the documentation but can also be bug reports or corrections to the documentation or code. Users willing to implement  new features are encouraged to open an Issue on GitHub and to submit  a Pull Request. The open source nature of FRETBursts guarantees that  contributions will remain available to the entire single-molecule community.  \subsection{Timestamps and Burst Data}  \label{sec:burststimes}  Beyond providing prepackaged functions for established methods, FRETBursts also provides the infrastructure for exploring new analysis approaches.  Users can easily get timestamps (or selection masks) for any photon stream.  Core burst data (start and stop times, indexes and derived quantities for each burst) are stored in \verb|Bursts| objects  (\href{http://fretbursts.readthedocs.org/en/latest/burstsearch.html}{link}).  This object provides a simple and well-tested interface (100 \% unit-test coverage) to access and manipulate burst data. \verb|Bursts| are created from a sequence of start/stop times and indexes, while all the other fields are automatically  computed. \verb|Bursts|'s methods allow to recompute indexes relative to a different photon  selection or recompute start and stop times relative to a new timestamps array.  Additional methods perform fusion of nearby bursts or combination of two set of bursts (time intersection or union). This functionality is used for example to implement the DCBS.  In conclusion, \verb|Bursts| efficiently implements all the common operations performed with burst data, providing and easy-to-use interface and well tested algorithms. Leveraging \verb|Bursts| methods, users can implement new types of analysis without wasting time implementing (and debugging) standard manipulation routines.  Examples of working directly with timestamps, masks (i.e. photon selections) and burst data are provided in one of the FRETBursts notebooks (\href{http://nbviewer.jupyter.org/github/tritemio/FRETBursts_notebooks/blob/master/notebooks/Example%20-%20Working%20with%20timestamps%20and%20bursts.ipynb}{link}). Section~\ref{sec:bva} provides a complete example on using FRETBurts FRETBursts  to implement custom burst analysis techniques.  \paragraph{Python details} 

Photon streams are selected from the full (all-photons) timestamps array using  boolean masks, which can be obtained calling \verb|Data.get_ph_mask|  (\href{http://fretbursts.readthedocs.org/en/latest/data_class.html?highlight=get_ph_mask#fretbursts.burstlib.Data.get_ph_mask}{link}).  All burst data (e.g. start-stop times and indexes, burst duration, etc.) are stored in \verb|Bursts| objects. For uniformity, the bursts start-stop  indexes are always referring to the all-photons timestamps array,  regardless of the photon stream used for burst search.  \verb|Bursts| objects internally store only start and stop times and indexes. The other \verb|Bursts| attributes (duration, photon counts, etc.) are computed on-the-fly when requested (using class properties), thus minimizing the object state. \verb|Bursts| support iteration  with performances similar to iterating through rows of 2D row-major numpy arrays.         

As mentioned before the new object will share the photon data  arrays with the original object (\verb|d|) in order to minimize the RAM use.  The first argument of \verb|select_bursts| (\href{http://fretbursts.readthedocs.org/en/latest/data_class.html#burst-selection-methods}{link})  is a python function implementing the "selection rule" (\verb|select_bursts.size| in this example);  all the remaining arguments (only \verb|th1| in this case) are parameters of the selection rule.  The \verb|select_bursts| module (\href{http://fretbursts.readthedocs.org/en/latest/burst_selection.html}{link})  contains numerous built-in selection functions  (\href{http://fretbursts.readthedocs.org/en/latest/burst_selection.html#module-fretbursts.select_bursts}{link}). 

New criteria can be easily implemented by defining a new selection function,  which requires not more than a couple of lines of code in most cases (see the  \verb|select_bursts| module's source code  for several examples, \href{https://github.com/tritemio/FRETBursts/blob/master/fretbursts/select_bursts.py}{link}).  Finally, different criteria can be combined by applying them sequentially. 

In the previous section, we selected bursts by size using only photons  detected by donor and acceptor channel during donor excitation.  Conversely, we can apply a threshold on the all-photon burst size (section~\ref{sec:burstsizeweights}) by adding $n_{aa}$ to the burst size  as in eq.~\ref{eq:burstsize_allph}. This is achieved  by passing \verb|add_naa=True| to the selection function. When \verb|add_naa| is not specified, 

When γ-factor is not 1, neglecting its effect on burst size leads to  over-representing (in terms of number of bursts) one population versus to the others.  When the γ factor is known, users can pass the argument \verb|gamma| during burst selection:  \begin{lstlisting} 

For more information on burst size selection refer to the  \verb|select_bursts.size| documentation  (\href{http://fretbursts.readthedocs.org/en/latest/burst_selection.html#fretbursts.select_bursts.size}{link}). \paragraph{Python details} The method \verb|Data.burst_sizes| (\href{http://fretbursts.readthedocs.org/en/latest/data_class.html#fretbursts.burstlib.Data.burst_sizes}{link})  computes and returns γ-corrected burst sizes with or without addition of \verb|naa|.  \subsubsection{Select the FRET Populations}  In smFRET-ALEX experiments, in addition to one or more FRET populations, there are always  donor-only (D-only) and acceptor-only (A-only) populations. In most cases, these additional populations are not of interest and need to be filtered out.  In principle, using the E-S representation, we can exclude D-only and A-only bursts  by selecting bursts withing within  a range of $S$ values (e.g. S=0.2-0.8). This approach, however, simply truncates the burst distribution with arbitrary thresholds and is therefore not recommended for quantitative assessment of FRET populations.  A better approach consists in applying two selection filters one after the other.  First, we filter out the A-only population by applying a threshold on number of photons during donor excitation.  Second, we exclude the D-only population by  by applying a threshold on number of photons during acceptor excitation. 

Here, the variable \verb|ds2| contains the composite selection of bursts.  Figure~\ref{fig:alex_jointplot_fretsel} shows the resulting pure FRET  population obtained with the previous selection.