Abstract:
The invention provides a method and a measurement system for characterization of luminescence properties, the method comprises irradiating the luminescent material with a pulse of excitation light, providing a triggering signal correlated to the pulse of excitation light; detecting with a photodetector such as a photomultiplier tube (PMT) a plurality of photons emitted from the luminescent material as result of the pulse of excitation light, the photodetector providing an output signal upon the event of detection of a photon; determining for each detected photon a photon arrival time and providing an output suitable for inputting to an analysing module wherein an output comprises zero, one, or more photon arrival time for each excitation, receiving said outputs in an analysing module; and determining in the analysing module, characteristics properties of the luminescent material by performing a statistical analysis based on Bayesian inference.

Description:
CROSS REFERENCE TO RELATED APPLICATIONS 
     This application is a filing under 35 U.S.C. §371 and claims priority to international patent application number PCT/GB02/05543 filed Dec. 6, 2002, published on Jun. 19, 2003 as WO 03/050518 and also claims priority to patent application number 0129589.8 filed in Great Britain on Dec. 11, 2001; the disclosures of which are incorporated herein by reference in their entireties. 
     The present invention relates to a method and system for measuring luminescence lifetime. More particularly, the invention relates to a method and apparatus that significantly reduces the measurement time in a Time Correlated Multi-Photon Counting (TCMPC)-measurement. 
     BACKGROUND OF THE INVENTION 
     Measurement of the luminescence emission of substances has become increasingly important as a sensitive analytical technique in a wide range of disciplines such as chemistry, biology, engineering, materials science and application areas ranging from pollution monitoring and production control in a chemical plant to the sequencing of DNA. In many of these areas, distinguishing the weak but characteristic emission of the substance of interest from background light is difficult. Measuring the lifetime of the light emission of the substance of interest can often be used to discriminate the desired signal from a background. In this context we define the luminescence lifetime of a substance to be the time taken for the intensity of light emitted in response to an exciting pulse of light to fall to 1/e (˜1/2.7) of its initial value. This characteristic time can range from less than one nanosecond to minutes, depending on the processes involved. Such processes can be described as fluorescence, luminescence or phosphorescence, but if the desired light emission has a lifetime which is different from light of another source, its detection can be enhanced. 
     One example of fluorescence measurements is in DNA sequencing, where molecular fragments are ‘labelled’ with a fluorescent dye and the fluorescence emission of a dye-labelled fragment is used to identify which amino acid base begins or ends a given sequence of amino acids. Another application is in the screening of potential drugs against a target molecule. Typically changes in fluorescence intensity are used to identify ‘hits’ in response to a chemical test or ‘assay’ of the interaction between a potential drug and a target molecule. In this case, either the drug or the target or both may be labelled. In both sequencing and screening, the characteristic lifetime of a fluorescent molecule can be used to improve its detection. 
     A fluorescent material is a material which can be excited to a higher electronic state and on relaxing towards its ground state emits a photon. The time elapsed from the excitation until the emission of a photon, the intensity of emitted photons, and the energy (frequency) of the photons are all properties that can be measured and used to characterize the material. The excited state is typically achieved by subjecting the material to a short light pulse. The emission of photons is a Poisson process and the intensity of the emitted photons is continuously decreasing, and typically follows an exponential decay. A useful way of characterising a fluorescent material is to measure the time elapsed between an excitation and the arrival of photons at a detector. λ(t) denotes the Poisson arrival rate at time t at all times and is given by:
 
λ( t )= Ae   −αt   equation 1
 
where A denotes the intensity of a single fluorescent material, measured in photons per second, at time 0 (the time of the excitation), also referred to as the initial intensity, α denotes the decay constant of the fluorescence, measured in nepers/second, and 1/α is the fluorescence lifetime, which is often used to characterise a fluorescent material. If a sample has more than one fluorescent material present, the arrival rate of photons can typically be described by a multiexponential expression.
 
     A widely used technique of determining the fluorescence lifetime of a material is Time Correlated Single Photon Counting (TCSPC). In TCSPC a sample is typically subjected to a short light pulse, which excites the material in the sample. The material will, if fluorescent, emit a photon a short time after the excitation. The emitted photon is detected and the time that has elapsed between the excitation light pulse and the arrival of the first emitted fluorescence photon is recorded by the measurement system. The technique is only capable of counting a maximum of one photon per excitation. In practice less than one photon per excitation are counted since, to get a representative distribution of arrival times, a low intensity of the exciting light pulse is used, giving a low probability of photon emission. Therefore, to get a reliable measure of the fluorescence lifetime characteristic of a particular material, using TCSPC, i.e. to acquire a fluorescence decay curve, the process of exciting the material in the sample and detecting the first emitted photon, has to be repeated a large number of times. A measurement can typically involve several tens of thousands excitation-photon detection cycles. The TCSPC method has been continuously improved, for example U.S. Pat. No. 5,990,484 teaches a method and apparatus for counting a total number of emitted photons, allowing a higher intensity of the exciting light pulse, and U.S. Pat. No. 4,686,371 teaches a method of compensating for variations in the length and intensity of the exciting light pulse. 
     As above indicated, TCSPC can, even if the mentioned improvements are utilised, be a time consuming measurement. It is realised in the art that the method is wasteful in that only the first emitted photon is detected and used for the determination of the fluorescence lifetime, even though the subsequently emitted photons carry information useful for the determination of the characteristic lifetime. A number of approaches have been suggested to extend the TCSPC to also detect and record subsequent photons. The most recent development of the TCSPC-technique includes various multiplexing techniques, in which, in principle, a plurality of detectors are connected to one or more analysing means, examples described in Multiplexed single-photon counting by Scubling et al., Rev. Sci. Instrum. 67 (6), 2238-2246 June 1996. Alternatively multi-element detectors have been suggested, for example by Browne et al. in A 100 ns anti-coincidence circuit for multi-channel counting systems, Meas. Sci. Technol. 6 (6), 1487-1491, June 1996. The suggested Multiplexed Time Correlated Single-Photon Counting (M-TCSPC)—techniques represent significant improvements over the TCSPC—techniques, but have the drawback that the number of photons that it is possible to detect following one excitation pulse is limited by the number of detectors (or detector elements) used; therefore a large number of excitation cycles is still needed to determine the fluorescence lifetime of the material. In addition multielement detectors are costly, as are systems providing a large number of single detectors in a multiplexing arrangement. 
     The known apparatus and measurement techniques thus suffer, as above described, from a number of disadvantages and limitations, the most important being the long measurement time. Thus, there is a need in the art to provide a measurement system and method that shortens measurement time. 
     SUMMARY OF THE INVENTION 
     The object of the present invention is to provide a system and a method that significantly reduces the measurement time in a major part of the applications. The inventive system is defined in claim  10  and the method and corresponding software module in claims  1  and  9 , respectively. 
     One advantage afforded by the present invention is to be able to use a limited dataset by using a Bayesian algorithm to make better use of the available data. 
     Yet another advantage of the invention is to be able to take into account the PMT dead time in the lifetime analysis or any other instrumental parameters, such as e.g. non-delta illumination, etc. 
     Yet another advantage of the invention is the possibility, as a result of a measurement, of giving the posterior probability distribution of a fluorescence lifetime and/or intensity in contrast to the prior art, which typically only gives a single value as a measure of the lifetime and/or intensity. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       The invention will now be described in detail with reference to the drawing figures, in which 
         FIG. 1  is a schematic illustration of a single channel TCMPC system according to the invention; 
         FIG. 2  is a schematic illustration of a multiple channel TCMPC system according to a preferred embodiment of the invention; 
         FIG. 3  shows a flowcharts of the measurement and analysing method according to the invention; 
         FIG. 4   a  is a graph showing an example of a trace from the photon timing unit; 
         FIG. 4   b  is a graph showing an example of a trace from the photon timing unit from the multi-channel TCMPC system; 
         FIG. 5  is a graph showing an example of three prior distributions entered by a user; 
         FIG. 6  is a graph showing an exemplary output from algorithms A3-A8. 
     
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     The inventive measurement system provided by the present invention will be described with reference to the schematic illustrations of  FIG. 1-2 .  FIG. 1  shows a single channel TCMPC system according to the invention. Fluorescent material is contained in a sample  110 . An excitation light source  120  for repeatedly irradiating the sample with pulses of excitation light is provided. The light source preferably a pulsed laser. A light source driving and controlling unit  130  comprises the laser power supply and is arranged to generate a triggering signal  140  to a photon timing unit  150 . The repetition rate of the excitation light should be sufficiently low to allow a total decay of the fluorescence of the sample before the next exciting pulse. A pulsing frequency of for example around 200 kHz would commonly be appropriate. The duration of the pulse of excitation light should be significantly shorter than the fluorescence lifetime of the fluorophore in order to obtain reliable lifetime measurements. A typical fluorophore has a fluorescence lifetime in the range of 1-100 ns and a suitable length of the light pulse would be in the order of 0.5 ns. The frequency of the pulse is an example of a parameters typically adjusted for the sample under investigation (the length of the light pulse is an intrinsic characteristic of the laser and typically cannot be easily changed). In addition, the light source  120  and the light source driving and controlling unit  130 , should preferably have the facility to adjust other parameters such as the number of pulses and the intensity of the excitation light in order to account for e.g. the amount of fluorophore in the sample, the needed accuracy in the result etc. Light sources, e.g. pulsed lasers, with the characteristics described above and with driving and controlling units therefore are known in the art and commercially available; for example, the NanoLED-07 picosecond laser source from IBH. 
     Positioned adjacent to a sample chamber containing the sample  110  is a photodetector  160 , which has the purpose of detecting the emitted fluorescent photons. Different optical components are placed between the sample and the detector. For example several lenses are used to maximise the amount of fluorescent light collected from the sample and to focus the light onto the detector. Furthermore dichroic mirrors and filters are used to select a range of wavelength and prevent the excitation light from reaching the detector and only let the light having a range of wavelength corresponding to the fluorescence spectrum of the fluorophore reach the detector. An optical component is also used to split the beam of the fluorescent light into several beams that are then directed to the different detectors. This splitting can be achieved in different ways, e.g. by using a beam splitter cube or by using multi-branch fibre optics. These are well known in the art and are commercially available (for example, from Oriel Instrument, 150 Long Beach Boulevard, Stratford, Conn., USA or from Melles Griot, St Thomas Place, Ely, Cambridgeshire, England). The photodetector preferably comprises a photon counting photomultiplier tube (PMT) but other detectors such as an avalanche photodiode can be used. The signal from the photodetector is typically amplified in a pre-amplifier  170 . After amplification, the signal can go through a discriminator unit that remove the unwanted noise from the signal and only leave the electrical pulses generated by the photons on the PMT. The discriminator unit is then connected to the photon timing unit  150 . The photon timing unit comprises for example a very fast analogue-to-digital converter (A/D converter) and a memory for storing datapoints. As discussed above, it should be possible for more than one photon per excitation, resulting from the excitation light pulse, to be recorded by the photodetector  160  and the photon timing unit  150 , not only the first emitted photon as in the TCSPC based techniques. This put certain requirements on the photodetector  160  and the photon timing unit  150 ; A photon detected by the PMT will give rise to an output pulse that has a duration of c.a. 4-6 ns with the current technology. To identify a PMT pulse position in time at least 4-8 data points per pulse are needed, in accordance with the method described further below. In order to detect a plurality of such pulses the A/D converter needs to have a sampling frequency at least of around 2 GS/s and the ability to store data points corresponding to an acquisition period of approximately 100 ns. A/D converters with such extreme capabilities have only recently been made commercially available. An example of a suitable A/D converter is the Acquiris DP210 (2 GS/s) from Acquiris Europe, 18 chemin des Aulx, 1228 Plan-les-Ouates, Geneva, Switzerland. The collected data points are analysed by an arrival time determination module  155 , preferably realised as a software program module residing either within the photon timing unit  150 , or alternatively within an external computer  180 , to determine the arrival time of the fluorescence photons. Examples of suitable algorithms for arrival time determination will be given below. Arranged to receive and analyse a dataset of photon arrival times from the arrival time determination module, is an analysing module  185 , which preferably is a software program package implemented in and executed on the computer  180 . The computer can be a general purpose computer such as a PC or a workstation or a special purpose machine. The computer  180  is preferably also used for controlling the measurements, monitoring the equipment etc. and therefore is equipped with communication means (not shown) connected to other units of the measurement system. Installed in and executing on the computer, is then also a software program module for measurement control  190 . As appreciated by the skilled in the art, the installation of and execution of the software modules  155 ,  185  and  190  can be done in various ways and in various computer configurations. For example the measurement control unit  190  can be executed in a PC suitable for laboratory conditions, the arrival time determination module  155  can be incorporated within the photon timing unit, and the analysing module  185  in a special purpose machine designed for the high computational speed needed for certain analysis. The inventive methods utilised by the analysing module  185  will be described in detail below. 
     Photodetectors such as PMTs give a signal that typically last 4-5 ns. During that time the PMT is incapable of detecting any new photons. This is often referred to as PMT dead time. If photons arrive during the PMT dead time, i.e. less than 5 ns apart, the measurement system will not be able to record them. As will be described further below, the analysing method can be made to take into account the PMT dead time, but the fact that the system is incapable of recording photons during certain time intervals will prolong the needed measurement time. 
     In one embodiment of the present invention the measurement system has been provided with a plurality of photodetectors (PMT) and amplifiers connected to them, giving a multi-channel TCMPC. In  FIG. 2  this is exemplified with a dual-channel system, having a first PMT  200 , and a second PMT  205 , connected to preamplifiers  210  and  215 , respectively. The preamplifiers are connected to a common photon timing unit  150  with independent channels. Alternatively a plurality of photon timing units can be used. If one of the PMT is recovering after detecting a photon, the other may still be capable of detecting a subsequent photon. The effective dead time of the system is thus reduced. More than two PMT—amplifier channels can be used to further reduce the effective PMT dead time. 
     An experimental procedure using the inventive methods and measurement system according to the invention will be described with references to the flowchart of  FIG. 3 . Variations of the experimental procedure are possible and the procedure now described should be considered as one of many embodiments possible. The aim of the measurement is typically to determine the initial intensity of fluorescence, the fluorescence lifetime (1/α) or the posterior probability distribution of the intensity or lifetime of one or a plurality of fluorophores contained in the sample  110 . 
     The experimental procedure comprises:
         300: In a first step 300, the user enters, to the measurement controlling module  190  and the analysing module  185 , a number of parameters used for controlling the measurement, choosing an appropriate analysis algorithm depending primarily on prior knowledge of the sample, and parameters describing the performance of the equipment such as PMT dead time. Parameters important for the inventive methods described below comprise:
           N—the number of excitations (laser pulses);   α i —the reciprocal of the fluorescence lifetimes (if known) and/or the prior distribution of lifetimes, P(α i );   A i —the fluorescence initial intensities (if known) and/or the prior distribution of intensities, P(A i );   δ—the PMT dead time;   τ—the time the detector is blocked after an excitation;   υ—the duration of recording after each excitation   A1, A2, A3, A4, A5, A6, A7, A8—Analysis algorithms   Many of the parameters are not changed for each measurement and default values are preferably stored in a database.   
           305: The measurement starts by illuminating the sample  110  with a pulsed laser  120 .   310: In a next step, 310, the emitted photons are collected by PMT tube(s)  160  and the signal is amplified by a pre-amplifier  170  and possibly the signal is discriminated to remove unwanted noise.   315: In step 315, the arrival time of the emitted photons are determined by the photon timing unit  150  and the arrival time determination module  155 , with one of the methods that will be described below. The arrival time determination module  155  outputs for each excitation n a dataset D n , comprising the photon arrival times, to the analyzing module  185 .   320: In step 320, if the predetermined number of excitations N is reached the procedure goes to step 325, if not, steps 300-320 are repeated.   325: In step 325, the datasels D n  are analysed with one (or more) of the algorithms A1-A8, the algorithms being based on Bayesian inference.   330: In a final step 330, the result is presented to the user. Depending on the algorithm chosen and the preferences of the user the output can be distributions of the fluorophore lifetimes or initial intensities, joint distributions, a measure of a fluorophore lifetime etc.       

     Alternatively the measurement procedure can stop then a predefined accuracy is achieved. In this case the analysis using Bayesian inference (step 325) is performed within the main loop of the algorithm. If, for example, the measure of a fluorescence lifetime has the predefined accuracy, the loop is halted. The procedure can of course in addition have a limit to the number of pulses used, which terminates the measurement even if the specified accuracy has not been met. 
     Arrival Time Determination 
     The method of determining photon arrival times performed in the arrival time determination module  155 , will be described with reference to  FIG. 4   a - b .  FIG. 4   a  gives an example of an output, commonly known as a trace, from the photon timing unit  150 . The initial broad peak in the top curve corresponds to the triggering signal  140  sent from the light source driving and controlling unit  130  to the photon timing unit  150 , when the excitation light source  110  irradiates the sample. It should be noted that this triggering signal itself is much longer (in this case it lasts for about 50 ns) than the actual laser pulse (that last for only 0.5 ns). Only the rising part of the signal is used by the photon timing unit  150  to determine the trigger to start the time base. The rest of the triggering signal is ignored by the photon timing unit. It must be noted that the length of the triggering signal does not correspond to the length of the laser pulse. If the laser pulse is longer than the resolution of the photon timing unit, one can block the photodetector during a time τ. An emitted fluorescence photon is detected by the PMT and give rise to the pulse from the PMT, amplified in the pre-amplifier (solid line on  FIG. 3 ), discriminated to remove the noise (dotted line on  FIG. 3 ) and digitised in the A/D-converter, to show as the peak  210 . It should be noted that the discriminator introduces a delay in the signal, explaining the shift between the position of the pulse in the solid and dotted line. This is not a problem, as this time delay is constant, it can be subtracted subsequently by the timing unit The time elapsed between the triggering signal and the appearance of the first peak  210  is the arrival time of the first fluorescence photon. The second peak  220  corresponds to a subsequent fluorescence photon. 
     A method of determining the arrival time of the fluorescence photons will now be described with references to  FIG. 4   a - b . The trace is a list of data points, each point representing an output voltage from the PMT at a given time. In the embodiment with a plurality of photodetectors a corresponding plurality of parallel traces will result. In a first step 505 a zero time is defined as the beginning of the triggering pulse (for example, at the time when the trigger pulse reaches 50% of its maximum amplitude). The second step 510 is discrimination by selecting a part of the trace that is larger than a threshold value (this can be done by software or by hardware in the discriminator). In the following step 515 a local maximum of the voltage is defined as a point that is larger than both the point directly preceding it and the point directly following it. The time corresponding to the local maximum is recorded in step 520. This is defined as the arrival time of the photon. The method is preferably realised by a software program executed either in the photon timing unit  150  or in an external computer  180 . The result is a dataset D n  of measured arrival times for each excitation pulse n. As appreciated by the skilled in the art other methods of finding arrival times in a trace of datapoints can be utilised. For example, a first point larger than a preset threshold, or the point with the largest slope (largest derivative) in the peak, can be used to define an arrival time. The method chosen is typically a trade-off of the required precision in the definition of the arrival time and the computational time needed to determine the arrival time. 
       FIG. 4   b  shows the two traces, and the trigger signal from the laser pulse, resulting from the measurement system of  FIG. 2 . Both the multi-channel and the single-channel TCMPC can further be provided with discriminators, one for each channel, or other noise reduction means. 
     It should be noted that with all these methods, there is sometime an artefact. The algorithm may identify two points (or more) in a single pulse that satisfy the selection criteria. In order to remove the artefactual points, a subroutine would check whether several selected points are spaced with a time less than the PMT dead time and only select the first point in the group. 
     Bayesian Inference 
     The method of the present invention, which will be illustrated by the embodiments, algorithms A1-A8, are based on the principle of Bayesian inference. Bayesian inference offers a way of determining the (posterior) probability distribution of a variable (or vector of variables) in the light of some data taking into account prior knowledge of the probability of the variable taking various values. As an example, let us suppose that θ represents what we want to know. Usually θ will be a vector of many numbers; it might for example be the vector of intensities of a number of fluorophores. Let us suppose that D represents what we do know. D might for example the arrival times of some photons. Now, we know that for any specific value of θ, which specifies the vector of intensities, that some values of D are more likely and others less likely, and because we know the manner in which the data arises from θ, we can say exactly how much more or less likely. In other words, we can evaluate, for any specific values of θ and D, the value of P(D|θ), the probability of D given θ. We also know, before we even receive D, that some values of θ are more likely than others. For the photon counting example negative intensities can be excluded, as can values of the intensities that are extremely large (e.g. &gt;1 e15 per second) or too small. This can all be precisely specified as a prior distribution on θ, denoted P(θ). 
     What we actually want to know is the value of θ, given some specific value of D. This is given by Bayes&#39; theorem: 
                     P   ⁡     (     θ   |   D     )       =         P   ⁡     (   θ   )       ⁢     P   ⁡     (     D   |   θ     )           ∫       P   ⁡     (   θ   )       ⁢     P   ⁡     (     D   |   θ     )       ⁢     ⅆ   θ                   equation   ⁢           ⁢   2               
which tells us that given that particular value of D, how likely each value of θ is. In eq. 2 P(θ) is referred to as the Prior, P(D|θ) as the Likelihood, P(θ|D) as the Posterior, and ∫P(θ)P(D|θ)dθ as the Evidence (for the model).
 
     A posterior distribution derived by Bayesian inference may by used in different ways: View the entire posterior distribution—possible in some cases (dimensionality not more than 2) and impossible in others; MAP (maximum a posteriori)—find the value of θ where the posterior probability density is greatest (if possible); and report just that value of θ, Mean posterior value—report the mean posterior value of θ, θθP(θ|D)dθ; Random samples—drawing random samples from the distribution P(θ|D). The method of random samples is often the preferred way of using the Posterior. Random samples can be independent or non-independent. 
     The Bayesian principles are utilized in the inventive method of the present invention for substantially shortening the measurement time needed for e.g. determination of a fluorescence lifetime. The reduction in measurement times arises from the fact that by using Bayesian inference adapted to the application of TCMPC fewer photons are needed to characterize a fluorophore compared to the prior art methods. The method fully utilizes the advantage afforded by the inventive system of detecting a plurality of photons for each excitation pulse. Depending on the prerequisite of the measurement, e.g. the number of different fluorophores present in the sample, different embodiments of the method will be appropriate, corresponding to the mentioned algorithms A1-A8. The algorithms are preferably comprised in the analysing module  185 , as software programs implemented in and executed on the computer  180  (although it would be possible to embody them in other ways). In the measurement procedure outlined with references to  FIG. 3 , the programs based on the algorithms are addressed in the initialisation step 300 and the analysis step 325. A brief theoretical background will be given to each algorithm and the algorithms will be presented as pseudo-code with references to accompanying flowcharts. 
     Algorithm A1, Unknown Fluorophore Lifetimes, Single Fluorophore, No Deadtimes. 
     The decay rate of a single fluorophore is given by equation 1. To use Bayesian inference, we must have a prior distribution on the unknowns. We will use Gamma distributions on both A and α, as this is both sufficiently expressive and results in relatively simple mathematics. The Gamma distribution has two parameters, m, the shape parameter, and r, the scale parameter, both of which must be positive. Its probability density is given by 
     
       
         
           
             
               
                 
                   
                     
                       Γ 
                       
                         m 
                         , 
                         r 
                       
                     
                     ⁡ 
                     
                       ( 
                       x 
                       ) 
                     
                   
                   = 
                   
                     
                       
                         
                           
                             r 
                             m 
                           
                           ⁢ 
                           
                             x 
                             
                               m 
                               - 
                               1 
                             
                           
                           ⁢ 
                           
                             ⅇ 
                             
                               - 
                               rx 
                             
                           
                         
                         
                           Γ 
                           ⁡ 
                           
                             ( 
                             m 
                             ) 
                           
                         
                       
                       ⁢ 
                       or 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       for 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       log 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       
                         x 
                         : 
                         
                           
                             Γ 
                             
                               m 
                               , 
                               r 
                             
                           
                           ⁡ 
                           
                             ( 
                             
                               log 
                               ⁡ 
                               
                                 ( 
                                 x 
                                 ) 
                               
                             
                             ) 
                           
                         
                       
                     
                     = 
                     
                       
                         
                           r 
                           m 
                         
                         ⁢ 
                         
                           x 
                           m 
                         
                         ⁢ 
                         
                           ⅇ 
                           
                             - 
                             rx 
                           
                         
                       
                       
                         Γ 
                         ⁡ 
                         
                           ( 
                           m 
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                   Equation 
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   3 
                 
               
             
           
         
       
     
     Varying r scales the whole distribution; varying m changes the shape of the distribution, allowing very broad distributions when m is small and very narrow ones when m is big. We can therefore choose appropriate parameters, and set 
     
       
         
           
             
               
                 
                   
                     
                       P 
                       ⁡ 
                       
                         ( 
                         A 
                         ) 
                       
                     
                     = 
                     
                       
                         
                           r 
                           A 
                           
                             m 
                             A 
                           
                         
                         ⁢ 
                         
                           A 
                           
                             
                               m 
                               A 
                             
                             - 
                             1 
                           
                         
                         ⁢ 
                         
                           ⅇ 
                           
                             
                               - 
                               
                                 r 
                                 A 
                               
                             
                             ⁢ 
                             A 
                           
                         
                       
                       
                         Γ 
                         ⁡ 
                         
                           ( 
                           
                             m 
                             A 
                           
                           ) 
                         
                       
                     
                   
                   ⁢ 
                   
                     
 
                   
                   ⁢ 
                   and 
                 
               
               
                 
                   Equation 
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   4 
                 
               
             
             
               
                 
                   
                     P 
                     ⁡ 
                     
                       ( 
                       α 
                       ) 
                     
                   
                   = 
                   
                     
                       
                         
                           r 
                           α 
                           
                             m 
                             α 
                           
                         
                         ⁢ 
                         
                           α 
                           
                             
                               m 
                               α 
                             
                             - 
                             1 
                           
                         
                         ⁢ 
                         
                           ⅇ 
                           
                             
                               - 
                               
                                 r 
                                 α 
                               
                             
                             ⁢ 
                             α 
                           
                         
                       
                       
                         Γ 
                         ⁡ 
                         
                           ( 
                           
                             m 
                             α 
                           
                           ) 
                         
                       
                     
                     . 
                   
                 
               
               
                 
                   Equation 
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   5 
                 
               
             
           
         
       
     
     As well as a prior, we must be able to calculate the likelihood of the observed data. Let us suppose that during a excitation n, photons arrive at times t n,1 ,t n,2 , . . . , t n,K     n   , and at no other times. Then we have the likelihood on the data D n  from excitation n given by 
                       P   ⁡     (         D   n     |   A     ,   α     )       =       (       ∏     k   =   1       K   n       ⁢           ⁢     (     A   ⁢           ⁢     ⅇ       -   α     ⁢           ⁢     t     n   ,   k             )       )     ⁢     P   ⁡     (         no   ⁢           ⁢   other   ⁢           ⁢   photons     |   A     ,   α     )           ,           Equation   ⁢           ⁢   6               
since in a Poisson process all events occur independently of each other. In a Poisson process of constant rate λ, the probability of no photons occurring in the interval from t 1 , to t 2  is e −λ(t     2     −t     1     ) . Where the rate is not constant, this probability is
 
     
       
         
           
             
               
                 
                   
                     
                       
                         
                           P 
                           ⁡ 
                           
                             ( 
                             
                               
                                 
                                   D 
                                   n 
                                 
                                 | 
                                 A 
                               
                               , 
                               α 
                             
                             ) 
                           
                         
                         = 
                         
                           
                             ( 
                             
                               
                                 ∏ 
                                 
                                   k 
                                   = 
                                   1 
                                 
                                 
                                   K 
                                   n 
                                 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 ( 
                                 
                                   A 
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   
                                     ⅇ 
                                     
                                       
                                         - 
                                         α 
                                       
                                       ⁢ 
                                       
                                           
                                       
                                       ⁢ 
                                       
                                         t 
                                         
                                           n 
                                           , 
                                           k 
                                         
                                       
                                     
                                   
                                 
                                 ) 
                               
                             
                             ) 
                           
                           ⁢ 
                           
                             ⅇ 
                             
                               - 
                               
                                 
                                   ∫ 
                                   0 
                                   ∞ 
                                 
                                 ⁢ 
                                 
                                   
                                     λ 
                                     ⁡ 
                                     
                                       ( 
                                       t 
                                       ) 
                                     
                                   
                                   ⁢ 
                                   
                                     ⅆ 
                                     t 
                                   
                                 
                               
                             
                           
                         
                       
                     
                   
                   
                     
                       
                         = 
                         
                           
                             A 
                             
                               K 
                               n 
                             
                           
                           ⁢ 
                           
                             ⅇ 
                             
                               
                                 
                                   - 
                                   α 
                                 
                                 ⁢ 
                                 
                                   
                                     ∑ 
                                     
                                       k 
                                       = 
                                       1 
                                     
                                     
                                       K 
                                       n 
                                     
                                   
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   
                                     t 
                                     
                                       n 
                                       , 
                                       k 
                                     
                                   
                                 
                               
                               - 
                               
                                 
                                   ∫ 
                                   0 
                                   ∞ 
                                 
                                 ⁢ 
                                 
                                   A 
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   
                                     ⅇ 
                                     
                                       
                                         - 
                                         α 
                                       
                                       ⁢ 
                                       
                                           
                                       
                                       ⁢ 
                                       t 
                                     
                                   
                                   ⁢ 
                                   
                                     ⅆ 
                                     t 
                                   
                                 
                               
                             
                           
                         
                       
                     
                   
                   
                     
                       
                         = 
                         
                           
                             A 
                             
                               K 
                               n 
                             
                           
                           ⁢ 
                           
                             ⅇ 
                             
                               
                                 
                                   - 
                                   α 
                                 
                                 ⁢ 
                                 
                                   
                                     ∑ 
                                     
                                       k 
                                       = 
                                       1 
                                     
                                     
                                       K 
                                       n 
                                     
                                   
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   
                                     t 
                                     
                                       n 
                                       , 
                                       k 
                                     
                                   
                                 
                               
                               - 
                               
                                 A 
                                 α 
                               
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   Equation 
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   7 
                 
               
             
           
         
       
     
     We therefore have 
               ⅇ     -       ∫     t   1       t   2       ⁢       λ   ⁡     (   t   )       ⁢   dt           .         
and combining all the data from N excitations together (independent from excitation to excitation), we have
 
     
       
         
           
             
               P 
               ⁡ 
               
                 ( 
                 
                   
                     D 
                     | 
                     A 
                   
                   , 
                   α 
                 
                 ) 
               
             
             = 
             
               
                 
                   A 
                   K 
                 
                 ⁢ 
                 
                   ⅇ 
                   
                     
                       - 
                       
                         α 
                         ⁡ 
                         
                           ( 
                           
                             
                               ∑ 
                               
                                 n 
                                 = 
                                 1 
                               
                               N 
                             
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               
                                 ∑ 
                                 
                                   k 
                                   = 
                                   1 
                                 
                                 
                                   K 
                                   n 
                                 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 t 
                                 
                                   n 
                                   , 
                                   k 
                                 
                               
                             
                           
                           ) 
                         
                       
                     
                     - 
                     
                       NA 
                       α 
                     
                   
                 
                 ⁢ 
                 where 
                 ⁢ 
                 
                     
                 
                 ⁢ 
                 K 
               
               = 
               
                 
                   ∑ 
                   
                     n 
                     = 
                     1 
                   
                   N 
                 
                 ⁢ 
                 
                     
                 
                 ⁢ 
                 
                   
                     K 
                     n 
                   
                   . 
                 
               
             
           
         
       
     
     Now, applying Bayes&#39; theorem to determine the posterior, we find that 
                     ⁢     Equation   ⁢           ⁢   8                         P   ⁡     (     A   ,     α   |   D       )       ⁢       =         P   ⁡     (     A   ,   α     )       ⁢     P   ⁡     (       D   |   A     ,   α     )           ∫       P   ⁡     (     A   ,   α     )       ⁢     P   ⁡     (       D   |   A     ,   α     )       ⁢     ⅆ   A     ⁢     ⅆ   α                           ⁢     ∝           r   A     m   A       ⁢     A       m   A     -   1       ⁢     ⅇ       -     r   A       ⁢   A           Γ   ⁡     (     m   A     )         ⁢         r   α     m   α       ⁢     α       m   α     -   1       ⁢     ⅇ       -     r   α       ⁢   α           Γ   ⁡     (     m   α     )         ⁢     A   K     ⁢     ⅇ       -     α   ⁡     (       ∑     n   =   1     N     ⁢           ⁢       ∑     k   =   1       K   n       ⁢           ⁢     t     n   ,   k           )         -     NA   α                             ⁢     ∝       A       m   A     -   1       ⁢     ⅇ       -     r   A       ⁢   A       ⁢     α       m   α     -   1       ⁢     ⅇ       -     r   α       ⁢   α       ⁢     A   K     ⁢     ⅇ       -     α   ⁡     (       ∑     n   =   1     N     ⁢           ⁢       ∑     k   =   1       K   n       ⁢           ⁢     t     n   ,   k           )         -     NA   α                             ⁢     =       A     K   +     m   A     -   1       ⁢     α       m   α     -   1       ⁢     ⅇ     -     A   ⁡     (       r   A     +     N   α       )           ⁢     ⅇ     -     α   ⁡     (       r   α     +       ∑     n   =   1     N     ⁢           ⁢       ∑     k   =   1       K   n       ⁢           ⁢     t     n   ,   k             )                           
which gives the joint posterior distribution and hence
 
                     ⁢     Equation   ⁢           ⁢   9                               P   ⁡     (     α   |   D     )       ⁢       =     ∫       P   ⁡     (     A   ,     α   |   D       )       ⁢     ⅆ   A                         ⁢     ∝     ∫       A     K   +     m   A     -   1       ⁢     α       m   α     -   1       ⁢     ⅇ     -     A   ⁡     (       r   A     +     N   α       )           ⁢     ⅇ     -     α   ⁡     (       r   α     +       ∑     n   =   1     N     ⁢           ⁢       ∑     k   =   1       K   n       ⁢           ⁢     t     n   ,   k             )           ⁢     ⅆ   A                           ⁢     =       α       m   a     -   1       ⁢     ⅇ     -     α   ⁡     (       r   α     +       ∑     n   =   1     N     ⁢           ⁢       ∑     k   =   1       K   n       ⁢           ⁢     t     n   ,   k             )           ⁢     ∫       A     K   +     m   A     -   1       ⁢     ⅇ     -     A   ⁡     (       r   A     +     N   α       )           ⁢     ⅆ   A                             ⁢     =         α       m   α     -   1       ⁢     ⅇ     -     α   ⁡     (       r   α     +       ∑     n   =   1     N     ⁢           ⁢       ∑     k   =   1       K   n       ⁢           ⁢     t     n   ,   k             )           ⁢     Γ   ⁡     (     K   +     m   A       )             (       r   A     +     N   α       )       K   +     m   A                                           
giving the marginal distribution of a (the reciprocal of the fluorophore lifetime), while
 
                     P   ⁡     (       A   |   α     ,   D     )       =           (       r   A     +     N   α       )       K   +     m   A           Γ   ⁡     (     K   +     m   A       )         ⁢     A     K   +     m   A     -   1       ⁢       ⅇ     -     A   ⁡     (       r   A     +     N   α       )           .               Equation   ⁢           ⁢   10               
gives the conditional distribution of initial intensity A.
 
     With the theoretical background above, and with reference to the flowchart of  FIG. 3 , an algorithm suitable for software implementation will be described. The algorithm will be denoted A1. As previous discussed, although the lifetime 1/α and the initial intensity A of the fluorophore is unknown, the user normally has some vague knowledge of the possible range of these values, that can be used to generate the prior distribution needed for the Bayesian inference. 
     Algorithm A1:
     500: In a first initialising step 500, which is included in step 300 of the flowchart of  FIG. 3 , the user enters functions, values or distributions describing α and A. If possible, the program may plot the result, and the user acknowledge the outcome.   505: In a measuring step 505, which corresponds to the steps 305-320, datasets of arrival times are collected D n .   510: The Bayesian inference analysis, step 510 (corresponding to 325) comprises the substeps (510: 1-5) of:   510: 1 Set grid of A, α (or log A, log α).   510: 2 Calculate   

                     P   ⁡     (     A   ,     α   |   D       )       =       A     K   +     m   A     -   1       ⁢     α       m   α     -   1       ⁢     ⅇ     -     A   ⁡     (       r   A     +     N   α       )           ⁢     ⅇ     -     α   ⁡     (       r   α     +       ∑     n   =   1     N     ⁢           ⁢       ∑     k   =   1       K   n       ⁢           ⁢     t     n   ,   k             )                     (     eq   .           ⁢   8     )               
for each combination of values of A and α
     510: 3 Normalize the joint distribution P(A,α|D) by:
       multiplying each grid point value of P(A,α|D) by the product measure appropriate to that point,   summing over all axes, dividing the original distribution by the result of the summation.   
       510: 4 Marginalize P(A,α|D) to get P(α|D) and P(A|D) (eq. 9,10) by, for each margin:
       multiplying each grid point value of P(A,α|D) by the product measure appropriate to that point,   summing over all axes except the axis whose margin is wanted,   dividing each grid point value of the resulting distribution by the marginal measure appropriate to that point   
       520: In an outputting step 520 (corresponding to 330) the resulting distributions are presented to the user as graphs, for example. Other measures can be calculated from the distribution for example the marginal means with the 5 th  and 95 th  centiles, an often quoted measure of the lifetime of a fluorophore.   

     The computational steps above usually actually need to be done by working in log P or −log P rather than in P, in order to avoid underflow and overflow. The skilled in the art will appreciate that in the calculating steps a number of obvious computational savings may be made, such as avoiding recalculating parts not changing during the summations. 
     The normalising step 510: 3 may preferably be performed in the following manner: 
     The grid of values of A are x h =(x 1 ,x 2 , . . . , x H ) and those of α are y j =(y 1 ,y 2 , . . . , y j ) Associate a measure with each x h  and 
     
       
         
           
             
               
                 y 
                 j 
               
               : 
               
                 m 
                 ⁡ 
                 
                   ( 
                   
                     x 
                     h 
                   
                   ) 
                 
               
             
             = 
             
               
                 
                   
                     
                       x 
                       
                         h 
                         + 
                         1 
                       
                     
                     + 
                     
                       x 
                       h 
                     
                   
                   2 
                 
                 - 
                 
                   
                     
                       
                         x 
                         h 
                       
                       + 
                       
                         x 
                         
                           h 
                           - 
                           1 
                         
                       
                     
                     2 
                   
                   ⁢ 
                   and 
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   
                     m 
                     ⁡ 
                     
                       ( 
                       
                         y 
                         j 
                       
                       ) 
                     
                   
                 
               
               = 
               
                 
                   
                     
                       
                         y 
                         
                           j 
                           + 
                           1 
                         
                       
                       + 
                       
                         y 
                         j 
                       
                     
                     2 
                   
                   - 
                   
                     
                       
                         
                           y 
                           j 
                         
                         + 
                         
                           y 
                           
                             j 
                             - 
                             1 
                           
                         
                       
                       2 
                     
                     ⁢ 
                     and 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     
                       m 
                       ⁡ 
                       
                         ( 
                         
                           
                             x 
                             h 
                           
                           , 
                           
                             y 
                             j 
                           
                         
                         ) 
                       
                     
                   
                 
                 = 
                 
                   
                     m 
                     ⁡ 
                     
                       ( 
                       
                         x 
                         h 
                       
                       ) 
                     
                   
                   ⁢ 
                   
                     m 
                     ⁡ 
                     
                       ( 
                       
                         y 
                         j 
                       
                       ) 
                     
                   
                 
               
             
           
         
       
     
     The normalised joint distribution will be given by 
               P   ⁡     (       A   =     x   h       ,     α   =       y   j     |   D         )       :=       P   ⁡     (       A   =     x   h       ,     α   =       y   j     |   D         )           ∑   h     ⁢           ⁢       ∑   j     ⁢           ⁢       P   ⁡     (       A   =     x   h       ,     α   =       y   j     |   D         )       ⁢     m   ⁡     (       x   h     ,     y   j       )                     
where all the symbols indicate the values stored at the grid points and the assignment symbol := indicates new values to be stored in place of the old (which were only correct up to a constant of proportionality).
 
     The marginalising step 510: 4 may preferably be performed by calculating: 
     
       
         
           
             
               P 
               ⁡ 
               
                 ( 
                 
                   A 
                   = 
                   
                     
                       x 
                       h 
                     
                     | 
                     D 
                   
                 
                 ) 
               
             
             := 
             
               
                 
                   
                     ∑ 
                     j 
                   
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   
                     
                       P 
                       ⁡ 
                       
                         ( 
                         
                           
                             A 
                             = 
                             
                               x 
                               h 
                             
                           
                           , 
                           
                             α 
                             = 
                             
                               
                                 y 
                                 j 
                               
                               | 
                               D 
                             
                           
                         
                         ) 
                       
                     
                     ⁢ 
                     
                       m 
                       ⁡ 
                       
                         ( 
                         
                           
                             x 
                             h 
                           
                           , 
                           
                             y 
                             j 
                           
                         
                         ) 
                       
                     
                   
                 
                 
                   m 
                   ⁡ 
                   
                     ( 
                     
                       x 
                       h 
                     
                     ) 
                   
                 
               
               ⁢ 
               and 
             
           
         
       
       
         
           
             
               P 
               ⁡ 
               
                 ( 
                 
                   α 
                   = 
                   
                     
                       y 
                       j 
                     
                     | 
                     D 
                   
                 
                 ) 
               
             
             := 
             
               
                 
                   ∑ 
                   j 
                 
                 ⁢ 
                 
                     
                 
                 ⁢ 
                 
                   
                     P 
                     ⁡ 
                     
                       ( 
                       
                         
                           A 
                           = 
                           
                             x 
                             h 
                           
                         
                         , 
                         
                           α 
                           = 
                           
                             
                               y 
                               j 
                             
                             | 
                             D 
                           
                         
                       
                       ) 
                     
                   
                   ⁢ 
                   
                     m 
                     ⁡ 
                     
                       ( 
                       
                         
                           x 
                           h 
                         
                         , 
                         
                           y 
                           j 
                         
                       
                       ) 
                     
                   
                 
               
               
                 m 
                 ⁡ 
                 
                   ( 
                   
                     y 
                     j 
                   
                   ) 
                 
               
             
           
         
       
     
     The optional calculation of marginal means with the 5 th  and 95 th  centiles in the outputting step 520 may preferably be performed by calculating the cumulative density functions; 
               P   ⁡     (     A   ≦     x   h       )       =           ∑       h   ′     =   1     h     ⁢           ⁢       P   ⁡     (     A   =     x     h   ′         )       ⁢     m   ⁡     (     x     h   ′       )       ⁢           ⁢   and   ⁢           ⁢   find   ⁢           ⁢   greatest   ⁢           ⁢   h   ⁢           ⁢   such   ⁢           ⁢   that   ⁢           ⁢     P   ⁡     (     A   ≦     x   h       )           ≦     0.05   ⁢           ⁢   and   ⁢           ⁢     P   ⁡     (     A   ≧     x   h       )           =         ∑       h   ′     =   1     h     ⁢           ⁢       P   ⁡     (     A   =     x     h   ′         )       ⁢     m   ⁡     (     x     h   ′       )       ⁢           ⁢   and   ⁢           ⁢   find   ⁢           ⁢   least   ⁢           ⁢   h   ⁢           ⁢   such   ⁢           ⁢   that   ⁢           ⁢     P   ⁡     (     A   ≧     x   h       )           ≦   0.05             
Single Fluorophore, with Photon-Induced, Initial, and Final Deadtimes and Unknown Lifetime
 
     One of the major advantages with Bayesian inference is the possibility of introducing parameters describing e.g. equipment performance and artifacts in the analysis. The result will be the true distributions taking these parameters into account, rather than compensating a result with heuristic factors reflecting the artifacts, as in prior art. 
     Adopting the same notation as before, suppose that the detector is dead for a duration δ after each photon is received, for a duration τ after the excitation, and at all times longer than υ after excitation. Again, we must calculate the likelihood of the observed data. Let us suppose that during a excitation n, photons arrive at times t n,1 ,t n,2 , . . . , t n,K     n   , and at no other times. As before we have the likelihood on the data D n  from excitation n given by 
                 P   ⁡     (         D   n     |   A     ,   α     )       =       (       ∏     k   =   1       K   n       ⁢           ⁢     (     A   ⁢           ⁢     ⅇ       -   α     ⁢           ⁢     t     n   ,   k             )       )     ⁢     P   ⁡     (         no   ⁢           ⁢   other   ⁢           ⁢   photons     |   A     ,   α     )           ,         
since in a Poisson process all events occur independently of each other. The difference between this expression and the corresponding one is in the meaning of the phrase “no other photons”; in the preceding section it meant no other photons ever, while now it just means no other photons in the time that the detector is live.
 
     As before, this probability is 
               ⅇ     -       ∫   T     ⁢       λ   ⁡     (   t   )       ⁢           ⁢     ⅆ   t             ,         
where T now denotes the set of times at which the detector is live. We therefore have
 
               P   ⁡     (         no   ⁢           ⁢   other   ⁢           ⁢   photons     |   A     ,   α     )       =       ⅇ     -     (         ∫   r     t     n   ,   1         ⁢       λ   ⁡     (   t   )       ⁢           ⁢     ⅆ   t         +       ∑     k   =   1         K   n     -   1       ⁢           ⁢       ∫     t     n   ,   k           t     n   ,   k       +   1       ⁢       λ   ⁡     (   t   )       ⁢           ⁢     ⅆ   t           +       ∫     t     n   ,     K   n         v     ⁢       λ   ⁡     (   t   )       ⁢           ⁢     ⅆ   t           )         ≈     ⅇ     -     (         ∫   r   v     ⁢       λ   ⁡     (   t   )       ⁢           ⁢     ⅆ   t         -       ∑     k   =   1       K   n       ⁢           ⁢       ∫     t     n   ,   k           t     n   ,   k       +   δ       ⁢       λ   ⁡     (   t   )       ⁢           ⁢     ⅆ   t             )                 
where the last line follows if we make the assumption that none of the deadtimes overlap with the period following υ. Thus
 
                       P   ⁡     (         no   ⁢           ⁢   other   ⁢           ⁢   photons     |   A     ,   α     )       ⁢       ≈     ⅇ     -     (         ∫   r   v     ⁢       λ   ⁡     (   t   )       ⁢           ⁢     ⅆ   t         -       ∑     k   =   1       K   n       ⁢           ⁢       ∫     t     n   ,   k           t     n   ,   k       +   δ       ⁢       λ   ⁡     (   t   )       ⁢           ⁢     ⅆ   t             )           ⁢     
     ⁢           =     ⅇ     -     (         ∫   r   v     ⁢     A   ⁢           ⁢     ⅇ       -   α     ⁢           ⁢   t       ⁢           ⁢     ⅆ   t         -       ∑     k   =   1       K   n       ⁢           ⁢       ∫     t     n   ,   k           t     n   ,   k       +   δ       ⁢     A   ⁢           ⁢     ⅇ       -   α     ⁢           ⁢   t       ⁢           ⁢     ⅆ   t             )                         ⁢     =       ⅇ       A   α     ⁢     (         [     ⅇ       -   α     ⁢           ⁢   t       ]     r   v     -       ∑     k   =   1       K   n       ⁢           ⁢       [     ⅇ       -   α     ⁢           ⁢   t       ]       n   ,   k       n   ,     k     +   δ               )         ⁢     
     =     ⅇ       -     A   α       ⁢     (       (       ⅇ       -   α     ⁢           ⁢   τ       -     e       -   α     ⁢           ⁢   v         )     -       ∑     k   =   1       K   n       ⁢           ⁢     (       ⅇ       -   α     ⁢           ⁢     t     n   ,   k           -     ⅇ     -     α   ⁡     (       t     n   ,   k       +   δ     )             )         )                             ⁢     =       ⅇ       -     A   α       ⁢     (       (       ⅇ       -   α     ⁢           ⁢   τ       -     ⅇ       -   α     ⁢           ⁢   v         )     -       ∑     k   =   1       K   n       ⁢           ⁢     (     ⅇ       -   α     ⁢           ⁢       t     n   ,   k       ⁡     (     1   -     ⅇ     -   αδ         )           )         )         ⁢     
     =     ⅇ       -     A   α       ⁢     (       (       ⅇ       -   α     ⁢           ⁢   τ       -     ⅇ       -   α     ⁢           ⁢   v         )     -       (     1   -     ⅇ     -   αδ         )     ⁢       ∑     k   =   1       K   n       ⁢     ⅇ       -   α     ⁢           ⁢     t     n   ,   k                 )                         
so combining all the data from N excitations together (independent from excitation to excitation), we have
 
     
       
         
           
             
               
                 
                   
                     P 
                     ⁡ 
                     
                       ( 
                       
                         
                           D 
                           ⁢ 
                           
                             | 
                           
                           ⁢ 
                           A 
                         
                         , 
                         α 
                       
                       ) 
                     
                   
                   = 
                   
                     
                       ∏ 
                       
                         n 
                         = 
                         1 
                       
                       N 
                     
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     
                       ( 
                       
                         
                           ( 
                           
                             
                               ∏ 
                               
                                 k 
                                 = 
                                 1 
                               
                               
                                 K 
                                 n 
                               
                             
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               ( 
                               
                                 A 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   ⅇ 
                                   
                                     
                                       - 
                                       α 
                                     
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     
                                       t 
                                       
                                         n 
                                         , 
                                         k 
                                       
                                     
                                   
                                 
                               
                               ) 
                             
                           
                           ) 
                         
                         ⁢ 
                         
                           ⅇ 
                           
                             
                               - 
                               
                                 A 
                                 α 
                               
                             
                             ⁢ 
                             
                               ( 
                               
                                 
                                   ( 
                                   
                                     
                                       ⅇ 
                                       
                                         
                                           - 
                                           α 
                                         
                                         ⁢ 
                                         
                                             
                                         
                                         ⁢ 
                                         τ 
                                       
                                     
                                     - 
                                     
                                       ⅇ 
                                       
                                         
                                           - 
                                           α 
                                         
                                         ⁢ 
                                         
                                             
                                         
                                         ⁢ 
                                         v 
                                       
                                     
                                   
                                   ) 
                                 
                                 - 
                                 
                                   
                                     ( 
                                     
                                       1 
                                       - 
                                       
                                         ⅇ 
                                         
                                           
                                             - 
                                             α 
                                           
                                           ⁢ 
                                           
                                               
                                           
                                           ⁢ 
                                           δ 
                                         
                                       
                                     
                                     ) 
                                   
                                   ⁢ 
                                   
                                     
                                       ∑ 
                                       
                                         k 
                                         = 
                                         1 
                                       
                                       
                                         K 
                                         n 
                                       
                                     
                                     ⁢ 
                                     
                                       ⅇ 
                                       
                                         
                                           - 
                                           α 
                                         
                                         ⁢ 
                                         
                                             
                                         
                                         ⁢ 
                                         
                                           t 
                                           
                                             n 
                                             , 
                                             k 
                                           
                                         
                                       
                                     
                                   
                                 
                               
                               ) 
                             
                           
                         
                       
                       ) 
                     
                   
                 
               
             
             
               
                 
                   = 
                   
                     
                       A 
                       K 
                     
                     ⁢ 
                     
                       
                         ⅇ 
                         
                           
                             - 
                             
                               α 
                               ⁡ 
                               
                                 ( 
                                 
                                   
                                     ∑ 
                                     
                                       n 
                                       = 
                                       1 
                                     
                                     N 
                                   
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   
                                     
                                       ∑ 
                                       
                                         k 
                                         = 
                                         1 
                                       
                                       
                                         K 
                                         n 
                                       
                                     
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     
                                       t 
                                       
                                         n 
                                         , 
                                         k 
                                       
                                     
                                   
                                 
                                 ) 
                               
                             
                           
                           - 
                           
                             
                               A 
                               α 
                             
                             ⁢ 
                             
                               ( 
                               
                                 
                                   N 
                                   ⁡ 
                                   
                                     ( 
                                     
                                       
                                         ⅇ 
                                         
                                           
                                             - 
                                             α 
                                           
                                           ⁢ 
                                           
                                               
                                           
                                           ⁢ 
                                           τ 
                                         
                                       
                                       - 
                                       
                                         ⅇ 
                                         
                                           
                                             - 
                                             α 
                                           
                                           ⁢ 
                                           
                                               
                                           
                                           ⁢ 
                                           v 
                                         
                                       
                                     
                                     ) 
                                   
                                 
                                 - 
                                 
                                   
                                     ( 
                                     
                                       1 
                                       - 
                                       
                                         ⅇ 
                                         
                                           
                                             - 
                                             α 
                                           
                                           ⁢ 
                                           
                                               
                                           
                                           ⁢ 
                                           δ 
                                         
                                       
                                     
                                     ) 
                                   
                                   ⁢ 
                                   
                                     
                                       ∑ 
                                       
                                         n 
                                         = 
                                         1 
                                       
                                       N 
                                     
                                     ⁢ 
                                     
                                       
                                         ∑ 
                                         
                                           k 
                                           = 
                                           1 
                                         
                                         
                                           K 
                                           n 
                                         
                                       
                                       ⁢ 
                                       
                                         ⅇ 
                                         
                                           
                                             - 
                                             α 
                                           
                                           ⁢ 
                                           
                                               
                                           
                                           ⁢ 
                                           
                                             t 
                                             
                                               n 
                                               , 
                                               k 
                                             
                                           
                                         
                                       
                                     
                                   
                                 
                               
                               ) 
                             
                           
                         
                       
                       . 
                     
                   
                 
               
             
           
         
       
     
     Now, applying Bayes&#39; theorem to determine the posterior, we find that 
                     P   ⁡     (     A   ,     α   ❘   D       )       =             P   ⁡     (     A   ,   α     )       ⁢     P   ⁡     (       D   ❘   A     ,   α     )           ∫       P   ⁡     (     A   ,   α     )       ⁢     P   ⁡     (       D   ❘   A     ,   α     )       ⁢     ⅆ   A     ⁢           ⁢     ⅆ   α           ∝           r   A     m   A       ⁢     A       m   A     -   1       ⁢     ⅇ       -     r   A       ⁢   A           Γ   ⁡     (     m   A     )         ⁢         r   α     m   α       ⁢     α       m   α     -   1       ⁢     ⅇ       -     r   α       ⁢   α           Γ   ⁡     (     m   α     )         ⁢     A   K     ⁢     ⅇ       -     α   ⁡     (       ∑     n   =   1     N     ⁢       ∑     k   =   1       K   n       ⁢     t     n   ,   k           )         -       A   α     ⁢     (       N   ⁡     (       ⅇ     -   ατ       -     ⅇ     -   αυ         )       -       (     1   -     ⅇ     -   αδ         )     ⁢       ∑     n   =   1     N     ⁢       ∑     k   =   1       K   n       ⁢     ⅇ       -   α     ⁢           ⁢     t     n   ,   k                   )             ∝       A       m   A     -   1       ⁢     ⅇ       -     r   A       ⁢   A       ⁢     α       m   α     -   1       ⁢     ⅇ       -     r   α       ⁢   α       ⁢     A   K     ⁢     ⅇ       -     α   ⁡     (       ∑     n   =   1     N     ⁢       ∑     k   =   1       K   n       ⁢     t     n   ,   k           )         -       A   α     ⁢     (       N   ⁡     (       ⅇ     -   ατ       -     ⅇ     -   αυ         )       -       (     1   -     ⅇ     -   αδ         )     ⁢       ∑     n   =   1     N     ⁢       ∑     k   =   1       K   n       ⁢     ⅇ       -   α     ⁢           ⁢     t     n   ,   k                   )               =       A     K   +     m   A     -   1       ⁢     α       m   α     -   1       ⁢     ⅇ     -     A   ⁡     (       r   A     +       1   α     ⁢     (       N   ⁡     (       ⅇ     -   ατ       -     ⅇ     -   αυ         )       -       (     1   -     ⅇ     -   αδ         )     ⁢       ∑     n   =   1     N     ⁢       ∑     k   =   1       K   n       ⁢     ⅇ       -   α     ⁢           ⁢     t     n   ,   k                   )         )           ⁢     ⅇ     -     α   ⁡     (       r   α     +       ∑     n   =   1     N     ⁢       ∑     k   =   1       K   n       ⁢     t     n   ,   k             )                       Equation   ⁢           ⁢   11               
and hence
 
                             P   ⁡     (     α   |   D     )       ⁢       =     ∫       P   ⁡     (     A   ,     α   |   D       )       ⁢     ⅆ   A                         ⁢     ∝     ∫       A     K   +     m   A     -   1       ⁢     α       m   α     -   1       ⁢     ⅇ     -     A   ⁡     (       r   A     +       1   α     ⁢     (       N   ⁡     (       ⅇ     -   ατ       -     ⅇ       -   α     ⁢           ⁢   v         )       -       (     1   -     ⅇ     -   αδ         )     ⁢       ∑     n   =   1     N     ⁢           ⁢       ∑     k   =   1       K   n       ⁢           ⁢     ⅇ       -   α     ⁢           ⁢     t     n   ,   k                   )         )           ⁢     ⅇ     -     α   ⁡     (       r   α     +       ∑     n   =   1     N     ⁢           ⁢       ∑     k   =   1       K   n       ⁢           ⁢     t     n   ,   k             )           ⁢     ⅆ   A                           ⁢     =       α       m   α     -   1       ⁢     ⅇ     -     α   ⁡     (       r   α     +       ∑     n   =   1     N     ⁢           ⁢       ∑     k   =   1       K   n       ⁢           ⁢     t     n   ,   k             )           ⁢     ∫       A     K   +     m   A     -   1       ⁢     ⅇ     -     A   ⁡     (       r   A     +       1   α     ⁢     (       N   ⁡     (       ⅇ     -   ατ       -     ⅇ       -   α     ⁢           ⁢   v         )       -       (     1   -     ⅇ     -   αδ         )     ⁢       ∑     n   =   1     N     ⁢           ⁢       ∑     k   =   1       K   n       ⁢           ⁢     ⅇ       -   α     ⁢           ⁢     t     n   ,   k                   )         )           ⁢     ⅆ   A                             ⁢     =         α       m   α     -   1       ⁢     ⅇ     -     α   ⁡     (       r   α     +       ∑     n   =   1     N     ⁢           ⁢       ∑     k   =   1       K   n       ⁢           ⁢     t     n   ,   k             )           ⁢     Γ   ⁡     (     K   +     m   A       )             (       r   A     +       1   α     ⁢     (       N   ⁡     (       ⅇ     -   ατ       -     ⅇ       -   α     ⁢           ⁢   v         )       -       (     1   -     ⅇ     -   αδ         )     ⁢       ∑     n   =   1     N     ⁢           ⁢       ∑     k   =   1       K   n       ⁢           ⁢     ⅇ       -   α     ⁢           ⁢     t     n   ,   k                   )         )       K   +     m   A                     ⁢     
     ⁢   while           Equation   ⁢           ⁢   12                   P   ⁡     (       A   |   α     ,   D     )       =         q     K   +     m   A           Γ   ⁡     (     K   +     m   A       )         ⁢     A     K   +     m   A     -   1       ⁢     ⅇ     -   Aq           ⁢     
     ⁢   where   ⁢     
     ⁢     q   =       r   A     +       1   α     ⁢     (       N   ⁡     (       ⅇ     -   ατ       -     ⅇ       -   α     ⁢           ⁢   v         )       -       (     1   -     ⅇ     -   αδ         )     ⁢       ∑     n   =   1     N     ⁢           ⁢       ∑     k   =   1       K   n       ⁢           ⁢     ⅇ       -   α     ⁢           ⁢     t     n   ,   k                   )                   Equation   ⁢           ⁢   13               
so that again the conditional posterior distribution for A given a is a Gamma distribution.
 
     With a slight modification algorithm A1 can still be used: 
     In step 510: 2 P(A,α|D) will instead of equation 8 be given by equation 11 taking into account the various deadtimes:
     520: Calculate   

               P   ⁡     (     A   ,     α   |   D       )       ∝       A     K   +     m   A     -   1       ⁢     α       m   α     -   1       ⁢     ⅇ     -     A   ⁡     (       r   A     +       1   α     ⁢     (       N   ⁡     (       ⅇ     -   ατ       -     ⅇ       -   α     ⁢           ⁢   v         )       -       (     1   -     ⅇ     -   αδ         )     ⁢       ∑     n   =   1     N     ⁢           ⁢       ∑     k   =   1       K   n       ⁢           ⁢     ⅇ       -   α     ⁢           ⁢     t     n   ,   k                   )         )           ⁢     ⅇ     -     α   ⁡     (       r   α     +       ∑     n   =   1     N     ⁢           ⁢       ∑     k   =   1       K   n       ⁢           ⁢     t     n   ,   k             )                   
Algorithm A2, Multiple Fluorophores, Unknown Fluorophore Lifetimes, with Deadtimes.
 
     Now we repeat the analysis, introducing the remaining complication that there are several fluorophores, with parameters given by A i , α i  for i=1, . . . , I. The deadtimes are independent of which fluorophores the photon came from. 
     We then have 
                 P   ⁡     (         D   n     |   A     ,   α     )       =       (       ∏     k   =   1       K   n       ⁢           ⁢     (       ∏     i   =   1     I     ⁢           ⁢       A   i     ⁢     ⅇ       -     α   i       ⁢     t     n   ,   k               )       )     ⁢     P   ⁡     (         no   ⁢           ⁢   other   ⁢           ⁢   photons     |   A     ,   α     )           ,         
where A denotes the vector of the A i s, and α denotes the vector of α i s. As before, we have
 
               P   ⁡     (         no   ⁢           ⁢   other   ⁢           ⁢   photons     |   A     ,   α     )       =       ⅇ     -     (         ∫   r     t     n   ,   1         ⁢       λ   ⁡     (   t   )       ⁢           ⁢     ⅆ   t         +       ∑     k   =   1         K   n     -   1       ⁢           ⁢       ∫     t     n   ,   k         t     n   ,     k   +   1           ⁢       λ   ⁡     (   t   )       ⁢           ⁢     ⅆ   t           +       ∫     t     n   ,     K   n         v     ⁢       λ   ⁡     (   t   )       ⁢           ⁢     ⅆ   t           )         ≈     ⅇ     -     (         ∫   r   v     ⁢       λ   ⁡     (   t   )       ⁢           ⁢     ⅆ   t         -       ∑     k   =   1       K   n       ⁢           ⁢       ∫     t     n   ,   k           t     n   ,   k       +   δ       ⁢       λ   ⁡     (   t   )       ⁢           ⁢     ⅆ   t             )                 
where the last line follows if we make the assumption that none of the deadtimes overlap with the period following υ. Thus
 
                       P   ⁡     (         no   ⁢           ⁢   other   ⁢           ⁢   photons     |   A     ,   α     )       ⁢       ≈     ⅇ     -     (         ∫   r   v     ⁢       λ   ⁡     (   t   )       ⁢           ⁢     ⅆ   t         -       ∑     k   =   1       K   n       ⁢           ⁢       ∫     t     n   ,   k           t     n   ,   k       +   δ       ⁢       λ   ⁡     (   t   )       ⁢           ⁢     ⅆ   t             )           ⁢     
     ⁢           =     ⅇ     -     (         ∫   r   v     ⁢       ∑     i   =   1     I     ⁢           ⁢       A   i     ⁢     ⅇ       -     α   i       ⁢   t       ⁢           ⁢     ⅆ   t           -       ∑     k   =   1       K   n       ⁢           ⁢       ∫     t     n   ,   k           t     n   ,   k       +   δ       ⁢       ∑     i   =   1     I     ⁢           ⁢       A   i     ⁢     ⅇ       -     α   i       ⁢   t       ⁢           ⁢     ⅆ   t               )                         ⁢     =       ⅇ       ∑     i   =   1     I     ⁢           ⁢         A   i       α   i       ⁢     (         [     ⅇ       -     α   i       ⁢   t       ]     r   v     -       ∑     k   =   1       K   n       ⁢           ⁢       [     ⅇ       -     α   i       ⁢   T       ]       r     k   ,   n           v     n   ,   k       +   δ           )           ⁢     
     ⁢           =     ⅇ     -       ∑     i   =   1     I     ⁢           ⁢         A   i       α   i       ⁢     (       (       ⅇ       -     α   i       ⁢   τ       -     ⅇ       -     α   i       ⁢   v         )     -       ∑     k   =   1       K   n       ⁢           ⁢     (       ⅇ       -     α   i       ⁢     t     n   ,   k           -     ⅇ     -       α   i     ⁡     (       t     n   ,   k       +   δ     )             )         )                                 ⁢     =       ⅇ     -       ∑     i   =   1     I     ⁢           ⁢         A   i       α   i       ⁢     (       (       ⅇ       -     α   i       ⁢   τ       -     ⅇ       -     α   i       ⁢   v         )     -       ∑     k   =   1       K   n       ⁢           ⁢     (     ⅇ       -     α   i       ⁢       t     n   ,   k       ⁡     (     1   -     ⅇ       -     α   i       ⁢   δ         )           )         )             ⁢     
     ⁢           =     ⅇ     -       ∑     i   =   1     I     ⁢           ⁢         A   i       α   i       ⁢     (       (       ⅇ       -     α   i       ⁢   τ       -     ⅇ       -     α   i       ⁢   v         )     -       (     1   -     ⅇ       -     α   i       ⁢   δ         )     ⁢       ∑     k   =   1       K   n       ⁢           ⁢     ⅇ       -     α   i       ⁢     t     n   ,   k                 )                             
so combining all the data from N excitations together (independent from excitation to excitation), we have
 
     
       
         
           
             
               
                 
                   
                     P 
                     ⁡ 
                     
                       ( 
                       
                         
                           D 
                           | 
                           A 
                         
                         , 
                         α 
                       
                       ) 
                     
                   
                   ⁢ 
                     
                   = 
                   
                     
                       ∏ 
                       
                         n 
                         = 
                         1 
                       
                       N 
                     
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     
                       ( 
                       
                         
                           ( 
                           
                             
                               ∏ 
                               
                                 k 
                                 = 
                                 1 
                               
                               
                                 K 
                                 n 
                               
                             
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               ( 
                               
                                 
                                   ∑ 
                                   
                                     i 
                                     = 
                                     1 
                                   
                                   I 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   
                                     A 
                                     i 
                                   
                                   ⁢ 
                                   
                                     ⅇ 
                                     
                                       
                                         - 
                                         
                                           α 
                                           i 
                                         
                                       
                                       ⁢ 
                                       
                                         t 
                                         
                                           n 
                                           , 
                                           k 
                                         
                                       
                                     
                                   
                                 
                               
                               ) 
                             
                           
                           ) 
                         
                         ⁢ 
                         
                           ⅇ 
                           
                             - 
                             
                               
                                 ∑ 
                                 
                                   i 
                                   = 
                                   1 
                                 
                                 I 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 
                                   
                                     A 
                                     i 
                                   
                                   
                                     α 
                                     i 
                                   
                                 
                                 ⁢ 
                                 
                                   ( 
                                   
                                     
                                       ( 
                                       
                                         
                                           e 
                                           
                                             
                                               - 
                                               
                                                 α 
                                                 i 
                                               
                                             
                                             ⁢ 
                                             τ 
                                           
                                         
                                         - 
                                         
                                           ⅇ 
                                           
                                             
                                               - 
                                               
                                                 α 
                                                 i 
                                               
                                             
                                             ⁢ 
                                             v 
                                           
                                         
                                       
                                       ) 
                                     
                                     - 
                                     
                                       
                                         ( 
                                         
                                           1 
                                           - 
                                           
                                             ⅇ 
                                             
                                               
                                                 - 
                                                 
                                                   α 
                                                   i 
                                                 
                                               
                                               ⁢ 
                                               δ 
                                             
                                           
                                         
                                         ) 
                                       
                                       ⁢ 
                                       
                                         
                                           ∑ 
                                           
                                             k 
                                             = 
                                             1 
                                           
                                           
                                             K 
                                             n 
                                           
                                         
                                         ⁢ 
                                         
                                             
                                         
                                         ⁢ 
                                         
                                           ⅇ 
                                           
                                             
                                               - 
                                               
                                                 α 
                                                 i 
                                               
                                             
                                             ⁢ 
                                             
                                               t 
                                               
                                                 n 
                                                 , 
                                                 k 
                                               
                                             
                                           
                                         
                                       
                                     
                                   
                                   ) 
                                 
                               
                             
                           
                         
                       
                       ) 
                     
                   
                 
               
             
             
               
                 
                     
                   ⁢ 
                   
                     = 
                     
                       
                         ( 
                         
                           
                             ∏ 
                             
                               n 
                               = 
                               1 
                             
                             N 
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             
                               ∏ 
                               
                                 k 
                                 = 
                                 1 
                               
                               
                                 K 
                                 n 
                               
                             
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               
                                 ∑ 
                                 
                                   i 
                                   = 
                                   1 
                                 
                                 I 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 
                                   A 
                                   i 
                                 
                                 ⁢ 
                                 
                                   ⅇ 
                                   
                                     
                                       - 
                                       
                                         α 
                                         i 
                                       
                                     
                                     ⁢ 
                                     
                                       t 
                                       
                                         n 
                                         , 
                                         k 
                                       
                                     
                                   
                                 
                               
                             
                           
                         
                         ) 
                       
                       ⁢ 
                       
                         ⅇ 
                         
                           - 
                           
                             
                               ∑ 
                               
                                 n 
                                 = 
                                 1 
                               
                               N 
                             
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               
                                 ∑ 
                                 
                                   i 
                                   = 
                                   1 
                                 
                                 I 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 
                                   
                                     A 
                                     i 
                                   
                                   
                                     α 
                                     i 
                                   
                                 
                                 ⁢ 
                                 
                                   ( 
                                   
                                     
                                       ( 
                                       
                                         
                                           ⅇ 
                                           
                                             
                                               - 
                                               
                                                 α 
                                                 i 
                                               
                                             
                                             ⁢ 
                                             τ 
                                           
                                         
                                         - 
                                         
                                           ⅇ 
                                           
                                             
                                               - 
                                               
                                                 α 
                                                 i 
                                               
                                             
                                             ⁢ 
                                             v 
                                           
                                         
                                       
                                       ) 
                                     
                                     - 
                                     
                                       
                                         ( 
                                         
                                           1 
                                           - 
                                           
                                             ⅇ 
                                             
                                               
                                                 - 
                                                 
                                                   α 
                                                   i 
                                                 
                                               
                                               ⁢ 
                                               δ 
                                             
                                           
                                         
                                         ) 
                                       
                                       ⁢ 
                                       
                                         
                                           ∑ 
                                           
                                             k 
                                             = 
                                             1 
                                           
                                           
                                             K 
                                             n 
                                           
                                         
                                         ⁢ 
                                         
                                             
                                         
                                         ⁢ 
                                         
                                           e 
                                           
                                             
                                               - 
                                               
                                                 α 
                                                 i 
                                               
                                             
                                             ⁢ 
                                             
                                               t 
                                               
                                                 n 
                                                 , 
                                                 k 
                                               
                                             
                                           
                                         
                                       
                                     
                                   
                                   ) 
                                 
                               
                             
                           
                         
                       
                     
                   
                 
               
             
             
               
                 
                     
                   ⁢ 
                   
                     = 
                     
                       
                         ( 
                         
                           
                             ∏ 
                             
                               n 
                               = 
                               1 
                             
                             N 
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             
                               ∏ 
                               
                                 k 
                                 = 
                                 1 
                               
                               
                                 K 
                                 n 
                               
                             
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               
                                 ∑ 
                                 
                                   i 
                                   = 
                                   1 
                                 
                                 I 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 
                                   A 
                                   i 
                                 
                                 ⁢ 
                                 
                                   ⅇ 
                                   
                                     
                                       - 
                                       
                                         α 
                                         i 
                                       
                                     
                                     ⁢ 
                                     
                                       t 
                                       
                                         n 
                                         , 
                                         k 
                                       
                                     
                                   
                                 
                               
                             
                           
                         
                         ) 
                       
                       ⁢ 
                       
                         
                           ⅇ 
                           
                             
                               
                                 - 
                                 N 
                               
                               ⁢ 
                               
                                 
                                   ∑ 
                                   
                                     i 
                                     = 
                                     1 
                                   
                                   I 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   
                                     
                                       A 
                                       i 
                                     
                                     
                                       α 
                                       i 
                                     
                                   
                                   ⁢ 
                                   
                                     ( 
                                     
                                       
                                         ⅇ 
                                         
                                           
                                             - 
                                             
                                               α 
                                               i 
                                             
                                           
                                           ⁢ 
                                           τ 
                                         
                                       
                                       - 
                                       
                                         ⅇ 
                                         
                                           
                                             - 
                                             
                                               α 
                                               i 
                                             
                                           
                                           ⁢ 
                                           v 
                                         
                                       
                                     
                                     ) 
                                   
                                 
                               
                             
                             + 
                             
                               
                                 ∑ 
                                 
                                   i 
                                   = 
                                   1 
                                 
                                 I 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 ( 
                                 
                                   
                                     
                                       A 
                                       i 
                                     
                                     
                                       α 
                                       i 
                                     
                                   
                                   ⁢ 
                                   
                                     ( 
                                     
                                       1 
                                       - 
                                       
                                         ⅇ 
                                         
                                           
                                             - 
                                             
                                               α 
                                               i 
                                             
                                           
                                           ⁢ 
                                           δ 
                                         
                                       
                                     
                                     ) 
                                   
                                   ⁢ 
                                   
                                     
                                       ∑ 
                                       
                                         n 
                                         = 
                                         1 
                                       
                                       N 
                                     
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     
                                       
                                         ∑ 
                                         
                                           k 
                                           = 
                                           1 
                                         
                                         
                                           K 
                                           n 
                                         
                                       
                                       ⁢ 
                                       
                                           
                                       
                                       ⁢ 
                                       
                                         ⅇ 
                                         
                                           
                                             - 
                                             
                                               α 
                                               i 
                                             
                                           
                                           ⁢ 
                                           
                                             t 
                                             
                                               n 
                                               , 
                                               k 
                                             
                                           
                                         
                                       
                                     
                                   
                                 
                                 ) 
                               
                             
                           
                         
                         . 
                       
                     
                   
                 
               
             
           
         
       
     
     Now, applying Bayes&#39; theorem to determine the posterior, we find that 
     
       
         
           
             
               
                 
                   
                     
                       
                         
                           P 
                           ⁡ 
                           
                             ( 
                             
                               A 
                               , 
                               
                                 α 
                                 | 
                                 D 
                               
                             
                             ) 
                           
                         
                         ⁢ 
                           
                         = 
                         
                           
                             
                               P 
                               ⁡ 
                               
                                 ( 
                                 
                                   A 
                                   , 
                                   α 
                                 
                                 ) 
                               
                             
                             ⁢ 
                             
                               P 
                               ⁡ 
                               
                                 ( 
                                 
                                   
                                     D 
                                     | 
                                     A 
                                   
                                   , 
                                   α 
                                 
                                 ) 
                               
                             
                           
                           
                             ∫ 
                             
                               
                                 P 
                                 ⁡ 
                                 
                                   ( 
                                   
                                     A 
                                     , 
                                     α 
                                   
                                   ) 
                                 
                               
                               ⁢ 
                               
                                 P 
                                 ⁡ 
                                 
                                   ( 
                                   
                                     
                                       D 
                                       | 
                                       A 
                                     
                                     , 
                                     α 
                                   
                                   ) 
                                 
                               
                               ⁢ 
                               
                                 ⅆ 
                                 A 
                               
                               ⁢ 
                               
                                 ⅆ 
                                 α 
                               
                             
                           
                         
                       
                     
                   
                   
                     
                       
                           
                         ⁢ 
                         
                           ∝ 
                           
                             
                               ∏ 
                               
                                 i 
                                 = 
                                 1 
                               
                               I 
                             
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               
                                 
                                   
                                     r 
                                     
                                       A 
                                       i 
                                     
                                     
                                       m 
                                       
                                         A 
                                         i 
                                       
                                     
                                   
                                   ⁢ 
                                   
                                     A 
                                     i 
                                     
                                       
                                         m 
                                         
                                           A 
                                           i 
                                         
                                       
                                       - 
                                       1 
                                     
                                   
                                   ⁢ 
                                   
                                     ⅇ 
                                     
                                       
                                         - 
                                         
                                           r 
                                           
                                             A 
                                             i 
                                           
                                         
                                       
                                       ⁢ 
                                       
                                         A 
                                         i 
                                       
                                     
                                   
                                 
                                 
                                   Γ 
                                   ⁡ 
                                   
                                     ( 
                                     
                                       m 
                                       
                                         A 
                                         i 
                                       
                                     
                                     ) 
                                   
                                 
                               
                               ⁢ 
                               
                                 
                                   ∏ 
                                   
                                     i 
                                     = 
                                     1 
                                   
                                   I 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   
                                     
                                       r 
                                       
                                         α 
                                         i 
                                       
                                       
                                         m 
                                         
                                           α 
                                           i 
                                         
                                       
                                     
                                     ⁢ 
                                     
                                       α 
                                       i 
                                       
                                         
                                           m 
                                           
                                             α 
                                             i 
                                           
                                         
                                         - 
                                         1 
                                       
                                     
                                     ⁢ 
                                     
                                       ⅇ 
                                       
                                         
                                           - 
                                           
                                             r 
                                             
                                               α 
                                               i 
                                             
                                           
                                         
                                         ⁢ 
                                         
                                           α 
                                           i 
                                         
                                       
                                     
                                   
                                   
                                     Γ 
                                     ⁡ 
                                     
                                       ( 
                                       
                                         m 
                                         
                                           α 
                                           i 
                                         
                                       
                                       ) 
                                     
                                   
                                 
                               
                             
                           
                         
                       
                     
                   
                   
                     
                       
                           
                         ⁢ 
                         
                           
                             ( 
                             
                               
                                 ∏ 
                                 
                                   n 
                                   = 
                                   1 
                                 
                                 N 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 
                                   ∏ 
                                   
                                     k 
                                     = 
                                     1 
                                   
                                   
                                     K 
                                     n 
                                   
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   
                                     ∑ 
                                     
                                       i 
                                       = 
                                       1 
                                     
                                     I 
                                   
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   
                                     
                                       A 
                                       i 
                                     
                                     ⁢ 
                                     
                                       ⅇ 
                                       
                                         
                                           - 
                                           
                                             α 
                                             i 
                                           
                                         
                                         ⁢ 
                                         
                                           t 
                                           
                                             n 
                                             , 
                                             k 
                                           
                                         
                                       
                                     
                                   
                                 
                               
                             
                             ) 
                           
                           ⁢ 
                           
                             ⅇ 
                             
                               
                                 
                                   - 
                                   N 
                                 
                                 ⁢ 
                                 
                                   
                                     ∑ 
                                     
                                       i 
                                       = 
                                       1 
                                     
                                     I 
                                   
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   
                                     
                                       
                                         A 
                                         i 
                                       
                                       
                                         α 
                                         i 
                                       
                                     
                                     ⁢ 
                                     
                                       ( 
                                       
                                         
                                           ⅇ 
                                           
                                             
                                               - 
                                               
                                                 α 
                                                 i 
                                               
                                             
                                             ⁢ 
                                             τ 
                                           
                                         
                                         - 
                                         
                                           ⅇ 
                                           
                                             
                                               - 
                                               
                                                 α 
                                                 i 
                                               
                                             
                                             ⁢ 
                                             v 
                                           
                                         
                                       
                                       ) 
                                     
                                   
                                 
                               
                               + 
                               
                                 
                                   ∑ 
                                   
                                     i 
                                     = 
                                     1 
                                   
                                   I 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   ( 
                                   
                                     
                                       
                                         A 
                                         i 
                                       
                                       
                                         α 
                                         i 
                                       
                                     
                                     ⁢ 
                                     
                                       ( 
                                       
                                         1 
                                         - 
                                         
                                           ⅇ 
                                           
                                             
                                               - 
                                               
                                                 α 
                                                 i 
                                               
                                             
                                             ⁢ 
                                             δ 
                                           
                                         
                                       
                                       ) 
                                     
                                     ⁢ 
                                     
                                       
                                         ∑ 
                                         
                                           n 
                                           = 
                                           1 
                                         
                                         N 
                                       
                                       ⁢ 
                                       
                                           
                                       
                                       ⁢ 
                                       
                                         
                                           ∑ 
                                           
                                             k 
                                             = 
                                             1 
                                           
                                           
                                             K 
                                             n 
                                           
                                         
                                         ⁢ 
                                         
                                             
                                         
                                         ⁢ 
                                         
                                           ⅇ 
                                           
                                             
                                               - 
                                               
                                                 α 
                                                 i 
                                               
                                             
                                             ⁢ 
                                             
                                               t 
                                               
                                                 n 
                                                 , 
                                                 k 
                                               
                                             
                                           
                                         
                                       
                                     
                                   
                                   ) 
                                 
                               
                             
                           
                         
                       
                     
                   
                   
                     
                       
                           
                         ⁢ 
                         
                           ∝ 
                           
                             
                               ( 
                               
                                 
                                   ∏ 
                                   
                                     i 
                                     = 
                                     1 
                                   
                                   I 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   
                                     A 
                                     i 
                                     
                                       
                                         m 
                                         
                                           A 
                                           i 
                                         
                                       
                                       - 
                                       1 
                                     
                                   
                                   ⁢ 
                                   
                                     α 
                                     i 
                                     
                                       
                                         m 
                                         
                                           α 
                                           i 
                                         
                                       
                                       - 
                                       1 
                                     
                                   
                                 
                               
                               ) 
                             
                             ⁢ 
                             
                               ( 
                               
                                 
                                   ∏ 
                                   
                                     n 
                                     = 
                                     1 
                                   
                                   N 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   
                                     ∏ 
                                     
                                       k 
                                       = 
                                       1 
                                     
                                     
                                       K 
                                       n 
                                     
                                   
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   
                                     
                                       ∑ 
                                       
                                         i 
                                         = 
                                         1 
                                       
                                       I 
                                     
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     
                                       
                                         A 
                                         i 
                                       
                                       ⁢ 
                                       
                                         ⅇ 
                                         
                                           
                                             - 
                                             
                                               α 
                                               i 
                                             
                                           
                                           ⁢ 
                                           
                                             t 
                                             
                                               n 
                                               , 
                                               k 
                                             
                                           
                                         
                                       
                                     
                                   
                                 
                               
                               ) 
                             
                           
                         
                       
                     
                   
                   
                     
                       
                           
                         ⁢ 
                         
                           ⅇ 
                           
                             
                               - 
                               
                                 
                                   ∑ 
                                   
                                     i 
                                     = 
                                     1 
                                   
                                   I 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   
                                     r 
                                     
                                       A 
                                       i 
                                     
                                   
                                   ⁢ 
                                   
                                     A 
                                     i 
                                   
                                 
                               
                             
                             - 
                             
                               
                                 ∑ 
                                 
                                   i 
                                   = 
                                   1 
                                 
                                 I 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 
                                   r 
                                   
                                     α 
                                     i 
                                   
                                 
                                 ⁢ 
                                 
                                   α 
                                   i 
                                 
                               
                             
                             - 
                             
                               N 
                               ⁢ 
                               
                                 
                                   ∑ 
                                   
                                     i 
                                     = 
                                     1 
                                   
                                   I 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   
                                     
                                       A 
                                       i 
                                     
                                     
                                       α 
                                       i 
                                     
                                   
                                   ⁢ 
                                   
                                     ( 
                                     
                                       
                                         ⅇ 
                                         
                                           
                                             - 
                                             
                                               α 
                                               i 
                                             
                                           
                                           ⁢ 
                                           τ 
                                         
                                       
                                       - 
                                       
                                         ⅇ 
                                         
                                           
                                             - 
                                             
                                               α 
                                               i 
                                             
                                           
                                           ⁢ 
                                           v 
                                         
                                       
                                     
                                     ) 
                                   
                                 
                               
                             
                             + 
                             
                               
                                 ∑ 
                                 
                                   i 
                                   = 
                                   1 
                                 
                                 I 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 ( 
                                 
                                   
                                     
                                       A 
                                       i 
                                     
                                     
                                       α 
                                       i 
                                     
                                   
                                   ⁢ 
                                   
                                     ( 
                                     
                                       1 
                                       - 
                                       
                                         ⅇ 
                                         
                                           
                                             - 
                                             
                                               α 
                                               i 
                                             
                                           
                                           ⁢ 
                                           δ 
                                         
                                       
                                     
                                     ) 
                                   
                                   ⁢ 
                                   
                                     
                                       ∑ 
                                       
                                         n 
                                         = 
                                         1 
                                       
                                       N 
                                     
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     
                                       
                                         ∑ 
                                         
                                           k 
                                           = 
                                           1 
                                         
                                         
                                           K 
                                           n 
                                         
                                       
                                       ⁢ 
                                       
                                           
                                       
                                       ⁢ 
                                       
                                         ⅇ 
                                         
                                           
                                             - 
                                             
                                               α 
                                               i 
                                             
                                           
                                           ⁢ 
                                           
                                             t 
                                             
                                               n 
                                               , 
                                               k 
                                             
                                           
                                         
                                       
                                     
                                   
                                 
                                 ) 
                               
                             
                           
                         
                       
                     
                   
                   
                     
                       
                           
                         ⁢ 
                         
                           = 
                           
                             
                               ( 
                               
                                 
                                   ∏ 
                                   
                                     i 
                                     = 
                                     1 
                                   
                                   I 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   
                                     A 
                                     i 
                                     
                                       
                                         m 
                                         
                                           A 
                                           i 
                                         
                                       
                                       - 
                                       1 
                                     
                                   
                                   ⁢ 
                                   
                                     α 
                                     i 
                                     
                                       
                                         m 
                                         
                                           α 
                                           i 
                                         
                                       
                                       - 
                                       1 
                                     
                                   
                                 
                               
                               ) 
                             
                             ⁢ 
                             
                               ( 
                               
                                 
                                   ∏ 
                                   
                                     n 
                                     = 
                                     1 
                                   
                                   N 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   
                                     ∏ 
                                     
                                       k 
                                       = 
                                       1 
                                     
                                     
                                       K 
                                       n 
                                     
                                   
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   
                                     
                                       ∑ 
                                       
                                         i 
                                         = 
                                         1 
                                       
                                       I 
                                     
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     
                                       
                                         A 
                                         i 
                                       
                                       ⁢ 
                                       
                                         ⅇ 
                                         
                                           
                                             - 
                                             
                                               α 
                                               i 
                                             
                                           
                                           ⁢ 
                                           
                                             t 
                                             
                                               n 
                                               , 
                                               k 
                                             
                                           
                                         
                                       
                                     
                                   
                                 
                               
                               ) 
                             
                             ⁢ 
                             
                               ⅇ 
                               
                                 - 
                                 
                                   
                                     ∑ 
                                     
                                       i 
                                       = 
                                       1 
                                     
                                     I 
                                   
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   
                                     ( 
                                     
                                       
                                         
                                           r 
                                           
                                             A 
                                             i 
                                           
                                         
                                         ⁢ 
                                         
                                           A 
                                           i 
                                         
                                       
                                       + 
                                       
                                         
                                           r 
                                           
                                             α 
                                             i 
                                           
                                         
                                         ⁢ 
                                         
                                           α 
                                           i 
                                         
                                       
                                       + 
                                       
                                         
                                           
                                             A 
                                             i 
                                           
                                           
                                             α 
                                             i 
                                           
                                         
                                         ⁢ 
                                         
                                           ( 
                                           
                                             
                                               N 
                                               ⁡ 
                                               
                                                 ( 
                                                 
                                                   
                                                     ⅇ 
                                                     
                                                       
                                                         - 
                                                         
                                                           α 
                                                           i 
                                                         
                                                       
                                                       ⁢ 
                                                       τ 
                                                     
                                                   
                                                   - 
                                                   
                                                     ⅇ 
                                                     
                                                       
                                                         - 
                                                         
                                                           α 
                                                           i 
                                                         
                                                       
                                                       ⁢ 
                                                       v 
                                                     
                                                   
                                                 
                                                 ) 
                                               
                                             
                                             - 
                                             
                                               
                                                 ( 
                                                 
                                                   1 
                                                   - 
                                                   
                                                     ⅇ 
                                                     
                                                       
                                                         - 
                                                         
                                                           α 
                                                           i 
                                                         
                                                       
                                                       ⁢ 
                                                       δ 
                                                     
                                                   
                                                 
                                                 ) 
                                               
                                               ⁢ 
                                               
                                                 
                                                   ∑ 
                                                   
                                                     n 
                                                     = 
                                                     1 
                                                   
                                                   N 
                                                 
                                                 ⁢ 
                                                 
                                                     
                                                 
                                                 ⁢ 
                                                 
                                                   
                                                     ∑ 
                                                     
                                                       k 
                                                       = 
                                                       1 
                                                     
                                                     
                                                       K 
                                                       n 
                                                     
                                                   
                                                   ⁢ 
                                                   
                                                       
                                                   
                                                   ⁢ 
                                                   
                                                     ⅇ 
                                                     
                                                       
                                                         - 
                                                         
                                                           α 
                                                           i 
                                                         
                                                       
                                                       ⁢ 
                                                       
                                                         t 
                                                         
                                                           n 
                                                           , 
                                                           k 
                                                         
                                                       
                                                     
                                                   
                                                 
                                               
                                             
                                           
                                           ) 
                                         
                                       
                                     
                                     ) 
                                   
                                 
                               
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   Equation 
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   14 
                 
               
             
           
         
       
     
     We now use algorithm A2, which though it appears similar to A1 differs in step 520 where P(A,α|D) will be given, instead of by equation 8, by equation 14 taking into account the various deadtimes and the possibility of a plurality of unknown fluorophore lifetimes and/or intensities.
     510: 2 Calculate, for each point on the multidimensional grid,   

     
       
         
           
             
               P 
               ⁡ 
               
                 ( 
                 
                   A 
                   , 
                   
                     α 
                     | 
                     D 
                   
                 
                 ) 
               
             
             = 
             
               
                 ( 
                 
                   
                     ∏ 
                     
                       i 
                       = 
                       1 
                     
                     I 
                   
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   
                     
                       A 
                       i 
                       
                         
                           m 
                           
                             A 
                             i 
                           
                         
                         - 
                         1 
                       
                     
                     ⁢ 
                     
                       α 
                       i 
                       
                         
                           m 
                           
                             α 
                             i 
                           
                         
                         - 
                         1 
                       
                     
                   
                 
                 ) 
               
               ⁢ 
               
                 ( 
                 
                   
                     ∏ 
                     
                       n 
                       = 
                       1 
                     
                     N 
                   
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   
                     
                       ∏ 
                       
                         k 
                         = 
                         1 
                       
                       
                         K 
                         n 
                       
                     
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     
                       
                         ∑ 
                         
                           i 
                           = 
                           1 
                         
                         I 
                       
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       
                         
                           A 
                           i 
                         
                         ⁢ 
                         
                           ⅇ 
                           
                             
                               - 
                               
                                 α 
                                 i 
                               
                             
                             ⁢ 
                             
                               t 
                               
                                 n 
                                 , 
                                 k 
                               
                             
                           
                         
                       
                     
                   
                 
                 ) 
               
               ⁢ 
               
                 ⅇ 
                 
                   - 
                   
                     
                       ∑ 
                       
                         i 
                         = 
                         1 
                       
                       I 
                     
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     
                       ( 
                       
                         
                           
                             r 
                             
                               A 
                               i 
                             
                           
                           ⁢ 
                           
                             A 
                             i 
                           
                         
                         + 
                         
                           
                             r 
                             
                               α 
                               i 
                             
                           
                           ⁢ 
                           
                             α 
                             i 
                           
                         
                         + 
                         
                           
                             
                               A 
                               i 
                             
                             
                               α 
                               i 
                             
                           
                           ⁢ 
                           
                             ( 
                             
                               
                                 N 
                                 ⁡ 
                                 
                                   ( 
                                   
                                     
                                       ⅇ 
                                       
                                         
                                           - 
                                           
                                             α 
                                             i 
                                           
                                         
                                         ⁢ 
                                         τ 
                                       
                                     
                                     - 
                                     
                                       ⅇ 
                                       
                                         
                                           - 
                                           
                                             α 
                                             i 
                                           
                                         
                                         ⁢ 
                                         v 
                                       
                                     
                                   
                                   ) 
                                 
                               
                               - 
                               
                                 
                                   ( 
                                   
                                     1 
                                     - 
                                     
                                       ⅇ 
                                       
                                         
                                           - 
                                           
                                             α 
                                             i 
                                           
                                         
                                         ⁢ 
                                         δ 
                                       
                                     
                                   
                                   ) 
                                 
                                 ⁢ 
                                 
                                   
                                     ∑ 
                                     
                                       n 
                                       = 
                                       1 
                                     
                                     N 
                                   
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   
                                     
                                       ∑ 
                                       
                                         k 
                                         = 
                                         1 
                                       
                                       
                                         K 
                                         n 
                                       
                                     
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     
                                       ⅇ 
                                       
                                         
                                           - 
                                           
                                             α 
                                             i 
                                           
                                         
                                         ⁢ 
                                         
                                           t 
                                           
                                             n 
                                             , 
                                             k 
                                           
                                         
                                       
                                     
                                   
                                 
                               
                             
                             ) 
                           
                         
                       
                       ) 
                     
                   
                 
               
             
           
         
       
     
     As can be understood both from the appearance of equation 14 and, more importantly, from the fact that the grid is now multidimensional, this alternative of algorithm A1 will often be computational heavy and time-consuming. 
     Algorithm A3, Multiple Fluorophores with Known Lifetimes 
     A third embodiment of the inventive method of the present invention refers to measurement cases in which the lifetimes of the fluorophores in the sample are known. This can be the case for example when complex organic molecules are “tagged” with known fluorophores. The wanted measure may then be for example the quantities of the fluorophores, reflected in the initial intensities A i , or the ratios between the quantities of the different fluorophores, reflected in the ratios of the initial intensities A i . 
     Equation 14 above is simplified in the case of known lifetimes: 
               P   ⁡     (     A   |   D     )       ∝       (       ∏     i   =   1     I     ⁢           ⁢     A   i       m     A   i       -   1         )     ⁢     (       ∏     n   =   1     N     ⁢           ⁢       ∏     k   =   1       K   n       ⁢           ⁢       ∑     i   =   1     I     ⁢           ⁢       A   i     ⁢     ⅇ       -     α   i       ⁢     t     n   ,   k                   )     ⁢     ⅇ     -       ∑     i   =   1     I     ⁢           ⁢     (         r     A   i       ⁢     A   i       +         A   i       α   i       ⁢     (       N   ⁡     (       ⅇ       -     α   i       ⁢   τ       -     ⅇ       -     α   i       ⁢   v         )       -       (     1   -     ⅇ       -     α   i       ⁢   δ         )     ⁢       ∑     n   =   1     N     ⁢           ⁢       ∑     k   =   1       K   n       ⁢           ⁢     ⅇ       -     α   i       ⁢     t     n   ,   k                   )         )                   
but this is not sufficient to get a simple fast implementation, because of the number of terms in the second factor. By, in addition, inferring which fluorophore each photon came from it will be shown that the computation can be simplified, and hence the time needed for the Bayesian inference analysis is significantly shorter. Surprisingly, we gain here by introducing a large number of extra variables—in fact we introduce I new variables per photon received. For each photon φ n,k  received we introduce the I variables s n,k,i , which is defined to be 1 if φ n,k  is emitted by fluorophore i and is 0 otherwise. The s variable tells which fluorophore a photon originates from. Let S denote the Cartesian product of all these new variables.
 
     We can then recomplicate the above equation as follows: 
     
       
         
           
             
               
                 
                   
                     P 
                     ⁡ 
                     
                       ( 
                       
                         A 
                         | 
                         D 
                       
                       ) 
                     
                   
                   ⁢ 
                     
                   = 
                   
                     
                       ∫ 
                       
                         
                           P 
                           ⁡ 
                           
                             ( 
                             
                               A 
                               , 
                               
                                 S 
                                 | 
                                 D 
                               
                             
                             ) 
                           
                         
                         ⁢ 
                         
                           ⅆ 
                           S 
                         
                       
                     
                     = 
                     
                       
                         ∫ 
                         
                           
                             P 
                             ⁡ 
                             
                               ( 
                               A 
                               ) 
                             
                           
                           ⁢ 
                           
                             P 
                             ⁡ 
                             
                               ( 
                               
                                 D 
                                 | 
                                 A 
                               
                               ) 
                             
                           
                           ⁢ 
                           
                             P 
                             ⁡ 
                             
                               ( 
                               
                                 
                                   S 
                                   | 
                                   D 
                                 
                                 , 
                                 A 
                               
                               ) 
                             
                           
                           ⁢ 
                           
                             ⅆ 
                             S 
                           
                         
                       
                       
                         P 
                         ⁡ 
                         
                           ( 
                           D 
                           ) 
                         
                       
                     
                   
                 
               
             
             
               
                 
                     
                   ⁢ 
                   
                     ∝ 
                     
                       ∫ 
                       
                         
                           ( 
                           
                             
                               ∏ 
                               
                                 i 
                                 = 
                                 1 
                               
                               I 
                             
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               A 
                               i 
                               
                                 
                                   m 
                                   
                                     A 
                                     i 
                                   
                                 
                                 - 
                               
                             
                           
                           ) 
                         
                         ⁢ 
                         
                           ( 
                           
                             
                               ∏ 
                               
                                 n 
                                 = 
                                 1 
                               
                               N 
                             
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               
                                 ∏ 
                                 
                                   k 
                                   = 
                                   1 
                                 
                                 
                                   K 
                                   n 
                                 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 
                                   ∑ 
                                   
                                     i 
                                     = 
                                     1 
                                   
                                   I 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   
                                     A 
                                     i 
                                   
                                   ⁢ 
                                   
                                     ⅇ 
                                     
                                       
                                         - 
                                         
                                           α 
                                           i 
                                         
                                       
                                       ⁢ 
                                       
                                         t 
                                         
                                           n 
                                           , 
                                           k 
                                         
                                       
                                     
                                   
                                 
                               
                             
                           
                           ) 
                         
                         ⁢ 
                         
                           ⅇ 
                           
                             - 
                             
                               
                                 ∑ 
                                 
                                   i 
                                   = 
                                   1 
                                 
                                 I 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 ( 
                                 
                                   
                                     
                                       r 
                                       
                                         A 
                                         i 
                                       
                                     
                                     ⁢ 
                                     
                                       A 
                                       i 
                                     
                                   
                                   + 
                                   
                                     
                                       
                                         A 
                                         i 
                                       
                                       
                                         α 
                                         i 
                                       
                                     
                                     ⁢ 
                                     
                                       ( 
                                       
                                         
                                           N 
                                           ⁡ 
                                           
                                             ( 
                                             
                                               
                                                 ⅇ 
                                                 
                                                   
                                                     - 
                                                     
                                                       α 
                                                       i 
                                                     
                                                   
                                                   ⁢ 
                                                   τ 
                                                 
                                               
                                               - 
                                               
                                                 ⅇ 
                                                 
                                                   
                                                     - 
                                                     
                                                       α 
                                                       i 
                                                     
                                                   
                                                   ⁢ 
                                                   v 
                                                 
                                               
                                             
                                             ) 
                                           
                                         
                                         - 
                                         
                                           
                                             ( 
                                             
                                               1 
                                               - 
                                               
                                                 ⅇ 
                                                 
                                                   
                                                     - 
                                                     
                                                       α 
                                                       i 
                                                     
                                                   
                                                   ⁢ 
                                                   δ 
                                                 
                                               
                                             
                                             ) 
                                           
                                           ⁢ 
                                           
                                             
                                               ∑ 
                                               
                                                 n 
                                                 = 
                                                 1 
                                               
                                               N 
                                             
                                             ⁢ 
                                             
                                                 
                                             
                                             ⁢ 
                                             
                                               
                                                 ∑ 
                                                 
                                                   k 
                                                   = 
                                                   1 
                                                 
                                                 
                                                   K 
                                                   n 
                                                 
                                               
                                               ⁢ 
                                               
                                                   
                                               
                                               ⁢ 
                                               
                                                 ⅇ 
                                                 
                                                   
                                                     - 
                                                     
                                                       α 
                                                       i 
                                                     
                                                   
                                                   ⁢ 
                                                   
                                                     t 
                                                     
                                                       n 
                                                       , 
                                                       k 
                                                     
                                                   
                                                 
                                               
                                             
                                           
                                         
                                       
                                       ) 
                                     
                                   
                                 
                                 ) 
                               
                             
                           
                         
                         ⁢ 
                         
                           P 
                           ⁡ 
                           
                             ( 
                             
                               
                                 S 
                                 | 
                                 D 
                               
                               , 
                               A 
                             
                             ) 
                           
                         
                         ⁢ 
                         
                           ⅆ 
                           S 
                         
                       
                     
                   
                 
               
             
           
         
       
       
         
           
             Now 
             , 
             
               
 
             
             ⁢ 
             
               
                 
                   
                     
                       P 
                       ⁡ 
                       
                         ( 
                         
                           
                             S 
                             | 
                             D 
                           
                           , 
                           A 
                         
                         ) 
                       
                     
                     ⁢ 
                       
                     = 
                     
                       
                         
                           ∏ 
                           
                             n 
                             = 
                             1 
                           
                           N 
                         
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         
                           
                             ∏ 
                             
                               k 
                               = 
                               1 
                             
                             
                               K 
                               n 
                             
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             P 
                             ⁡ 
                             
                               ( 
                               
                                 
                                   
                                     s 
                                     
                                       n 
                                       , 
                                       k 
                                     
                                   
                                   | 
                                   D 
                                 
                                 , 
                                 A 
                               
                               ) 
                             
                           
                         
                       
                       = 
                       
                         
                           ∏ 
                           
                             n 
                             = 
                             1 
                           
                           N 
                         
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         
                           
                             ∏ 
                             
                               k 
                               = 
                               1 
                             
                             
                               K 
                               n 
                             
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             P 
                             ⁡ 
                             
                               ( 
                               
                                 
                                   
                                     s 
                                     
                                       n 
                                       , 
                                       k 
                                     
                                   
                                   | 
                                   
                                     photon 
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     referred 
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     to 
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     by 
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     
                                       s 
                                       
                                         n 
                                         , 
                                         k 
                                       
                                     
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     is 
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     at 
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     
                                       t 
                                       
                                         n 
                                         , 
                                         k 
                                       
                                     
                                   
                                 
                                 , 
                                 A 
                               
                               ) 
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   
                       
                     ⁢ 
                     
                       = 
                       
                         
                           
                             ∏ 
                             
                               n 
                               = 
                               1 
                             
                             N 
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             
                               ∏ 
                               
                                 k 
                                 = 
                                 1 
                               
                               
                                 K 
                                 n 
                               
                             
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               
                                 P 
                                 ⁡ 
                                 
                                   ( 
                                   
                                     
                                       there 
                                       ⁢ 
                                       
                                           
                                       
                                       ⁢ 
                                       is 
                                       ⁢ 
                                       
                                           
                                       
                                       ⁢ 
                                       a 
                                       ⁢ 
                                       
                                           
                                       
                                       ⁢ 
                                       photon 
                                       ⁢ 
                                       
                                           
                                       
                                       ⁢ 
                                       from 
                                       ⁢ 
                                       
                                           
                                       
                                       ⁢ 
                                       fluor 
                                       ⁢ 
                                       
                                           
                                       
                                       ⁢ 
                                       i 
                                       ⁢ 
                                       
                                           
                                       
                                       ⁢ 
                                       at 
                                       ⁢ 
                                       
                                           
                                       
                                       ⁢ 
                                       
                                         t 
                                         
                                           n 
                                           , 
                                           k 
                                         
                                       
                                     
                                     | 
                                     A 
                                   
                                   ) 
                                 
                               
                               
                                 
                                   ∑ 
                                   
                                     i 
                                     = 
                                     1 
                                   
                                   I 
                                 
                                 ⁢ 
                                 
                                   P 
                                   ⁡ 
                                   
                                     ( 
                                     
                                       
                                         there 
                                         ⁢ 
                                         
                                             
                                         
                                         ⁢ 
                                         is 
                                         ⁢ 
                                         
                                             
                                         
                                         ⁢ 
                                         a 
                                         ⁢ 
                                         
                                             
                                         
                                         ⁢ 
                                         photon 
                                         ⁢ 
                                         
                                             
                                         
                                         ⁢ 
                                         from 
                                         ⁢ 
                                         
                                             
                                         
                                         ⁢ 
                                         fluor 
                                         ⁢ 
                                         
                                             
                                         
                                         ⁢ 
                                         i 
                                         ⁢ 
                                         
                                             
                                         
                                         ⁢ 
                                         at 
                                         ⁢ 
                                         
                                             
                                         
                                         ⁢ 
                                         
                                           t 
                                           
                                             n 
                                             , 
                                             k 
                                           
                                         
                                       
                                       | 
                                       A 
                                     
                                     ) 
                                   
                                 
                               
                             
                           
                         
                         = 
                         
                           
                             ∏ 
                             
                               n 
                               = 
                               1 
                             
                             N 
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             
                               ∏ 
                               
                                 k 
                                 = 
                                 1 
                               
                               
                                 K 
                                 n 
                               
                             
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               
                                 
                                   ∑ 
                                   
                                     i 
                                     = 
                                     1 
                                   
                                   I 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   
                                     s 
                                     
                                       n 
                                       , 
                                       k 
                                       , 
                                       i 
                                     
                                   
                                   ⁢ 
                                   
                                     A 
                                     i 
                                   
                                   ⁢ 
                                   
                                     ⅇ 
                                     
                                       
                                         - 
                                         
                                           α 
                                           i 
                                         
                                       
                                       ⁢ 
                                       
                                         t 
                                         
                                           n 
                                           , 
                                           k 
                                         
                                       
                                     
                                   
                                 
                               
                               
                                 
                                   ∑ 
                                   
                                     i 
                                     = 
                                     1 
                                   
                                   I 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   
                                     A 
                                     i 
                                   
                                   ⁢ 
                                   
                                     ⅇ 
                                     
                                       
                                         - 
                                         
                                           α 
                                           i 
                                         
                                       
                                       ⁢ 
                                       
                                         t 
                                         
                                           n 
                                           , 
                                           k 
                                         
                                       
                                     
                                   
                                 
                               
                             
                           
                         
                       
                     
                   
                 
               
             
           
         
       
       
         
           therefore 
         
       
       
         
           
             P 
             ⁢ 
             
               
                 
                   
                     
                       ( 
                       
                         A 
                         | 
                         D 
                       
                       ) 
                     
                     ⁢ 
                       
                     ∝ 
                     
                       ∫ 
                       
                         
                           ( 
                           
                             
                               ∏ 
                               
                                 i 
                                 = 
                                 1 
                               
                               I 
                             
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               A 
                               i 
                               
                                 
                                   m 
                                   
                                     A 
                                     i 
                                   
                                 
                                 - 
                                 1 
                               
                             
                           
                           ) 
                         
                         ⁢ 
                         
                           ( 
                           
                             
                               ∏ 
                               
                                 n 
                                 = 
                                 1 
                               
                               N 
                             
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               
                                 ∏ 
                                 
                                   k 
                                   = 
                                   1 
                                 
                                 
                                   K 
                                   n 
                                 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 ( 
                                 
                                   
                                     
                                       
                                         ∑ 
                                         
                                           i 
                                           = 
                                           1 
                                         
                                         I 
                                       
                                       ⁢ 
                                       
                                           
                                       
                                       ⁢ 
                                       
                                         
                                           s 
                                           
                                             n 
                                             , 
                                             k 
                                             , 
                                             i 
                                           
                                         
                                         ⁢ 
                                         
                                           A 
                                           i 
                                         
                                         ⁢ 
                                         
                                           ⅇ 
                                           
                                             
                                               - 
                                               
                                                 α 
                                                 i 
                                               
                                             
                                             ⁢ 
                                             
                                               t 
                                               
                                                 n 
                                                 , 
                                                 k 
                                               
                                             
                                           
                                         
                                       
                                     
                                     
                                       
                                         ∑ 
                                         
                                           i 
                                           = 
                                           1 
                                         
                                         I 
                                       
                                       ⁢ 
                                       
                                           
                                       
                                       ⁢ 
                                       
                                         
                                           A 
                                           i 
                                         
                                         ⁢ 
                                         
                                           ⅇ 
                                           
                                             
                                               - 
                                               
                                                 α 
                                                 i 
                                               
                                             
                                             ⁢ 
                                             
                                               t 
                                               
                                                 n 
                                                 , 
                                                 k 
                                               
                                             
                                           
                                         
                                       
                                     
                                   
                                   ⁢ 
                                   
                                     
                                       ∑ 
                                       
                                         i 
                                         = 
                                         1 
                                       
                                       I 
                                     
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     
                                       
                                         A 
                                         i 
                                       
                                       ⁢ 
                                       
                                         ⅇ 
                                         
                                           
                                             - 
                                             
                                               α 
                                               i 
                                             
                                           
                                           ⁢ 
                                           
                                             t 
                                             
                                               n 
                                               , 
                                               k 
                                             
                                           
                                         
                                       
                                     
                                   
                                 
                                 ) 
                               
                             
                           
                           ) 
                         
                         ⁢ 
                         
                           ⅇ 
                           
                             - 
                             
                               
                                 ∑ 
                                 
                                   i 
                                   = 
                                   1 
                                 
                                 I 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 ( 
                                 
                                   
                                     
                                       r 
                                       
                                         A 
                                         i 
                                       
                                     
                                     ⁢ 
                                     
                                       A 
                                       i 
                                     
                                   
                                   + 
                                   
                                     
                                       
                                         A 
                                         i 
                                       
                                       
                                         α 
                                         i 
                                       
                                     
                                     ⁢ 
                                     
                                       ( 
                                       
                                         
                                           N 
                                           ⁡ 
                                           
                                             ( 
                                             
                                               
                                                 ⅇ 
                                                 
                                                   
                                                     - 
                                                     
                                                       α 
                                                       i 
                                                     
                                                   
                                                   ⁢ 
                                                   τ 
                                                 
                                               
                                               - 
                                               
                                                 ⅇ 
                                                 
                                                   
                                                     - 
                                                     
                                                       α 
                                                       i 
                                                     
                                                   
                                                   ⁢ 
                                                   v 
                                                 
                                               
                                             
                                             ) 
                                           
                                         
                                         - 
                                         
                                           
                                             ( 
                                             
                                               1 
                                               - 
                                               
                                                 ⅇ 
                                                 
                                                   
                                                     - 
                                                     
                                                       α 
                                                       i 
                                                     
                                                   
                                                   ⁢ 
                                                   δ 
                                                 
                                               
                                             
                                             ) 
                                           
                                           ⁢ 
                                           
                                             
                                               ∑ 
                                               
                                                 n 
                                                 = 
                                                 1 
                                               
                                               N 
                                             
                                             ⁢ 
                                             
                                                 
                                             
                                             ⁢ 
                                             
                                               
                                                 ∑ 
                                                 
                                                   k 
                                                   = 
                                                   1 
                                                 
                                                 
                                                   K 
                                                   n 
                                                 
                                               
                                               ⁢ 
                                               
                                                   
                                               
                                               ⁢ 
                                               
                                                 ⅇ 
                                                 
                                                   
                                                     - 
                                                     
                                                       α 
                                                       i 
                                                     
                                                   
                                                   ⁢ 
                                                   
                                                     t 
                                                     
                                                       n 
                                                       , 
                                                       k 
                                                     
                                                   
                                                 
                                               
                                             
                                           
                                         
                                       
                                       ) 
                                     
                                   
                                 
                                 ) 
                               
                             
                           
                         
                         ⁢ 
                         
                           ⅆ 
                           S 
                         
                       
                     
                   
                 
               
               
                 
                   
                       
                     ⁢ 
                     
                       = 
                       
                         ∫ 
                         
                           
                             ( 
                             
                               
                                 ∏ 
                                 
                                   i 
                                   = 
                                   1 
                                 
                                 I 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 A 
                                 i 
                                 
                                   
                                     m 
                                     
                                       A 
                                       i 
                                     
                                   
                                   - 
                                   1 
                                 
                               
                             
                             ) 
                           
                           ⁢ 
                           
                             ( 
                             
                               
                                 ∏ 
                                 
                                   n 
                                   = 
                                   1 
                                 
                                 N 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 
                                   ∏ 
                                   
                                     k 
                                     = 
                                     1 
                                   
                                   
                                     K 
                                     n 
                                   
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   
                                     ∑ 
                                     
                                       i 
                                       = 
                                       1 
                                     
                                     I 
                                   
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   
                                     
                                       s 
                                       
                                         n 
                                         , 
                                         k 
                                         , 
                                         i 
                                       
                                     
                                     ⁢ 
                                     
                                       A 
                                       i 
                                     
                                     ⁢ 
                                     
                                       ⅇ 
                                       
                                         
                                           - 
                                           
                                             α 
                                             i 
                                           
                                         
                                         ⁢ 
                                         
                                           t 
                                           
                                             n 
                                             , 
                                             k 
                                           
                                         
                                       
                                     
                                   
                                 
                               
                             
                             ) 
                           
                           ⁢ 
                           
                             ⅇ 
                             
                               - 
                               
                                 
                                   ∑ 
                                   
                                     i 
                                     = 
                                     1 
                                   
                                   I 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   ( 
                                   
                                     
                                       
                                         r 
                                         
                                           A 
                                           i 
                                         
                                       
                                       ⁢ 
                                       
                                         A 
                                         i 
                                       
                                     
                                     + 
                                     
                                       
                                         
                                           A 
                                           i 
                                         
                                         
                                           α 
                                           i 
                                         
                                       
                                       ⁢ 
                                       
                                         ( 
                                         
                                           
                                             N 
                                             ⁡ 
                                             
                                               ( 
                                               
                                                 
                                                   ⅇ 
                                                   
                                                     
                                                       - 
                                                       
                                                         α 
                                                         i 
                                                       
                                                     
                                                     ⁢ 
                                                     τ 
                                                   
                                                 
                                                 - 
                                                 
                                                   ⅇ 
                                                   
                                                     
                                                       - 
                                                       
                                                         α 
                                                         i 
                                                       
                                                     
                                                     ⁢ 
                                                     v 
                                                   
                                                 
                                               
                                               ) 
                                             
                                           
                                           - 
                                           
                                             
                                               ( 
                                               
                                                 1 
                                                 - 
                                                 
                                                   ⅇ 
                                                   
                                                     
                                                       - 
                                                       
                                                         α 
                                                         i 
                                                       
                                                     
                                                     ⁢ 
                                                     δ 
                                                   
                                                 
                                               
                                               ) 
                                             
                                             ⁢ 
                                             
                                               
                                                 ∑ 
                                                 
                                                   n 
                                                   = 
                                                   1 
                                                 
                                                 N 
                                               
                                               ⁢ 
                                               
                                                   
                                               
                                               ⁢ 
                                               
                                                 
                                                   ∑ 
                                                   
                                                     k 
                                                     = 
                                                     1 
                                                   
                                                   
                                                     K 
                                                     n 
                                                   
                                                 
                                                 ⁢ 
                                                 
                                                     
                                                 
                                                 ⁢ 
                                                 
                                                   ⅇ 
                                                   
                                                     
                                                       - 
                                                       
                                                         α 
                                                         i 
                                                       
                                                     
                                                     ⁢ 
                                                     
                                                       t 
                                                       
                                                         n 
                                                         , 
                                                         k 
                                                       
                                                     
                                                   
                                                 
                                               
                                             
                                           
                                         
                                         ) 
                                       
                                     
                                   
                                   ) 
                                 
                               
                             
                           
                           ⁢ 
                           
                             ⅆ 
                             S 
                           
                         
                       
                     
                   
                 
               
             
           
         
       
     
     By simply removing the integration throughout the above argument, we can also arrive at 
                     P   ⁡     (     A   ,     S   |   D       )       ∝       (       ∏     i   =   1     I     ⁢           ⁢     A   i       m     A   i       -   1         )     ⁢     (       ∏     n   =   1     N     ⁢           ⁢       ∏     k   =   1       K   n       ⁢           ⁢       ∑     i   =   1     I     ⁢           ⁢       s     n   ,   k   ,   i       ⁢     A   i     ⁢     ⅇ       -     α   i       ⁢     t     n   ,   k                   )     ⁢     ⅇ     -       ∑     i   =   1     I     ⁢           ⁢     (         r     A   i       ⁢     A   i       +         A   i       α   i       ⁢     (       N   ⁡     (       ⅇ       -     α   i       ⁢   τ       -     ⅇ       -     α   i       ⁢   v         )       -       (     1   -     ⅇ       -     α   i       ⁢   δ         )     ⁢       ∑     n   =   1     N     ⁢           ⁢       ∑     k   =   1       K   n       ⁢           ⁢     ⅇ       -     α   i       ⁢     t     n   ,   k                   )         )                     Equation   ⁢           ⁢   15               
which is the starting point for algorithm A3.
 
     We now plan to take random samples from the joint distribution of A and S. In order to do so we will use Markov Chain Monte Carlo techniques. In particular, given a random sample (A j ,S j ) we will, if j is even, set S j+1  equal to S j , and draw A j+1 , from P(A|S j+1 ), and if j is odd, set A j+1  equal to A j  and draw S j+1 , from P(S|A j+1 ). 
     Drawing S j+1  from P(S↑A j+1 ) is easy, because this conditional distribution of S is separable over its K components S n,k , and each of these is a simple discrete distribution: 
                           P   ⁡     (       S   |   A     ,   D     )       ⁢       ∝       ∏     n   =   1     N     ⁢           ⁢       ∏     k   =   1       K   n       ⁢           ⁢       ∑     i   =   1     I     ⁢           ⁢       s     n   ,   k   ,   i       ⁢     A   i     ⁢     ⅇ       -     α   i       ⁢     t     n   ,   k                                   ⁢       ∴     P   ⁡     (         s     n   ,   k   ,   i       =   1     ,         (     ∀       i   ′     ≠   i       )     ⁢     s     n   ,   k   ,     i   ′           =     0   |   A       ,   D     )         =         A   i     ⁢     ⅇ       -     α   i       ⁢     t     n   ,   k                 ∑     i   =   1     I     ⁢           ⁢       A   i     ⁢     ⅇ       -     α   i       ⁢     t     n   ,   k                                 Equation   ⁢           ⁢   16               
and each s n,k  may be handled independently.
 
     Drawing A j+1  from P(A|S j+1 ) requires sampling from 1 Gamma distributions; how to do this will be exemplified in an appendix. The distributions in question are given by: 
     
       
         
           
             
               
                 
                   
                     
                       
                         
                           P 
                           ⁡ 
                           
                             ( 
                             
                               
                                 A 
                                 | 
                                 S 
                               
                               , 
                               D 
                             
                             ) 
                           
                         
                         ⁢ 
                           
                         ∝ 
                         
                           
                             ( 
                             
                               
                                 ∏ 
                                 
                                   i 
                                   = 
                                   1 
                                 
                                 I 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 A 
                                 i 
                                 
                                   
                                     m 
                                     
                                       A 
                                       i 
                                     
                                   
                                   - 
                                   1 
                                 
                               
                             
                             ) 
                           
                           ⁢ 
                           
                             ( 
                             
                               
                                 ∏ 
                                 
                                   i 
                                   = 
                                   1 
                                 
                                 I 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 
                                   ∏ 
                                   
                                     n 
                                     = 
                                     1 
                                   
                                   N 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   
                                     ∏ 
                                     
                                       k 
                                       = 
                                       1 
                                     
                                     
                                       K 
                                       n 
                                     
                                   
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   
                                     
                                       A 
                                       i 
                                     
                                     ⁢ 
                                     
                                       e 
                                       
                                         
                                           - 
                                           
                                             a 
                                             i 
                                           
                                         
                                         ⁢ 
                                         
                                           t 
                                           
                                             n 
                                             , 
                                             k 
                                           
                                         
                                       
                                     
                                   
                                 
                               
                             
                             ) 
                           
                           ⁢ 
                           
                             e 
                             
                               - 
                               
                                 
                                   ∑ 
                                   
                                     i 
                                     = 
                                     1 
                                   
                                   I 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   ( 
                                   
                                     
                                       
                                         r 
                                         
                                           A 
                                           i 
                                         
                                       
                                       ⁢ 
                                       
                                         A 
                                         i 
                                       
                                     
                                     + 
                                     
                                       
                                         
                                           A 
                                           i 
                                         
                                         
                                           a 
                                           i 
                                         
                                       
                                       ⁢ 
                                       
                                         ( 
                                         
                                           
                                             N 
                                             ⁡ 
                                             
                                               ( 
                                               
                                                 
                                                   e 
                                                   
                                                     
                                                       - 
                                                       
                                                         a 
                                                         i 
                                                       
                                                     
                                                     ⁢ 
                                                     τ 
                                                   
                                                 
                                                 - 
                                                 
                                                   e 
                                                   
                                                     
                                                       - 
                                                       
                                                         a 
                                                         i 
                                                       
                                                     
                                                     ⁢ 
                                                     v 
                                                   
                                                 
                                               
                                               ) 
                                             
                                           
                                           - 
                                           
                                             
                                               ( 
                                               
                                                 1 
                                                 - 
                                                 
                                                   e 
                                                   
                                                     
                                                       - 
                                                       
                                                         a 
                                                         i 
                                                       
                                                     
                                                     ⁢ 
                                                     δ 
                                                   
                                                 
                                               
                                               ) 
                                             
                                             ⁢ 
                                             
                                               
                                                 ∑ 
                                                 
                                                   n 
                                                   = 
                                                   1 
                                                 
                                                 N 
                                               
                                               ⁢ 
                                               
                                                   
                                               
                                               ⁢ 
                                               
                                                 
                                                   ∑ 
                                                   
                                                     k 
                                                     = 
                                                     1 
                                                   
                                                   
                                                     K 
                                                     n 
                                                   
                                                 
                                                 ⁢ 
                                                 
                                                     
                                                 
                                                 ⁢ 
                                                 
                                                   e 
                                                   
                                                     
                                                       - 
                                                       
                                                         a 
                                                         i 
                                                       
                                                     
                                                     ⁢ 
                                                     
                                                       t 
                                                       
                                                         n 
                                                         , 
                                                         k 
                                                       
                                                     
                                                   
                                                 
                                               
                                             
                                           
                                         
                                         ) 
                                       
                                     
                                   
                                   ) 
                                 
                               
                             
                           
                         
                       
                     
                   
                   
                     
                       
                           
                         ⁢ 
                         
                           
                             ∴ 
                             
                               P 
                               ⁡ 
                               
                                 ( 
                                 
                                   
                                     
                                       A 
                                       i 
                                     
                                     | 
                                     S 
                                   
                                   , 
                                   D 
                                 
                                 ) 
                               
                             
                           
                           = 
                           
                             
                               A 
                               i 
                               
                                 
                                   m 
                                   
                                     A 
                                     i 
                                   
                                 
                                 - 
                                 1 
                                 + 
                                 
                                   
                                     ∑ 
                                     
                                       n 
                                       = 
                                       1 
                                     
                                     N 
                                   
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   
                                     
                                       ∑ 
                                       
                                         k 
                                         = 
                                         1 
                                       
                                       
                                         K 
                                         n 
                                       
                                     
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     
                                       s 
                                       
                                         n 
                                         , 
                                         k 
                                         , 
                                         i 
                                       
                                     
                                   
                                 
                               
                             
                             ⁢ 
                             
                               e 
                               
                                 - 
                                 
                                   
                                     A 
                                     i 
                                   
                                   ⁡ 
                                   
                                     ( 
                                     
                                       
                                         r 
                                         
                                           A 
                                           i 
                                         
                                       
                                       + 
                                       
                                         
                                           1 
                                           
                                             a 
                                             i 
                                           
                                         
                                         ⁢ 
                                         
                                           ( 
                                           
                                             
                                               N 
                                               ⁡ 
                                               
                                                 ( 
                                                 
                                                   
                                                     e 
                                                     
                                                       
                                                         - 
                                                         
                                                           a 
                                                           i 
                                                         
                                                       
                                                       ⁢ 
                                                       τ 
                                                     
                                                   
                                                   - 
                                                   
                                                     e 
                                                     
                                                       
                                                         - 
                                                         
                                                           a 
                                                           i 
                                                         
                                                       
                                                       ⁢ 
                                                       v 
                                                     
                                                   
                                                 
                                                 ) 
                                               
                                             
                                             - 
                                             
                                               
                                                 ( 
                                                 
                                                   1 
                                                   - 
                                                   
                                                     e 
                                                     
                                                       
                                                         - 
                                                         
                                                           a 
                                                           i 
                                                         
                                                       
                                                       ⁢ 
                                                       δ 
                                                     
                                                   
                                                 
                                                 ) 
                                               
                                               ⁢ 
                                               
                                                 
                                                   ∑ 
                                                   
                                                     n 
                                                     = 
                                                     1 
                                                   
                                                   N 
                                                 
                                                 ⁢ 
                                                 
                                                     
                                                 
                                                 ⁢ 
                                                 
                                                   
                                                     ∑ 
                                                     
                                                       k 
                                                       = 
                                                       1 
                                                     
                                                     
                                                       K 
                                                       n 
                                                     
                                                   
                                                   ⁢ 
                                                   
                                                       
                                                   
                                                   ⁢ 
                                                   
                                                     e 
                                                     
                                                       
                                                         - 
                                                         
                                                           a 
                                                           i 
                                                         
                                                       
                                                       ⁢ 
                                                       
                                                         t 
                                                         
                                                           n 
                                                           , 
                                                           k 
                                                         
                                                       
                                                     
                                                   
                                                 
                                               
                                             
                                           
                                           ) 
                                         
                                       
                                     
                                     ) 
                                   
                                 
                               
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   Equation 
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   17 
                 
               
             
           
         
       
     
     Having got our sequence of random samples (A 1 ,S 1 ),(A 2 ,S 2 ), . . . we convert it into a sequence of samples of A by discarding the values of S. 
     With the theoretical background above, and with reference to the flowchart of  FIG. 3 , an algorithm suitable for software implementation will be described. The algorithm will be denoted A3. 
     Algorithm A3:
     600: In a first initialising step 600, which is included in step 300 of the flowchart of  FIG. 3 , the user enters functions, values or distributions describing a and A.   600: 1 a) If based on information from previous experiments:   600: 1.1 i) and if posterior of previous experiments are of Gamma form (eq. 3):
       copy m and r from the posterior of the previous experiment   
       600: 1.2 ii) if other distribution form, e.g. f(A i ):
       plot f(A i ) and adjust m A     i   ,r A     i    until Gamma functions mimic f(A i ) or   consider information loss   
       

               I     m   ,   r       =     ∫       f   ⁡     (   A   )       ⁢   log   ⁢       f   ⁡     (   A   )           Γ     m   ,   r       ⁡     (   A   )         ⁢     ⅆ   A               
and adjust m and r
         for minimum I m,r  using some minimisation routine.       600: 2 b) If information is vague knowledge of fluorophore; for each fluorophore pick m A     i   ,r A     i   , so that distribution fits “mental image”:   600: 2.1 i) for each A i  do   600: 2.1.1 a) pick m A     i   &gt;0 (that the larger the value the narrower the prior)   600: 2.1.2 b) pick mean μ of prior (e.g. 10 8  meaning 1 photon per 10 ns)   600: 2.1.3 c) set r A     i   =m A     i   /μ   600: 2.1.4 d) plot prior on screen (linear or log scale)   600: 2.1.5 e) Does the plot fit the mental image desired? Yes—new A i (goto i), No—repeat (a) to (e) as necessary   605: In a measuring step 605, which corresponds to the steps 305-320, datasets of arrival times are collected D n .   610: The Bayesian inference analysis, step 610 (corresponding to 325) comprises the substeps (610: 1-4) of:   610: 1 Initialize:   610: 1.1 set number of samples required   610: 1.2 select a starting value for each 4, options:
       i) select random sample from prior on A i      ii) select mean from prior on A i      iii) select mode from prior on A i      iv) user input data   
       610: 2 Update S(s n,k  representing the source of each photon)   610: 2.1 For each n(1, 2, . . . , K n )   610: 2.1.1 For each k(1, 2, . . . , K n )   610: 2.1.1.1 Update s n,k :
       select a random sample from the discrete distribution (eq. 17):   
       

     
       
         
           
             
               P 
               ⁡ 
               
                 ( 
                 
                   
                     
                       s 
                       
                         n 
                         , 
                         k 
                         , 
                         i 
                       
                     
                     = 
                     1 
                   
                   , 
                   
                     
                       
                         ( 
                         
                           ∀ 
                           
                             
                               i 
                               ′ 
                             
                             ≠ 
                             i 
                           
                         
                         ) 
                       
                       ⁢ 
                       
                         s 
                         
                           n 
                           , 
                           k 
                           , 
                           
                             i 
                             ′ 
                           
                         
                       
                     
                     = 
                     
                       0 
                       | 
                       A 
                     
                   
                   , 
                   D 
                 
                 ) 
               
             
             = 
             
               
                 
                   A 
                   i 
                 
                 ⁢ 
                 
                   ⅇ 
                   
                     
                       - 
                       
                         α 
                         i 
                       
                     
                     ⁢ 
                     
                       t 
                       
                         n 
                         , 
                         k 
                       
                     
                   
                 
               
               
                 
                   ∑ 
                   
                     i 
                     = 
                     1 
                   
                   I 
                 
                 ⁢ 
                 
                     
                 
                 ⁢ 
                 
                   
                     A 
                     i 
                   
                   ⁢ 
                   
                     ⅇ 
                     
                       
                         - 
                         
                           α 
                           i 
                         
                       
                       ⁢ 
                       
                         t 
                         
                           n 
                           , 
                           k 
                         
                       
                     
                   
                 
               
             
           
         
       
         
         610: 2.1.2 Next k 
         610: 2.2 Next n 
         610: 3 Update A 
         610: 3.1 For each i(1, 2, . . . , I) 
         610: 3.1.1 Update A i : 
         610: 3.1.1.1 Calculate 
       
    
     
       
         
           
             m 
             = 
             
               
                 m 
                 
                   A 
                   i 
                 
               
               + 
               
                 
                   ∑ 
                   
                     n 
                     = 
                     1 
                   
                   N 
                 
                 ⁢ 
                 
                     
                 
                 ⁢ 
                 
                   
                     ∑ 
                     
                       k 
                       = 
                       1 
                     
                     
                       K 
                       n 
                     
                   
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   
                     s 
                     
                       n 
                       , 
                       k 
                       , 
                       i 
                     
                   
                 
               
             
           
         
       
         
         610: 3.1.1.2 Calculate 
       
    
     
       
         
           
             
               r 
               i 
             
             = 
             
               
                 r 
                 
                   A 
                   i 
                 
               
               + 
               
                 
                   1 
                   
                     α 
                     i 
                   
                 
                 ⁢ 
                 
                   ( 
                   
                     
                       N 
                       ⁡ 
                       
                         ( 
                         
                           
                             ⅇ 
                             
                               
                                 - 
                                 
                                   α 
                                   i 
                                 
                               
                               ⁢ 
                               τ 
                             
                           
                           - 
                           
                             ⅇ 
                             
                               
                                 - 
                                 
                                   α 
                                   i 
                                 
                               
                               ⁢ 
                               v 
                             
                           
                         
                         ) 
                       
                     
                     - 
                     
                       
                         ( 
                         
                           1 
                           - 
                           
                             ⅇ 
                             
                               
                                 - 
                                 
                                   α 
                                   i 
                                 
                               
                               ⁢ 
                               δ 
                             
                           
                         
                         ) 
                       
                       ⁢ 
                       
                         
                           ∑ 
                           
                             n 
                             = 
                             1 
                           
                           N 
                         
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         
                           
                             ∑ 
                             
                               k 
                               = 
                               1 
                             
                             
                               K 
                               n 
                             
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             ⅇ 
                             
                               
                                 - 
                                 
                                   α 
                                   i 
                                 
                               
                               ⁢ 
                               
                                 t 
                                 
                                   n 
                                   , 
                                   k 
                                 
                               
                             
                           
                         
                       
                     
                   
                   ) 
                 
               
             
           
         
       
         
         610: 3.1.1.3 Set new value of A i  to be a random sample from the Gamma distribution with parameters m, r i  (see Appendix) 
         610: 3.1 Next i 
         610: 4 Add value of A to list of samples of A 
         610: 5 Enough samples? Yes—goto 620, No—repeat 610: 2-5 
         620: In an outputting step 620 (corresponding to 330) the resulting list of samples is presented to the user. Optionally histograms (corresponding to the marginal distributions of previous algorithms) can be presented. Other measures can be calculated from the histograms for example the marginal means with the 5 th  and 95 th  centiles. 
       
    
     Alternatively it is equally feasible to start with the source variables S. The algorithm would be slightly modified, the important modifications are:
     610: 1 Initialize:
       select some value at random for each s′ n,k  defined by   
       

               s     n   ,   k     ′     ≡       ∑     i   =   1     I     ⁢           ⁢     is     n   ,   k   ,   i               
from the set {1, 2, . . . , I}
 
and
     610: 2 Update A   610: 3 Update S   

     Note that the procedure, in step 610: 3, to draw a random sample from the Gamma distribution with parameters m,r i  can be done in various ways. A suitable method will be described in the Appendix. 
       FIG. 5  illustrates three prior distributions entered by a user in substep 610:1. In  FIG. 6  is a typical output from step 620 shown.  FIG. 6  shows histograms for three different fluorophores. The x-marked lines indicate true values. 
     As apparent to the skilled in the art the above algorithm can be converted to software code in many different ways and care should be taken to achieve computationally effective and efficient code, e.g. in the loops calculate only the parts that change in the loop. Such, and other simplifications, should be obvious to the skilled programmer and not considered to be a part of the invention. 
     Algorithms A4, A5, and A6: Multiple Fluorophores with Known Lifetimes and Binning of the Photon Times 
     In a further embodiment of the inventive method of the present invention the previous algorithm (A3) is modified to also account for the fact that the measurement system has a finite resolution in time. The resolution of the instrument is typically given by the sampling rate of the photon timing unit  150 , which could be of the order of 2G samples/s, giving a resolution of 0.5 ns. The finite resolution has the effect that it is not possible to separate in time photons arriving less than the time resolution apart; they are “binned” together. Instead of a set of arrival times, the data really consist of a fixed set of bin positions and for each excitation the number of photons arriving in each bin. This binning in time of the arrival times of the photons can be advantageously utilized in the Bayesian inference analysis; indeed algorithm A4 may in some ways be more useful than A3 even when the data are not binned, as it is easy to bin the data before using an inference algorithm. 
     Considering the procedure of algorithm A3, and in particular the step when we resample A j+1  from P(A|S j+1 ), we note that the only dynamic information we need to do this, other than the photon arrival times, is the set of quantities 
                 ∑     n   =   1     N     ⁢       ∑     k   =   1       K   n       ⁢     s     n   ,   k   ,   i           ,         
as we can see from the resampling equation (which defines the parameters of a Gamma distribution):
 
     
       
         
           
             
               
                 
                   
                     P 
                     ⁡ 
                     
                       ( 
                       
                         
                           
                             A 
                             i 
                           
                           ⁢ 
                           
                             | 
                           
                           ⁢ 
                           S 
                         
                         , 
                         D 
                       
                       ) 
                     
                   
                   = 
                   
                     
                       A 
                       i 
                       
                         
                           m 
                           
                             A 
                             i 
                           
                         
                         - 
                         1 
                         + 
                         
                           
                             ∑ 
                             
                               n 
                               = 
                               1 
                             
                             N 
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             
                               ∑ 
                               
                                 k 
                                 = 
                                 1 
                               
                               
                                 K 
                                 n 
                               
                             
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               s 
                               
                                 n 
                                 , 
                                 k 
                                 , 
                                 i 
                               
                             
                           
                         
                       
                     
                     ⁢ 
                     
                       
                         ⅇ 
                         
                           - 
                           
                             
                               A 
                               i 
                             
                             ⁡ 
                             
                               ( 
                               
                                 
                                   r 
                                   
                                     A 
                                     i 
                                   
                                 
                                 + 
                                 
                                   
                                     1 
                                     
                                       α 
                                       i 
                                     
                                   
                                   ⁢ 
                                   
                                     ( 
                                     
                                       
                                         N 
                                         ⁡ 
                                         
                                           ( 
                                           
                                             
                                               ⅇ 
                                               
                                                 
                                                   - 
                                                   
                                                     α 
                                                     i 
                                                   
                                                 
                                                 ⁢ 
                                                 τ 
                                               
                                             
                                             - 
                                             
                                               ⅇ 
                                               
                                                 
                                                   - 
                                                   
                                                     α 
                                                     i 
                                                   
                                                 
                                                 ⁢ 
                                                 v 
                                               
                                             
                                           
                                           ) 
                                         
                                       
                                       - 
                                       
                                         
                                           ( 
                                           
                                             1 
                                             - 
                                             
                                               ⅇ 
                                               
                                                 
                                                   - 
                                                   
                                                     α 
                                                     i 
                                                   
                                                 
                                                 ⁢ 
                                                 δ 
                                               
                                             
                                           
                                           ) 
                                         
                                         ⁢ 
                                         
                                           
                                             ∑ 
                                             
                                               n 
                                               = 
                                               1 
                                             
                                             N 
                                           
                                           ⁢ 
                                           
                                             
                                               ∑ 
                                               
                                                 k 
                                                 = 
                                                 1 
                                               
                                               
                                                 K 
                                                 n 
                                               
                                             
                                             ⁢ 
                                             
                                                 
                                             
                                             ⁢ 
                                             
                                               ⅇ 
                                               
                                                 
                                                   - 
                                                   
                                                     α 
                                                     i 
                                                   
                                                 
                                                 ⁢ 
                                                 
                                                   t 
                                                   
                                                     n 
                                                     , 
                                                     k 
                                                   
                                                 
                                               
                                             
                                           
                                         
                                       
                                     
                                     ) 
                                   
                                 
                               
                               ) 
                             
                           
                         
                       
                       . 
                     
                   
                 
               
               
                 
                   Equation 
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   18 
                 
               
             
           
         
       
     
     However, this set of quantities simply tells us how many photons are believed, by the current posterior sample, to come from each fluorophore. 
     Similarly, when resampling S j+1  from P(S|A j+1 ), the only dynamic information we need is the value of A j+1 , as can be seen from the resampling equation (which defines a discrete distribution): 
     
       
         
           
             
               
                 
                   
                     P 
                     ⁡ 
                     
                       ( 
                       
                         
                           
                             s 
                             
                               n 
                               , 
                               k 
                               , 
                               i 
                             
                           
                           = 
                           1 
                         
                         , 
                         
                           
                             
                               ( 
                               
                                 ∀ 
                                 
                                   
                                     i 
                                     ′ 
                                   
                                   ≠ 
                                   i 
                                 
                               
                               ) 
                             
                             ⁢ 
                             
                               s 
                               
                                 n 
                                 , 
                                 k 
                                 , 
                                 
                                   j 
                                   ′ 
                                 
                               
                             
                           
                           = 
                           
                             0 
                             | 
                             A 
                           
                         
                         , 
                         D 
                       
                       ) 
                     
                   
                   = 
                   
                     
                       
                         
                           A 
                           i 
                         
                         ⁢ 
                         
                           ⅇ 
                           
                             
                               - 
                               
                                 α 
                                 i 
                               
                             
                             ⁢ 
                             
                               t 
                               
                                 n 
                                 , 
                                 k 
                               
                             
                           
                         
                       
                       
                         
                           ∑ 
                           
                             i 
                             = 
                             1 
                           
                           I 
                         
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         
                           
                             A 
                             i 
                           
                           ⁢ 
                           
                             ⅇ 
                             
                               
                                 - 
                                 
                                   α 
                                   i 
                                 
                               
                               ⁢ 
                               
                                 t 
                                 
                                   n 
                                   , 
                                   k 
                                 
                               
                             
                           
                         
                       
                     
                     . 
                   
                 
               
               
                 
                   Equation 
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   19 
                 
               
             
           
         
       
     
     Thus it doesn&#39;t matter whether we remember or forget which photon is currently believed to come from which fluorophore; simply remembering how many there are in each time bin, and how many (total) are allocated to each fluorophore, is sufficient. 
     Instead of keeping track of, and resampling, the S variables then, we need only remember, and resample, the number of photons in each time bin believed to come from each fluorophore. 
     Formally then, we define b k,i  to be the number of photons in time bin k that came from fluorophore i, taking all the excitations together. Let c n,k  be the total number of photons in time bin k of excitation n; then C constitutes the data. Let d k  be the midtime of bin k and w k  be its width; we assume that for all other t in that same bin 
             ⅇ     -       max   i     ⁢       (     α   i     )     t               
differs negligibly from
 
             ⅇ     -       max   i     ⁢       (     α   i     )     ⁢     d   k                 
(and if this is not so we will use algorithm A7 below instead).
 
     As can be seen from the resampling equation for S j+1  therefore, the conditional distribution of b k  given A j+1  will be multinomial, with multi-way toss probabilities given by 
                 EMBED   ⁢         w   k     ⁢     A   i     ⁢     ⅇ       -     α   i       ⁢     d   k               ∑     i   =   1     I     ⁢           ⁢       w   k     ⁢     A   i     ⁢     ⅇ       -     α   i       ⁢     d   k                 =         A   i     ⁢     ⅇ       -     α   i       ⁢     d   k               ∑     i   =   1     I     ⁢           ⁢       A   i     ⁢     ⅇ       -     α   i       ⁢     d   k                 ,         
and total number of tosses
 
     
       
         
           
             
               
                 
                   
                     ∑ 
                     
                       n 
                       = 
                       1 
                     
                     N 
                   
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   
                     
                       c 
                       
                         n 
                         , 
                         k 
                       
                     
                     . 
                   
                 
               
               
                 
                   Equation 
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   20 
                 
               
             
           
         
       
     
     For odd j we now draw a sample from a multinomial distribution with the multi-way toss probabilities defined above, while for even j we resample A j+1  according to 
     
       
         
           
             
               
                 
                   
                     P 
                     ⁡ 
                     
                       ( 
                       
                         
                           
                             A 
                             i 
                           
                           | 
                           B 
                         
                         , 
                         D 
                       
                       ) 
                     
                   
                   = 
                   
                     
                       A 
                       i 
                       
                         
                           m 
                           
                             A 
                             i 
                           
                         
                         - 
                         1 
                         + 
                         
                           
                             ∑ 
                             
                               k 
                               = 
                               1 
                             
                             K 
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             b 
                             
                               k 
                               , 
                               i 
                             
                           
                         
                       
                     
                     ⁢ 
                     
                       ⅇ 
                       
                         - 
                         
                           
                             A 
                             i 
                           
                           ⁡ 
                           
                             ( 
                             
                               
                                 r 
                                 
                                   A 
                                   i 
                                 
                               
                               + 
                               
                                 
                                   1 
                                   
                                     α 
                                     i 
                                   
                                 
                                 ⁢ 
                                 
                                   ( 
                                   
                                     
                                       N 
                                       ⁡ 
                                       
                                         ( 
                                         
                                           
                                             ⅇ 
                                             
                                               
                                                 - 
                                                 
                                                   α 
                                                   i 
                                                 
                                               
                                               ⁢ 
                                               τ 
                                             
                                           
                                           - 
                                           
                                             ⅇ 
                                             
                                               
                                                 - 
                                                 
                                                   α 
                                                   i 
                                                 
                                               
                                               ⁢ 
                                               v 
                                             
                                           
                                         
                                         ) 
                                       
                                     
                                     - 
                                     
                                       
                                         ( 
                                         
                                           1 
                                           - 
                                           
                                             ⅇ 
                                             
                                               
                                                 - 
                                                 
                                                   α 
                                                   i 
                                                 
                                               
                                               ⁢ 
                                               δ 
                                             
                                           
                                         
                                         ) 
                                       
                                       ⁢ 
                                       
                                         
                                           ∑ 
                                           
                                             n 
                                             = 
                                             1 
                                           
                                           N 
                                         
                                         ⁢ 
                                         
                                             
                                         
                                         ⁢ 
                                         
                                           
                                             ∑ 
                                             
                                               k 
                                               = 
                                               1 
                                             
                                             K 
                                           
                                           ⁢ 
                                           
                                               
                                           
                                           ⁢ 
                                           
                                             
                                               c 
                                               
                                                 n 
                                                 , 
                                                 k 
                                               
                                             
                                             ⁢ 
                                             
                                               ⅇ 
                                               
                                                 
                                                   - 
                                                   
                                                     α 
                                                     i 
                                                   
                                                 
                                                 ⁢ 
                                                 
                                                   d 
                                                   k 
                                                 
                                               
                                             
                                           
                                         
                                       
                                     
                                   
                                   ) 
                                 
                               
                             
                             ) 
                           
                         
                       
                     
                   
                 
               
               
                 
                   Equation 
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   21 
                 
               
             
           
         
       
     
     How to draw samples from a multinomial distribution efficiently will be shown in appendix. Asymptotically it takes only as long as the square root of the total number of photons in the bin multiplied by the largest toss probability. The run time is no longer, as in algorithm A3, proportional to the number of photons received, but to the square root of that number. 
     With the above reasoning and derivation algorithm A3 can be modified accordingly and is described below and with references to the flowcharts of  FIG. 3 . 
     Algorithm A4:
     700: In a first initialising step 700, which is included in step 300 of the flowchart of  FIG. 3 , the user enters functions, values or distributions describing α and A.   700: 1 a) If information from previous experiments:   700: 1.1 i) and if posterior of previous experiments are of Gamma form (eq. 3):
       copy m and r from the posterior of the previous experiment   
       700: 1.2 ii) if other distribution form, e.g. f(A i ):
       plot f(A i ) and adjust m A     i   ,r A     i    until Gamma functions mimics f(A i ) or   consider information loss   
       

               I     m   ,   r       =     ∫       f   ⁡     (   A   )       ⁢   log   ⁢       f   ⁡     (   A   )           Γ     m   ,   r       ⁡     (   A   )         ⁢     ⅆ   A               
and adjust m and r for minimum I m,r  using some minimisation routine.
     700: 2 b) If information is vague knowledge of fluorophore; for each fluorophore pick m A     i   ,r A     i    r so that distribution fits “mental image”:   700: 2.1 i) for each A i  do   700: 2.1.1 a) pick m A     i   &gt;0 (that the larger the value the narrower the prior)   700: 2.1.2 b) pick mean μ of prior (e.g. 1080-1 photon per 10 ns)   700: 2.1.3 c) set r A     i   =m A     i   /μ   700: 2.1.4 d) plot prior on screen (linear or log scale)   700: 2.1.5 e) does the plot match the desired mental image? Yes—new A i  (goto i), No—repeat (a) to (e) as necessary   705: In a measuring step 705, which corresponds to the steps 305-320, datasets of arrival times are collected D n .   710: The Bayesian inference analysis, step 710 (corresponding to 325) comprises the substeps (710: 1-4) of:   710: 1 Initialize:   710: 1.1 set bin size and position (from hardware design)   710: 1.2 count photons in each time bin:   

     
       
         
           
             
               c 
               k 
             
             = 
             
               
                 ∑ 
                 
                   n 
                   = 
                   1 
                 
                 N 
               
               ⁢ 
               
                   
               
               ⁢ 
               
                 c 
                 
                   n 
                   , 
                   k 
                 
               
             
           
         
       
         
         710: 1.3 set number of samples required 
         710: 1.4 select starting value for each A i , options:
       i) select random sample from prior on A i      ii) select mean from prior on A i      iii) select mode from prior on A i      iv) user input data   
     
         710: 2 Update B 
         710: 2.1 For each k(1, 2, . . . , K) 
         710: 2.1.1 Update b k    
         710: 2.1.1.1 set b k  to be a random sample from the multinomial distribution with 
       
    
               c   k     =       ∑     n   =   1     N     ⁢           ⁢     c     n   ,   k               
total tosses and toss probabilities
 
     
       
         
           
             
               p 
               i 
             
             = 
             
               
                 
                   
                     A 
                     i 
                   
                   ⁢ 
                   
                     ⅇ 
                     
                       
                         - 
                         
                           α 
                           i 
                         
                       
                       ⁢ 
                       
                         d 
                         k 
                       
                     
                   
                 
                 
                   
                     ∑ 
                     
                       i 
                       = 
                       1 
                     
                     I 
                   
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   
                     
                       A 
                       i 
                     
                     ⁢ 
                     
                       ⅇ 
                       
                         
                           - 
                           
                             α 
                             i 
                           
                         
                         ⁢ 
                         
                           d 
                           k 
                         
                       
                     
                   
                 
               
               ⁢ 
               
                 ( 
                 
                   see 
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   Appendix 
                 
                 ) 
               
             
           
         
       
         
         710: 2.2 Next k 
         710: 3 Update A 
         710: 3.1 For each i(1, 2, . . . , I) 
         710: 3.1.1 Update A i    
         710: 3.1.1.1 Calculate 
       
    
     
       
         
           
             m 
             = 
             
               
                 m 
                 
                   A 
                   i 
                 
               
               + 
               
                 
                   ∑ 
                   
                     n 
                     = 
                     1 
                   
                   N 
                 
                 ⁢ 
                 
                     
                 
                 ⁢ 
                 
                   
                     ∑ 
                     
                       k 
                       = 
                       1 
                     
                     K 
                   
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   
                     b 
                     
                       k 
                       , 
                       i 
                     
                   
                 
               
             
           
         
       
         
         710: 3.1.1.2 Calculate 
       
    
     
       
         
           
             
               r 
               i 
             
             = 
             
               
                 r 
                 
                   A 
                   i 
                 
               
               + 
               
                 
                   1 
                   
                     α 
                     i 
                   
                 
                 ⁢ 
                 
                   ( 
                   
                     
                       N 
                       ⁡ 
                       
                         ( 
                         
                           
                             ⅇ 
                             
                               
                                 - 
                                 
                                   α 
                                   i 
                                 
                               
                               ⁢ 
                               τ 
                             
                           
                           - 
                           
                             ⅇ 
                             
                               
                                 - 
                                 
                                   α 
                                   i 
                                 
                               
                               ⁢ 
                               v 
                             
                           
                         
                         ) 
                       
                     
                     - 
                     
                       
                         ( 
                         
                           1 
                           - 
                           
                             ⅇ 
                             
                               
                                 - 
                                 
                                   α 
                                   i 
                                 
                               
                               ⁢ 
                               δ 
                             
                           
                         
                         ) 
                       
                       ⁢ 
                       
                         
                           ∑ 
                           
                             n 
                             = 
                             1 
                           
                           N 
                         
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         
                           
                             ∑ 
                             
                               k 
                               = 
                               1 
                             
                             K 
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             
                               c 
                               k 
                             
                             ⁢ 
                             
                               ⅇ 
                               
                                 
                                   - 
                                   
                                     α 
                                     i 
                                   
                                 
                                 ⁢ 
                                 
                                   d 
                                   k 
                                 
                               
                             
                           
                         
                       
                     
                   
                   ) 
                 
               
             
           
         
       
         
         710: 3.1.1.3 Set new value of A i  to be a random sample from the Gamma distribution with parameters m, r i  (see Appendix) 
         710: 3.2 Next i 
         710: 4 Add value of A to list of samples of A 
         710: 5 Enough samples? Yes—goto 720, No—repeat 710: 1-5 
         720: In an outputting step 720 (corresponding to 330) the resulting list of samples is presented to the user. Optionally histograms (corresponding to the marginal distributions of previous algorithms) can be presented. Other measures can be calculated from the histograms for example the marginal means with the 5 th  and 95 th  centiles and/or fractions of total intensity. 
       
    
     Similarly to previous algorithm it is possible to reverse the order of updating A and B with slight modifications of the algorithm. 
     The majority of the running time of algorithm A4 is occupied in drawing random samples from multinomial distributions (substep 710: 2). Replacing those samples with their mean will result in a faster algorithm. A noticeable deterioration in accuracy of the result can be expected, although under some circumstances it may still be considered usable. The algorithm modified in this way will be referred to as A5, A further simplification is to replace the Gamma samples (substep 710: 3) with their means, which will result in an even faster but very inaccurate algorithm, which will be referred to as A6. 
     Algorithm A7. Multiple Fluorophore with Known Lifetimes and Binning of the Photon Times in Bins and Subbins 
     A further embodiment of the inventive method of the present invention illustrates the power and usefulness of the method. Suppose the bins introduced in the previous algorithm are too large, i.e. the resolution of the instrument is lower than apparently needed for the specific measurement. The algorithm described below, will by introducing subbins, dividing each bin into a number of subbins, make it possible to extract information that would otherwise been obscured by the resolution of the instrument. The subbins do not necessarily have to be of equal size, for example they could be spaced logarithmically; nor is it necessary that each bin contains the same number of subbins as each other bin. 
     We now introduce a number of extra variables similar to the B variables, but indicating not only which fluorophore each photon comes from, but also which subbin it falls in within the bin in which it is known to fall. 
     Resampling of A j+1  from P(A|B j,+1 ) occurs in exactly the same way as in A4. Resampling of B j+1  from P(B|A j+1 ), however, now occurs over, for each bin, a multinomial distribution with the number of options being the product of the number of fluorophores and the number of subbins, and the total number of tosses being the total number of photons in that bin, and the multi-way toss probabilities being determined by the subbin centre time and fluorophore decay time that are relevant. Finally, of course, we discard the subbin information just as we discard the B variable information. 
     In detail then, suppose the original time bins are centered on times d k  as before, but that bin k is now divided into L k  subbins with times centered on d k,l  and of width w k,j . Similarly, let b k,i,l  denote the number of photons currently supposed to have come from fluorophore i and to be in subbin l of bin k. Then the multinomial distribution over which we have to resample b k  has now IL k  possible toss outcomes, still with 
                     ⁢     Equation   ⁢           ⁢   22                 EMBED   ,         w     k   ,   l       ⁢     A   i     ⁢     ⅇ       -     α   i       ⁢     d     k   ,   l           ⁢     ⅇ       ∑       i   ′     =   1     I     ⁢           ⁢     (         A     i   ′         α     i   ′         ⁢     (     1   -     ⅇ       -     α   i       ⁢   δ         )     ⁢       ∑     k   =   1     K     ⁢           ⁢     ⅇ       -     α     i   ′         ⁢     d     k   ,   l               )               ∑     i   =   1     i     ⁢           ⁢       ∑     l   =   1       L   k       ⁢           ⁢       w     k   ,   l       ⁢     A   i     ⁢     ⅇ       -     α   i       ⁢     d     k   ,   l           ⁢     ⅇ       ∑       i   ′     =   1     I     ⁢           ⁢     (         A     i   ′         α     i   ′         ⁢     (     1   -     ⅇ       -     α   i       ⁢   δ         )     ⁢       ∑     k   =   1     K     ⁢           ⁢     ⅇ       -     α     i   ′         ⁢     d     k   ,   l               )                       
total tosses. However, calculating the toss probabilities is slightly more difficult than it was before. Working from equation 20 for P(A,S|D), we find that the probability for toss outcome (i,l) in bin k is
 
               ∑     n   =   1     N     ⁢           ⁢     c     n   ,   k             
while when resampling A j+1  we must work from
 
                     ⁢     Equation   ⁢           ⁢   23                     P   ⁡     (         A   i     |   B     ,   D     )       =       A   i       m     A   i       -   1   +       ∑     k   =   1     K     ⁢           ⁢       ∑     l   =   1       L   k       ⁢           ⁢     b     k   ,   i   ,   j               ⁢     ⅇ     -       A   i     ⁡     (       r     A   i       +       1     α   i       ⁢     (       N   ⁡     (       ⅇ       -     α   i       ⁢   τ       -     ⅇ       -     α   i       ⁢   v         )       -       (     1   -     ⅇ       -     α   i       ⁢   δ         )     ⁢       ∑     k   =   1     K     ⁢           ⁢       ∑     l   =   1       L   k       ⁢           ⁢     (       ⅇ       -     α   i       ⁢     d     k   ,   l           ⁢       ∑       i   ′     =   1     I     ⁢           ⁢     b     k   ,     l   ′     ,   l           )             )         )               ,         
which as usual is a Gamma distribution.
 
     With the above reasoning and derivation, algorithm A4 can be modified accordingly and is described below and with references to the flowcharts of  FIG. 3 . The modifications occur in the substeps of the Bayesian inference analysis, substeps 810; 1-5 corresponding to step 710: 1-5 of algorithm A4, only. Therefore only these substeps are described below. 
     Algorithm A7:
         810: 1 The Bayesian inference analysis, step 810 (corresponding to 710) comprises the substeps of:   810: 1 Initialize:   810: 1.1 set bin size and position: d k  (k=1, 2, . . . , K) (from hardware design)   810: 1.2 set subbin size and position for each k: d k,j  (l=1, 2, . . . , L k ) (inside d k &#39;s bin)   810: 1.3 count photons in each time bin:       

     
       
         
           
             
               c 
               k 
             
             = 
             
               
                 ∑ 
                 
                   n 
                   = 
                   1 
                 
                 N 
               
               ⁢ 
               
                   
               
               ⁢ 
               
                 c 
                 
                   n 
                   , 
                   k 
                 
               
             
           
         
       
         
         
           
             810: 1.4 set number of samples required 
             810: 1.5 select starting value for each A i , options:
           i) select random sample from prior on A i      ii) select mean from prior on A i      iii) select mode from prior on A i      iv) user input data   
         
             810: 2 Update B 
             810: 2.1 For each k(1, 2, . . . , K) 
             810: 2.1.1 Update b k : 
             set b k  to be a random sample from the multinomial distribution with 
           
         
       
    
               c   k     =       ∑     n   =   1     N     ⁢           ⁢     c     n   ,   k               
total tosses, IL k  outcomes and toss probability
 
     
       
         
           
             EMBED 
             ⁢ 
             
               
                 
                   w 
                   
                     k 
                     , 
                     l 
                   
                 
                 ⁢ 
                 
                   A 
                   i 
                 
                 ⁢ 
                 
                   ⅇ 
                   
                     
                       - 
                       
                         α 
                         i 
                       
                     
                     ⁢ 
                     
                       d 
                       
                         k 
                         , 
                         j 
                       
                     
                   
                 
                 ⁢ 
                 
                   ⅇ 
                   
                     
                       ∑ 
                       
                         
                           i 
                           ′ 
                         
                         = 
                         1 
                       
                       I 
                     
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     
                       ( 
                       
                         
                           
                             A 
                             
                               i 
                               ′ 
                             
                           
                           
                             α 
                             
                               i 
                               ′ 
                             
                           
                         
                         ⁢ 
                         
                           ( 
                           
                             1 
                             - 
                             
                               ⅇ 
                               
                                 
                                   - 
                                   
                                     α 
                                     
                                       i 
                                       ′ 
                                     
                                   
                                 
                                 ⁢ 
                                 δ 
                               
                             
                           
                           ) 
                         
                         ⁢ 
                         
                           
                             ∑ 
                             
                               k 
                               = 
                               1 
                             
                             K 
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             ⅇ 
                             
                               
                                 - 
                                 
                                   α 
                                   
                                     i 
                                     ′ 
                                   
                                 
                               
                               ⁢ 
                               
                                 d 
                                 
                                   k 
                                   , 
                                   l 
                                 
                               
                             
                           
                         
                       
                       ) 
                     
                   
                 
               
               
                 
                   ∑ 
                   
                     i 
                     = 
                     1 
                   
                   i 
                 
                 ⁢ 
                 
                     
                 
                 ⁢ 
                 
                   
                     ∑ 
                     
                       l 
                       = 
                       1 
                     
                     
                       L 
                       k 
                     
                   
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   
                     
                       w 
                       
                         k 
                         , 
                         l 
                       
                     
                     ⁢ 
                     
                       A 
                       i 
                     
                     ⁢ 
                     
                       ⅇ 
                       
                         
                           - 
                           
                             α 
                             i 
                           
                         
                         ⁢ 
                         
                           d 
                           
                             k 
                             , 
                             l 
                           
                         
                       
                     
                     ⁢ 
                     
                       ⅇ 
                       
                         
                           ∑ 
                           
                             
                               i 
                               ′ 
                             
                             = 
                             1 
                           
                           I 
                         
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         
                           ( 
                           
                             
                               
                                 A 
                                 
                                   i 
                                   ′ 
                                 
                               
                               
                                 α 
                                 
                                   i 
                                   ′ 
                                 
                               
                             
                             ⁢ 
                             
                               ( 
                               
                                 1 
                                 - 
                                 
                                   ⅇ 
                                   
                                     
                                       - 
                                       
                                         α 
                                         
                                           i 
                                           ′ 
                                         
                                       
                                     
                                     ⁢ 
                                     δ 
                                   
                                 
                               
                               ) 
                             
                             ⁢ 
                             
                               
                                 ∑ 
                                 
                                   k 
                                   = 
                                   1 
                                 
                                 K 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 ⅇ 
                                 
                                   
                                     - 
                                     
                                       α 
                                       
                                         i 
                                         ′ 
                                       
                                     
                                   
                                   ⁢ 
                                   
                                     d 
                                     
                                       k 
                                       , 
                                       l 
                                     
                                   
                                 
                               
                             
                           
                           ) 
                         
                       
                     
                   
                 
               
             
           
         
       
       
         
           
             ( 
             
               see 
               ⁢ 
               
                   
               
               ⁢ 
               Appendix 
             
             ) 
           
         
       
         
         
           
             810: 2.2 Next k 
             810: 3 Update A 
             810: 3.1 For each i(1, 2, . . . , I) 
             810: 3.1.1 Update A i : 
           
         
         810: 3.1.1.1 Calculate 
       
    
     
       
         
           
             m 
             = 
             
               
                 m 
                 
                   A 
                   i 
                 
               
               + 
               
                 
                   ∑ 
                   
                     k 
                     = 
                     1 
                   
                   K 
                 
                 ⁢ 
                 
                     
                 
                 ⁢ 
                 
                   
                     ∑ 
                     
                       l 
                       = 
                       1 
                     
                     
                       L 
                       k 
                     
                   
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   
                     b 
                     
                       k 
                       , 
                       i 
                       , 
                       l 
                     
                   
                 
               
             
           
         
       
         
         
           
             810: 3.1.1.2 Calculate 
           
         
       
    
     
       
         
           
             
               r 
               i 
             
             = 
             
               
                 r 
                 
                   A 
                   i 
                 
               
               + 
               
                 
                   1 
                   
                     α 
                     i 
                   
                 
                 ⁢ 
                 
                   ( 
                   
                     
                       N 
                       ⁡ 
                       
                         ( 
                         
                           
                             ⅇ 
                             
                               
                                 - 
                                 
                                   α 
                                   i 
                                 
                               
                               ⁢ 
                               τ 
                             
                           
                           - 
                           
                             ⅇ 
                             
                               
                                 - 
                                 
                                   α 
                                   i 
                                 
                               
                               ⁢ 
                               v 
                             
                           
                         
                         ) 
                       
                     
                     - 
                     
                       
                         ( 
                         
                           1 
                           - 
                           
                             ⅇ 
                             
                               
                                 - 
                                 
                                   α 
                                   i 
                                 
                               
                               ⁢ 
                               δ 
                             
                           
                         
                         ) 
                       
                       ⁢ 
                       
                         
                           ∑ 
                           
                             k 
                             = 
                             1 
                           
                           K 
                         
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         
                           
                             ∑ 
                             
                               l 
                               = 
                               1 
                             
                             
                               L 
                               k 
                             
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             
                               ( 
                               
                                 ⅇ 
                                 
                                   
                                     - 
                                     
                                       α 
                                       i 
                                     
                                   
                                   ⁢ 
                                   
                                     d 
                                     k 
                                   
                                 
                               
                               ) 
                             
                             ⁢ 
                             
                               
                                 ∑ 
                                 
                                   
                                     i 
                                     ′ 
                                   
                                   = 
                                   1 
                                 
                                 I 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 b 
                                 
                                   k 
                                   , 
                                   
                                     i 
                                     ′ 
                                   
                                   , 
                                   l 
                                 
                               
                             
                           
                         
                       
                     
                   
                   ) 
                 
               
             
           
         
       
         
         
           
             810: 3.1.1.3 Set new value of A i  to be a random sample from the Gamma distribution with parameters m,r i (see Appendix) 
             810: 3.2 Next i 
             810: 4 Add value of A to list of samples of A 
             810: 5 Enough samples? Yes—goto 820, No—repeat 810: 2-5 
           
         
       
    
     Just as in the previous algorithm it is possible to reverse the order of updating A and B with slight modifications of the algorithm. 
     Algorithm A8, Multiple Fluorophore with Unknown Lifetimes and Binning of the Photon Times in Bins and Subbins 
     The principle of binning of the photon arrival times in bins and subbins can be utilized also in the case of multiple fluorophores with unknown lifetimes, which will be illustrated below in an embodiment of the present invention. It can be seen as a generalization of algorithm A7. As before when the lifetimes are unknown, we presume Gamma priors on them. The simplifications that result in the simpler case where (∀k)L k =1 should be obvious. 
     As enunciated in the description of algorithm A2 above, the posterior here before binning is given by 
                       P   ⁡     (     A   ,     α   |   D       )       ∝       (       ∏     i   =   1     I     ⁢           ⁢       A   i       m     A   i       -   1       ⁢     α   i       m     α   i       -   1           )     ⁢     (       ∏     n   =   1     N     ⁢           ⁢       ∏     k   =   1       K   n       ⁢           ⁢       ∑     i   =   1     I     ⁢           ⁢       A   i     ⁢     ⅇ       -     α   i       ⁢     t     n   ,   k                   )         ⁢     
     ⁢     ⅇ     -       ∑     i   =   1     I     ⁢           ⁢     (         r     A   i       ⁢     A   i       +       r     α   i       ⁢     α   i       +         A   i       α   i       ⁢     (       N   ⁡     (       ⅇ       -     α   i       ⁢   τ       -     ⅇ       -     α   i       ⁢   ν         )       -       (     1   -     e       -     a   i       ⁢   δ         )     ⁢       ∑     n   =   1     N     ⁢           ⁢       ∑     k   =   1       K   n       ⁢           ⁢     ⅇ       -     α   i       ⁢     t     n   ,   k                   )         )                   Equation   ⁢           ⁢   24               
while with binned data and the additional variables, using the notation of the last algorithms, we have
 
                       EMBED   (     A   ,   α   ,     B   |   D       )     ∝     (       ∏     k   =   1     K     ⁢           ⁢       ∏     l   =   1       L   k       ⁢           ⁢     w     k   ,   l         ∑     i   =   1     I     ⁢           ⁢     b     k   ,   i   ,   l               )       ⁢     
     ⁢       (       ∏     i   =   1     I     ⁢           ⁢       A   i       m     A   i       -   1   +       ∑     k   =   1     K     ⁢           ⁢       ∑     l   =   1       L   k       ⁢           ⁢     b     k   ,   i   ,   l               ⁢     α   i       m     α   i       -   1           )     ·     ⅇ     -       ∑     i   =   1     I     ⁢           ⁢     (         r     A   i       ⁢     A   i       +       α   i     ⁡     (       r     α   i       +       ∑     k   =   1     K     ⁢           ⁢       ∑     l   =   1       L   k       ⁢           ⁢       b     k   ,   i   ,   l       ⁢     d     k   ,   l               )       +         A   i       α   i       ⁢     (       N   ⁡     (       ⅇ       -     α   i       ⁢   τ       -     ⅇ       -     α   i       ⁢   v         )       -       (     1   -     ⅇ       -     α   i       ⁢   δ         )     ⁢       ∑     k   =   1     K     ⁢           ⁢       ∑     l   =   1       L   k       ⁢           ⁢     (       ⅇ       -     α   i       ⁢     d     k   ,   l           ⁢       ∑       i   ′     =   1     I     ⁢           ⁢     b     k   ,     i   ′     ,   l           )             )         )                     Equation   ⁢           ⁢   25               
under the constraint that for all k we have
 
                 ∑     l   =   1       L   k       ⁢           ⁢       ∑     i   =   1     I     ⁢           ⁢     b     k   ,   i   ,   l           =       ∑     n   =   1     N     ⁢           ⁢     c     n   ,   k               
(and otherwise P(A,α,B|D)=0).
 
     It is now easy to write down the conditional distributions: 
                     ⁢     Equation   ⁢           ⁢   26                   P   ⁡     (       A   |   α     ,   B   ,   D     )       ∝     (       ∏     i   =   1     I     ⁢           ⁢     A   i       m     A   i       -   1   +       ∑     k   =   1     K     ⁢           ⁢       ∑     l   =   1       L   k       ⁢           ⁢     b     k   ,   i   ,   l                 )                 ⅇ     -       ∑     i   =   1     I     ⁢           ⁢     (       A   i     ⁡     (       r     A   i       +       1     α   i       ⁢     (       N   ⁡     (       ⅇ       -     α   i       ⁢   τ       -     ⅇ       -     α   i       ⁢   v         )       -       (     1   -     ⅇ       -     α   i       ⁢   δ         )     ⁢       ∑     k   =   1     K     ⁢           ⁢     (       ∑     l   =   1       L   k       ⁢           ⁢       ⅇ       -     α   i       ⁢     d     k   ,   l           ⁢       ∑       i   ′     =   1     I     ⁢           ⁢     b     k   ,     i   ′     ,   l             )           )         )       )               
(which is a product of Gamma distributions);
 
     P(B|A,α,D) is a product of multinomials, with P(b k |A,α,D) having toss probabilities 
                     ⁢     Equation   ⁢           ⁢   27                 EMBED   ⁢         w     k   ,   l       ⁢     A   i     ⁢     ⅇ       -     α   i       ⁢     d     k   ,   l           ⁢     ⅇ       ∑       i   ′     =   1     I     ⁢           ⁢     (         A     i   ′         α     i   ′         ⁢     (     1   -     ⅇ       -     α     i   ′         ⁢   δ         )     ⁢       ∑     k   =   1     K     ⁢           ⁢     ⅇ       -     α     i   ′         ⁢     d     k   ,   l               )               ∑     i   =   1     i     ⁢           ⁢       ∑     l   =   1       L   k       ⁢           ⁢       w     k   ,   l       ⁢     A   i     ⁢     ⅇ       -     α   i       ⁢     d     k   ,   l           ⁢     ⅇ       ∑       i   ′     =   1     I     ⁢           ⁢     (         A     i   ′         α     i   ′         ⁢     (     1   -     ⅇ       -     α     i   ′         ⁢   δ         )     ⁢       ∑     k   =   1     K     ⁢           ⁢     ⅇ       -     α     i   ′         ⁢     d     k   ,   l               )                       
and total tosses
 
                 ∑     n   =   1     N     ⁢           ⁢     c     n   ,   k         ;         
while finally
 
                           P   ⁡     (     A   ,     α   |   B     ,   D     )       ⁢       ∝     (       ∏     i   =   1     I     ⁢           ⁢       A   i       m     A   i       -   1   +       ∑     k   =   1     K     ⁢           ⁢       ∑     l   =   1       L   k       ⁢           ⁢     b     k   ,   i   ,   l               ⁢     α   i       m     α   i       -   1           )                     ⁢     ⅇ     -       ∑     i   =   1     I     ⁢           ⁢     (         r     A   i       ⁢     A   i       +       α   i     ⁡     (       r     α   i       +       ∑     k   =   1     K     ⁢           ⁢       ∑     l   =   1       L   k       ⁢           ⁢       b     k   ,   i   ,   l       ⁢     d     k   ,   l               )       +         A   i       α   i       ⁢     (       N   ⁡     (       ⅇ       -     α   i       ⁢   τ       -     ⅇ       -     α   i       ⁢   v         )       -       (     1   -     ⅇ       -     α   i       ⁢   δ         )     ⁢       ∑     k   =   1     K     ⁢           ⁢     (       ∑     l   =   1       L   k       ⁢           ⁢       ⅇ       -     α   i       ⁢     d     k   ,   l           ⁢       ∑       i   ′     =   1     I     ⁢           ⁢     b     k   ,     i   ′     ,   l             )           )         )                       ∴       P   ⁡     (       α   |   B     ,   D     )       ⁢       ∝     ∫       P   ⁡     (     A   ,     α   |   B     ,   D     )       ⁢     ⅆ   A                           ⁢     =       ∏     i   =   1     I     ⁢           ⁢         α   i       m     α   i       -   1       ⁢     ⅇ     -       α   i     ⁡     (       r     α   i       +       ∑     k   =   1     K     ⁢           ⁢       ∑     l   =   1       L   k       ⁢           ⁢       b     k   ,   i   ,   l       ⁢     d     k   ,   l               )           ⁢     Γ   ⁡     (       m     A   i       +       ∑     k   =   1     K     ⁢           ⁢       ∑     l   =   1       L   k       ⁢           ⁢     b     k   ,   i   ,   l             )             (       r     A   i       +       1     α   i       ⁢     (       N   ⁡     (       ⅇ       -     α   i       ⁢   τ       -     ⅇ       -     α   i       ⁢   v         )       -       (     1   -     ⅇ       -     α   i       ⁢   δ         )     ⁢       ∑     k   =   1     K     ⁢           ⁢     (       ∑     l   =   1       L   k       ⁢           ⁢       ⅇ       -     α   i       ⁢     d     k   ,   l           ⁢       ∑       i   ′     =   1     I     ⁢           ⁢     b     k   ,     i   ′     ,   l             )           )         )         m     A   i       +       ∑     k   =   1     K     ⁢           ⁢       ∑     l   =   1       L   k       ⁢           ⁢     b     k   ,   i   ,   l                                   Equation   ⁢           ⁢   28               
where of course the Gamma functions do need to be calculated as they are not constants.
 
     Given these three conditional distributions, we can now in principle resample as follows. For odd j we now draw a sample for B j+1  from a multinomial distribution with the multi-way toss probabilities defined above, while for even j we resample (A j+i , α j+1 ) (α is a vector) by first sampling a from the marginal conditional P(α j+1 , |B j+1 , D), and then sampling A j+1  from the conditional distribution P(A j+1 |α j+1 ,B j+1 ,D). 
     The only part of the this procedure that has so far not been fully defined is the step of resampling from P(α j+1 |B j+1 ,D). This will be expanded below. 
     With the above reasoning and derivation, algorithm A7 can be modified accordingly and is described below and with references to the flowcharts of  FIG. 3 . The modifications of importance occur in the substeps of the Bayesian inference analysis, substeps 910: 1-4 corresponding to substeps 810: 1-4 of algorithm A4, only. Therefore only these substeps are described below. 
     Algorithm A8:
         910: The Bayesian inference analysis, step 910 (corresponding to 810) comprises the substeps of:   910: 1 Initialize:   910: 1.1 set bin size and position: d k  (k=1, 2, . . . , K) (from hardware design)   910: 1.2 set subbin size and position for each k: d k,l  (l=1, 2, . . . , L k ) (inside d k &#39;s bin)   910: 1.3 count photons in each time bin:       

     
       
         
           
             
               c 
               k 
             
             = 
             
               
                 ∑ 
                 
                   n 
                   = 
                   1 
                 
                 N 
               
               ⁢ 
               
                   
               
               ⁢ 
               
                 c 
                 
                   n 
                   , 
                   k 
                 
               
             
           
         
       
         
         
           
             910: 1.4 set number of samples required 
             910: 1.5 set both r A     i   , m A     i    and r α     i   ,m α     i    in one of the same ways that r A     i   ,m A     i    were set in algorithm A4. 
             910: 2: For each j: 
             910: 2.1 If j is odd: Update B. 
             910: 2.1.1 For each k(1, 2, . . . , K) 
             910: 2.1.1.1 Update b k :
           set b k  to be a random sample from the multinomial distribution with   
         
           
         
       
    
               c   k     =       ∑     n   =   1     N     ⁢           ⁢     c     n   ,   k               
total tosses, IL k  outcomes and toss probabilities
 
     
       
         
           
             EMBED 
             ⁢ 
             
               
                 
                   w 
                   
                     k 
                     , 
                     l 
                   
                 
                 ⁢ 
                 
                   A 
                   i 
                 
                 ⁢ 
                 
                   ⅇ 
                   
                     
                       - 
                       
                         α 
                         i 
                       
                     
                     ⁢ 
                     
                       d 
                       
                         k 
                         , 
                         l 
                       
                     
                   
                 
                 ⁢ 
                 
                   ⅇ 
                   
                     
                       ∑ 
                       
                         
                           i 
                           ′ 
                         
                         = 
                         1 
                       
                       I 
                     
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     
                       ( 
                       
                         
                           
                             A 
                             
                               i 
                               ′ 
                             
                           
                           
                             α 
                             
                               i 
                               ′ 
                             
                           
                         
                         ⁢ 
                         
                           ( 
                           
                             1 
                             - 
                             
                               ⅇ 
                               
                                 
                                   - 
                                   
                                     α 
                                     
                                       i 
                                       ′ 
                                     
                                   
                                 
                                 ⁢ 
                                 δ 
                               
                             
                           
                           ) 
                         
                         ⁢ 
                         
                           
                             ∑ 
                             
                               k 
                               = 
                               1 
                             
                             K 
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             ⅇ 
                             
                               
                                 - 
                                 
                                   a 
                                   
                                     i 
                                     ′ 
                                   
                                 
                               
                               ⁢ 
                               
                                 d 
                                 
                                   k 
                                   , 
                                   l 
                                 
                               
                             
                           
                         
                       
                       ) 
                     
                   
                 
               
               
                 
                   ∑ 
                   
                     i 
                     = 
                     1 
                   
                   I 
                 
                 ⁢ 
                 
                     
                 
                 ⁢ 
                 
                   
                     ∑ 
                     
                       l 
                       = 
                       1 
                     
                     
                       L 
                       k 
                     
                   
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   
                     
                       w 
                       
                         k 
                         , 
                         l 
                       
                     
                     ⁢ 
                     
                       A 
                       i 
                     
                     ⁢ 
                     
                       ⅇ 
                       
                         
                           - 
                           
                             α 
                             i 
                           
                         
                         ⁢ 
                         
                           d 
                           
                             k 
                             , 
                             l 
                           
                         
                       
                     
                     ⁢ 
                     
                       ⅇ 
                       
                         
                           ∑ 
                           
                             
                               i 
                               ′ 
                             
                             = 
                             1 
                           
                           I 
                         
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         
                           ( 
                           
                             
                               
                                 A 
                                 
                                   i 
                                   ′ 
                                 
                               
                               
                                 α 
                                 
                                   i 
                                   ′ 
                                 
                               
                             
                             ⁢ 
                             
                               ( 
                               
                                 1 
                                 - 
                                 
                                   ⅇ 
                                   
                                     
                                       - 
                                       
                                         α 
                                         
                                           i 
                                           ′ 
                                         
                                       
                                     
                                     ⁢ 
                                     δ 
                                   
                                 
                               
                               ) 
                             
                             ⁢ 
                             
                               
                                 ∑ 
                                 
                                   k 
                                   = 
                                   1 
                                 
                                 K 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 ⅇ 
                                 
                                   
                                     - 
                                     
                                       α 
                                       
                                         i 
                                         ′ 
                                       
                                     
                                   
                                   ⁢ 
                                   
                                     d 
                                     
                                       k 
                                       , 
                                       l 
                                     
                                   
                                 
                               
                             
                           
                           ) 
                         
                       
                     
                   
                 
               
             
           
         
       
       
         
           
             ( 
             
               see 
               ⁢ 
               
                   
               
               ⁢ 
               Appendix 
             
             ) 
           
         
       
         
         
           
             910: 2.1.2 Next k 
             910: 2.2 If j is even: 
             910: 2.2.1 Resample (A j+1 , α j+1 ) by 
             910: 2.2.1.1 Sampling a from P(α j+1 |B j+1 ,D) (eq. 28) (see below for description of how this is done) 
             910: 2.2.1.2 Sampling A j+1 , from P(A j+1 |α j+1 ,B j+1 ,D) (eq.26) 
             910: 2.2.2 Add A to list of samples of A 
             910: 3 next j: 
             910: 4 Enough samples? Yes—goto 920, No—repeat 910: 2-4 
           
         
       
    
     Sampling α from P(α j+1 |B j+1 ,D) (in step 935) is not obvious. Below a suitable method, readily converted into program code, is outlined. 
     Resampling from the conditional for a can be performed as follows: We introduce a Markov Chain Monte Carlo (MCMC) technique whose proposal distribution is not a conditional distribution, does depend on the previous sample and does not always accept the new sample. 
     Suppose then that we have values of B j+1 , and D, and also the previous value of the ith component of α namely α j,i  (we now have two subscripts in order to indicate both which sample and which component). Note that the conditional distribution of P(α|B,D) is separable over i, so that we can treat each component separately. Let the current conditional distribution P(α i |B,D) be denoted f(α i ), so that 
     
       
         
           
             
               
                 
                   
                     f 
                     ⁡ 
                     
                       ( 
                       
                         α 
                         i 
                       
                       ) 
                     
                   
                   ∝ 
                   
                     
                       
                         α 
                         i 
                         
                           
                             m 
                             
                               α 
                               i 
                             
                           
                           - 
                           1 
                         
                       
                       ⁢ 
                       
                         ⅇ 
                         
                           - 
                           
                             
                               α 
                               i 
                             
                             ⁡ 
                             
                               ( 
                               
                                 
                                   r 
                                   
                                     α 
                                     i 
                                   
                                 
                                 + 
                                 
                                   
                                     ∑ 
                                     
                                       k 
                                       = 
                                       1 
                                     
                                     K 
                                   
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   
                                     
                                       ∑ 
                                       
                                         l 
                                         = 
                                         1 
                                       
                                       
                                         L 
                                         k 
                                       
                                     
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     
                                       
                                         b 
                                         
                                           k 
                                           , 
                                           i 
                                           , 
                                           l 
                                         
                                       
                                       ⁢ 
                                       
                                         d 
                                         
                                           k 
                                           , 
                                           l 
                                         
                                       
                                     
                                   
                                 
                               
                               ) 
                             
                           
                         
                       
                       ⁢ 
                       
                         Γ 
                         ⁡ 
                         
                           ( 
                           
                             
                               m 
                               
                                 A 
                                 i 
                               
                             
                             + 
                             
                               
                                 ∑ 
                                 
                                   k 
                                   = 
                                   1 
                                 
                                 K 
                               
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 
                                   ∑ 
                                   
                                     l 
                                     = 
                                     1 
                                   
                                   
                                     L 
                                     k 
                                   
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   b 
                                   
                                     k 
                                     , 
                                     i 
                                     , 
                                     l 
                                   
                                 
                               
                             
                           
                           ) 
                         
                       
                     
                     
                       
                         ( 
                         
                           
                             r 
                             
                               A 
                               i 
                             
                           
                           + 
                           
                             
                               1 
                               
                                 α 
                                 i 
                               
                             
                             ⁢ 
                             
                               ( 
                               
                                 
                                   N 
                                   ⁡ 
                                   
                                     ( 
                                     
                                       
                                         ⅇ 
                                         
                                           
                                             - 
                                             
                                               α 
                                               i 
                                             
                                           
                                           ⁢ 
                                           τ 
                                         
                                       
                                       - 
                                       
                                         ⅇ 
                                         
                                           
                                             - 
                                             
                                               α 
                                               i 
                                             
                                           
                                           ⁢ 
                                           v 
                                         
                                       
                                     
                                     ) 
                                   
                                 
                                 - 
                                 
                                   
                                     ( 
                                     
                                       1 
                                       - 
                                       
                                         ⅇ 
                                         
                                           
                                             - 
                                             
                                               α 
                                               i 
                                             
                                           
                                           ⁢ 
                                           δ 
                                         
                                       
                                     
                                     ) 
                                   
                                   ⁢ 
                                   
                                     
                                       ∑ 
                                       
                                         k 
                                         = 
                                         1 
                                       
                                       K 
                                     
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     
                                       ( 
                                       
                                         
                                           ∑ 
                                           
                                             l 
                                             = 
                                             1 
                                           
                                           
                                             L 
                                             k 
                                           
                                         
                                         ⁢ 
                                         
                                             
                                         
                                         ⁢ 
                                         
                                           
                                             ⅇ 
                                             
                                               
                                                 - 
                                                 
                                                   α 
                                                   i 
                                                 
                                               
                                               ⁢ 
                                               
                                                 d 
                                                 
                                                   k 
                                                   , 
                                                   l 
                                                 
                                               
                                             
                                           
                                           ⁢ 
                                           
                                             
                                               ∑ 
                                               
                                                 
                                                   i 
                                                   ′ 
                                                 
                                                 = 
                                                 1 
                                               
                                               I 
                                             
                                             ⁢ 
                                             
                                                 
                                             
                                             ⁢ 
                                             
                                               b 
                                               
                                                 b 
                                                 , 
                                                 
                                                   i 
                                                   ′ 
                                                 
                                                 , 
                                                 l 
                                               
                                             
                                           
                                         
                                       
                                       ) 
                                     
                                   
                                 
                               
                               ) 
                             
                           
                         
                         ) 
                       
                       
                         
                           m 
                           
                             A 
                             i 
                           
                         
                         + 
                         
                           
                             ∑ 
                             
                               k 
                               = 
                               1 
                             
                             K 
                           
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             
                               ∑ 
                               
                                 l 
                                 = 
                                 1 
                               
                               
                                 L 
                                 k 
                               
                             
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               b 
                               
                                 k 
                                 , 
                                 i 
                                 , 
                                 l 
                               
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   Equation 
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   29 
                 
               
             
           
         
       
     
     Then the overall move in ai needs to satisfy detailed balance with respect to this distribution. It is easy to show that if it does, then the alternating sequence of moves described before will also hold detailed balance over every subsequence of three moves, and hence that the necessary conditions for our MCMC process will be met. 
     It is also easy to show that if we have two potential types of move that each holds detailed balance with respect to this distribution, then so also will a compound move that proceeds by choosing one of these two types at random (with any fixed probabilities) and applying it. We now then go on to describe two types of move, which we will use with some fixed probabilities (for example 0.5 and 0.5) whenever a move to resample α i  is required. 
     Both types of move involve sampling a proposed value α′ from a proposal distribution g(α′|α j,i ), dependent on the previous value of α i , namely α j,i , followed by a probabilistic decision either to accept α′ (in which case we set a j+1,i =α′) or to reject it (in which case we set α j+1,i =α j,i ). In both cases we accept with probability 
     
       
         
           
             
               
                 
                   
                     p 
                     α 
                   
                   = 
                   
                     
                       
                         
                           f 
                           ⁡ 
                           
                             ( 
                             
                               α 
                               ′ 
                             
                             ) 
                           
                         
                         ⁢ 
                         
                           g 
                           ⁡ 
                           
                             ( 
                             
                               
                                 α 
                                 
                                   j 
                                   , 
                                   i 
                                 
                               
                               | 
                               
                                 α 
                                 ′ 
                               
                             
                             ) 
                           
                         
                       
                       
                         
                           f 
                           ⁡ 
                           
                             ( 
                             
                               α 
                               
                                 j 
                                 , 
                                 i 
                               
                             
                             ) 
                           
                         
                         ⁢ 
                         
                           g 
                           ⁡ 
                           
                             ( 
                             
                               
                                 α 
                                 ′ 
                               
                               | 
                               
                                 α 
                                 
                                   j 
                                   , 
                                   i 
                                 
                               
                             
                             ) 
                           
                         
                       
                     
                     . 
                   
                 
               
               
                 
                   Equation 
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   30 
                 
               
             
           
         
       
     
     All that remains then is to define the two proposal distributions, one for each type of move. 
     Proposal Distribution 1—“The Coarse Grid”: 
     Let α j,i  be given; fix also (once and for all) some parameters γ and H, where γ is a positive real number (20 will do) and H is a positive integer (again, 20 will do). Then let X 1  be the set 
               {       x   h     =       α     j   ,   i       ⁢       γ     h   H       :     h   ⁢           ⁢   ε   ⁢     {       -   H     ,       -   H     +   1     ,   …   ,     H   -   1     ,   H     }             }     ,         
and let g 1 (α′|α j,i ) be the unique (discrete) probability distribution on X 1  that is proportional to f(x).
 
Proposal Distribution 2—“The Fine Fill-In”:
 
     Using the same parameters γ and H, let X 2  be the closed interval 
               [         α     j   ,   i       ⁢     γ     -     1   H           ,       α     j   ,   i       ⁢     γ     +     1   H             ]     ,         
and let g 2  (α′|α j,i ) be the unique (continuous) probability distribution on X 2  that is proportional to
 
     
       
         
           
             
               1 
               x 
             
             . 
           
         
       
     
     The measurement system with the capability of detecting and recording multiple photons after one excitation in combination with the method of the present invention, the essence of which is implementing Bayesian inference in the algorithms executed during each measurement, represents a significant improvement in measurement speed over the prior art techniques. The inventive method of, in each measurement, inferring the source (i.e. the originating fluorophore) of each photon, further shortens the measurement time (algorithm A3). In Table 1 a comparison is given of the measurement times of four different dyes (having different lifetimes) using the TCSPC and the TCMPC techniques. The same solutions were used with both instruments. These numbers are only indicative, but show a faster speed for the TCMPC technique. 
     
       
         
               
             
               
               
               
             
               
               
               
             
               
               
               
             
           
               
                 TABLE 1 
               
             
             
               
                   
               
               
                 Measurement time with different dyes 
               
               
                 using TCSPC and TCMPC, respectively. 
               
             
          
           
               
                   
                 Time to run the 
                   
               
               
                   
                 experiment(s) 
               
             
          
           
               
                 Lifetime of the Dye 
                 TCSPC 
                 TCMPC 
               
               
                   
               
             
          
           
               
                  4 ns 
                 493 
                 9.94 
               
               
                  8 ns 
                  28 
                 9.55 
               
               
                 14 ns 
                 196 
                 18.79 
               
               
                 20 ns 
                 640 
                 13.35 
               
               
                   
               
             
          
         
       
     
     In the described method according to the present invention, the fluorescence decay of a fluorophore bound to a biological molecule has been modelled by a mono-exponential decay or in some cases a bi-exponential decay. However, there are situations in which one does not expect a limited number of discrete decay times but rather a distribution of decay times. In complex heterogeneous biological systems, multi-exponential decays functions can appear to provide a better fit of the fluorescence decay data than the assumption of a mono-exponential decay. But the assumption of multiple discrete components is essentially arbitrary and is often erroneous. For example, for a single tryptophan protein, the distribution of decay time may reflect the distribution of protein conformation, alternatively it could be a protein with many tryptophan residues, so it is not practical to consider the individual decay times. Moreover, interaction between the fluorophore and the environment can result in complex fluorescence decay profiles that represent a continuous distribution of lifetimes. A method according to the present invention may also account for such cases. 
     The intensity decays λ(t) may be analysed in terms of a lifetime distribution ρ(τ l , wherein τ l /1α and α is the decay constant. The total decay law becomes: 
     
       
         
           
             
               
                 
                   
                     λ 
                     ⁡ 
                     
                       ( 
                       t 
                       ) 
                     
                   
                   = 
                   
                     
                       ∫ 
                       
                         τ 
                         = 
                         0 
                       
                       ∞ 
                     
                     ⁢ 
                     
                       
                         ρ 
                         ⁡ 
                         
                           ( 
                           
                             τ 
                             1 
                           
                           ) 
                         
                       
                       ⁢ 
                       
                         
                           ⅇ 
                           
                             t 
                             
                               τ 
                               l 
                             
                           
                         
                         · 
                         
                             
                         
                         ⁢ 
                         
                           ⅆ 
                           
                             τ 
                             l 
                           
                         
                       
                     
                   
                 
               
               
                 
                   equation 
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   31 
                 
               
             
           
         
       
     
     The fluorescence decay of biological systems may in some cases advantageously be described by a so-called stretched exponential as the stretched exponential reflects a continuous distribution of fluorescence lifetimes. The stretched exponential is introduced by: 
                     λ   ⁡     (   t   )       =       A   0     ·     ⅇ     -       (     t     τ   1       )       1   h                     equation   ⁢           ⁢   32               
where h is called the heterogeneity and is related to the distribution of decay times. In the case of a mixture of both substrate and product, each contributing to the fluorescence decay, a sum of two stretched exponentials may be used:
 
     
       
         
           
             
               
                 
                   
                     λ 
                     ⁡ 
                     
                       ( 
                       t 
                       ) 
                     
                   
                   = 
                   
                     
                       
                         A 
                         1 
                       
                       · 
                       
                         ⅇ 
                         
                           - 
                           
                             
                               ( 
                               
                                 t 
                                 
                                   τ 
                                   
                                     l 
                                     1 
                                   
                                 
                               
                               ) 
                             
                             
                               1 
                               
                                 h 
                                 1 
                               
                             
                           
                         
                       
                     
                     + 
                     
                       
                         A 
                         2 
                       
                       · 
                       
                         ⅇ 
                         
                           - 
                           
                             
                               ( 
                               
                                 t 
                                 
                                   τ 
                                   
                                     l 
                                     2 
                                   
                                 
                               
                               ) 
                             
                             
                               1 
                               
                                 h 
                                 2 
                               
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   equation 
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   33 
                 
               
             
           
         
       
     
     The stretched exponential model may advantageously be combined with the analysis using Bayesian inference according to the present invention which has been exemplified in the algorithms A1-A8. For example algorithm A1, taking into account the various deadtimes and utilizing the stretched exponential model may be modified as described below. 
     The Poisson arrival rate of the photons at time t is denoted by λ(t) as described by equation 32. The equations of algorithm A1 (equation 11-13) should be modified accordingly by using the following expression for the likelihood of observing the data D n : 
                     P   ⁡     (         D   n     |     A   0       ,   τ   ,   h     )       =       (       ∏     k   =   1       K   n       ⁢           ⁢     (     λ   ⁡     (     t     n   ,   k       )       )       )     ⁢     ⅇ     -     (         ∫   τ   v     ⁢       λ   ⁡     (     t     n   ,   k       )       ⁢           ⁢     ⅆ   t         -       ∑     k   =   1       K   n       ⁢           ⁢       ∫     t     n   ,   k           t     n   ,   k       +   δ       ⁢       λ   ⁡     (     t     n   ,   k       )       ⁢           ⁢     ⅆ   t             )                   equation   ⁢           ⁢   34               
where the detector is dead for a duration δ after each photon is received, for a duration τ after the excitation, and at all times longer than υ after excitation. K n  is the number of photons received following the n th  laser pulse and t n,k  is the arrival of the k th  photon from laser pulse n. Furthermore, the expression for prior probability distribution should be modified accordingly to included any prior knowledge on the values of the heterogeneity parameter h. Also the other algorithms, including the algorithms using binning of photon arrival times (A4-A8), may in the same way be modified to include stretched exponentials.
 
     The inventive method, exemplified with algorithms A1-A8, has been described here in combination with the measurement system comprising the photodetector  160  and the photon timing unit  150  having the ability to detect and output multiple photon arrival times after each excitation light pulse from the pulsed laser  120 . This is considered to be the best mode of operation. However, as appreciated by those skilled in the art, parts of the method of the present invention can advantageously be used also with prior art apparatuses such as the TCSPC and Multiplexed-TCSPC, providing only one (TCSPC) or a limited (Multiplexed-TCSPC) number of photons per excitation pulse. 
     The inventive method and measurement system has been exemplified here with fluorophores. As appreciated by those skilled in the art the system and methods are equally applicable in characterising other luminescent substances e.g. phosphorescent materials. 
     Example of luminescent substances that can advantageously be analysed with the described method and system comprises fluorescent materials (which usually have short lifetimes, typically of the order of &lt;1 ns-100 ns) e.g. Fluorescein, CyDyes, and ethidium bromides; and Phosphorescent material (which usually have longer lifetimes (typically a few ms)) e.g. ruthenium chelates, terbium chelates. 
     From the invention thus described, it will be obvious that the invention may be varied in many ways. Such variations are not to be regarded as a departure from the scope of the invention, and all such modifications as would be obvious to one skilled in the art are intended for inclusion within the scope of the following claims. 
     APPENDIX 
     A method of drawing random samples from a Gamma distribution and from a multinomial distribution, respectively, will be given below. The description will be in the form of guidelines which the skilled programmer can easily convert into subroutines suitable to call from algorithms A3-A8. 
     Random Samples from a Gamma Distribution 
     The Gamma distribution is defined by 
                 Γ     m   ,   r       ⁡     (   x   )       =         r   m     ⁢     x     m   -   1       ⁢     ⅇ     -   rx           Γ   ⁡     (   m   )               
as described above. Obtaining a random sample from it can be done in many ways. The best known currently to the inventors proceeds differently depending on whether m is less than 1, equal to 1, or greater than 1. Whichever is being used, we can initially assume that r=1 and then divide the resulting sample by r afterwards.
 
The Easy Case: m=1
 
     In this case the distribution reduces to an exponential distribution. The cumulative distribution function is therefore
 
 P ( x&lt;y )=1− e   −y  
 
and we may therefore choose a uniformly distributed random number u from the interval [0, 1] and solve the equation u=1−e −y  for y which we output as our random sample.
 
The Difficult Cases: m&lt;1 and m&gt;1
 
     For both of these cases we use forms of rejection sampling. 
     Suppose we want to sample from a probability distribution f(x) and are already able to sample from a probability distribution g(x). Suppose moreover that there exists a constant K such that for all x we have Kf (x)≦g(x). Then it is easy to see that the following algorithm will result in a sample from f(x) with probability K and with the remaining probability will result in no sample:
         Draw a random sample y from g(x).   With probability Kf(x)/g(x) let y be the resultant sample, and with the remaining probability let there be no resultant sample.       

     If, therefore, we keep applying this algorithm until it does yield a sample, then we will end up with a sample from f(x) with probability 1−(1−K) N  after N repeats. Since this probability approaches 1 as N approaches infinity, we will eventually end up with a sample with probability 1. 
     All that remains now is to specify g(x) for each of the relevant cases, state how to draw samples from g(x), and how to calculate Kf (x)/g(x). 
     m&gt;1 
     g(x) is given by 
               g   ⁡     (   x   )       =         c     2   ⁢       (     c   +       (     x   -   b     )     2       )       3   /   2           ⁢   where   ⁢           ⁢   b     =       m   -     1   ⁢           ⁢   and   ⁢           ⁢   c       =       3   ⁢   b     +       9   4     .                 
The cumulative density function is given by
 
                 P   g     ⁡     (     x   &lt;   y     )       =       1   2     ⁢     (     1   ±       1   -     c     c   +       (     y   -   b     )     2               )             
where the positive sign is taken if y&gt;b and the negative sign otherwise. We can therefore draw randomly from g(x) by drawing u randomly from the interval [0, 1], solving
 
               u   =       1   2     ⁢     (     1   ±       1   -     c     c   +       (     y   -   b     )     2               )     ⁢           ⁢   for   ⁢           ⁢   y       ,         
and making y be our random sample from g(x).
 
     Now, let 
                 h   ⁡     (   x   )       =       g   ⁡     (   x   )         f   ⁡     (   x   )           ,         
so that
 
                     h   ⁡     (   x   )       =       c     2   ⁢       (     c   +       (     x   -   b     )     2       )       3   /   2                 x     m   -   1       ⁢     ⅇ     -   x           Γ   ⁡     (   m   )                       =       c   ⁢           ⁢     Γ   ⁡     (   m   )       ⁢     ⅇ   x         2   ⁢         x     m   -   1       ⁡     (     c   +       (     x   -   b     )     2       )         3   /   2                       
and this is therefore minimised where
 
             0   =         h   ′     ⁡     (   x   )       =         c   ⁢           ⁢     Γ   ⁡     (   m   )       ⁢     ⅇ   x         2   ⁢         x     m   -   1       ⁡     (     c   +       (     x   -   b     )     2       )         3   /   2           ⁢     (     1   -       m   -   1     x     -       3   ⁢     (     x   -   b     )         c   +       (     x   -   b     )     2           )               
which is where the final factor is zero, or
 
     
       
         
           
             0 
             = 
             
               
                 
                   1 
                   - 
                   
                     
                       m 
                       - 
                       1 
                     
                     x 
                   
                   - 
                   
                     
                       3 
                       ⁢ 
                       
                         ( 
                         
                           x 
                           - 
                           b 
                         
                         ) 
                       
                     
                     
                       c 
                       + 
                       
                         
                           ( 
                           
                             x 
                             - 
                             b 
                           
                           ) 
                         
                         2 
                       
                     
                   
                 
                 ⁢ 
                 
                   
 
                 
                 ∴ 
                 
                   
                     x 
                     ⁡ 
                     
                       ( 
                       
                         c 
                         + 
                         
                           
                             ( 
                             
                               x 
                               - 
                               b 
                             
                             ) 
                           
                           2 
                         
                       
                       ) 
                     
                   
                   - 
                   
                     
                       ( 
                       
                         m 
                         - 
                         1 
                       
                       ) 
                     
                     ⁢ 
                     
                       ( 
                       
                         c 
                         + 
                         
                           
                             ( 
                             
                               x 
                               - 
                               b 
                             
                             ) 
                           
                           2 
                         
                       
                       ) 
                     
                   
                   - 
                   
                     3 
                     ⁢ 
                     
                       
                         ( 
                         
                           x 
                           - 
                           b 
                         
                         ) 
                       
                       2 
                     
                   
                 
               
               = 
               
                 
                   0 
                   ⁢ 
                   
                     
 
                   
                   ∴ 
                   
                     
                       
                         ( 
                         
                           x 
                           - 
                           b 
                         
                         ) 
                       
                       ⁢ 
                       
                         ( 
                         
                           c 
                           + 
                           
                             
                               ( 
                               
                                 x 
                                 - 
                                 b 
                               
                               ) 
                             
                             2 
                           
                         
                         ) 
                       
                     
                     - 
                     
                       3 
                       ⁢ 
                       
                         
                           ( 
                           
                             x 
                             - 
                             b 
                           
                           ) 
                         
                         2 
                       
                     
                   
                 
                 = 
                 
                   
                     0 
                     ⁢ 
                     
                       
 
                     
                     ∴ 
                     
                       
                         ( 
                         
                           x 
                           - 
                           b 
                         
                         ) 
                       
                       ⁢ 
                       
                         ( 
                         
                           c 
                           + 
                           
                             
                               ( 
                               
                                 x 
                                 - 
                                 b 
                               
                               ) 
                             
                             2 
                           
                           - 
                           
                             3 
                             ⁢ 
                             
                               ( 
                               
                                 x 
                                 - 
                                 b 
                               
                               ) 
                             
                           
                         
                         ) 
                       
                     
                   
                   = 
                   
                     
                       0 
                       ⁢ 
                       
                         
 
                       
                       ∴ 
                       
                         
                           ( 
                           
                             x 
                             - 
                             b 
                           
                           ) 
                         
                         ⁢ 
                         
                           ( 
                           
                             
                               
                                 ( 
                                 
                                   x 
                                   - 
                                   b 
                                 
                                 ) 
                               
                               2 
                             
                             - 
                             
                               3 
                               ⁢ 
                               
                                 ( 
                                 
                                   x 
                                   - 
                                   b 
                                 
                                 ) 
                               
                             
                             + 
                             
                               ( 
                               
                                 
                                   3 
                                   ⁢ 
                                   b 
                                 
                                 + 
                                 
                                   9 
                                   4 
                                 
                               
                               ) 
                             
                           
                           ) 
                         
                       
                     
                     = 
                     0 
                   
                 
               
             
           
         
       
     
     The second factor has a negative discriminant since b&gt;0, and can therefore never be zero and is always positive; the only extremum of h(x) is therefore at x=b and is a minimum; at that point we have 
               K   =         min   x     ⁢           ⁢     h   ⁡     (   x   )         =       h   ⁡     (   b   )       =         c   ⁢           ⁢     Γ   ⁡     (   m   )       ⁢     ⅇ   b         2   ⁢         b     m   -   1       ⁡     (     c   +       (     b   -   b     )     2       )         3   /   2           =         Γ   ⁡     (   m   )       ⁢     ⅇ   b         2   ⁢     b   b     ⁢     c     1   /   2                   ,         
so the acceptance probability for the sample can be set at
 
     
       
         
           
             
               
                 
                   
                     
                       p 
                       a 
                     
                     ⁡ 
                     
                       ( 
                       x 
                       ) 
                     
                   
                   = 
                   
                     K 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     
                       
                         f 
                         ⁡ 
                         
                           ( 
                           x 
                           ) 
                         
                       
                       / 
                       
                         g 
                         ⁡ 
                         
                           ( 
                           x 
                           ) 
                         
                       
                     
                   
                 
               
             
             
               
                 
                   = 
                   
                     
                       
                         
                           Γ 
                           ⁡ 
                           
                             ( 
                             m 
                             ) 
                           
                         
                         ⁢ 
                         
                           ⅇ 
                           b 
                         
                       
                       
                         2 
                         ⁢ 
                         
                           b 
                           b 
                         
                         ⁢ 
                         
                           c 
                           
                             1 
                             / 
                             2 
                           
                         
                       
                     
                     ⁢ 
                     
                       
                         2 
                         ⁢ 
                         
                           
                             
                               x 
                               
                                 m 
                                 - 
                                 1 
                               
                             
                             ⁡ 
                             
                               ( 
                               
                                 c 
                                 + 
                                 
                                   
                                     ( 
                                     
                                       x 
                                       - 
                                       b 
                                     
                                     ) 
                                   
                                   2 
                                 
                               
                               ) 
                             
                           
                           
                             3 
                             / 
                             2 
                           
                         
                       
                       
                         c 
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         
                           Γ 
                           ⁡ 
                           
                             ( 
                             m 
                             ) 
                           
                         
                         ⁢ 
                         
                           e 
                           x 
                         
                       
                     
                   
                 
               
             
             
               
                 
                   = 
                   
                     
                       
                         ⅇ 
                         b 
                       
                       
                         
                           b 
                           b 
                         
                         ⁢ 
                         
                           c 
                           
                             3 
                             / 
                             2 
                           
                         
                       
                     
                     ⁢ 
                     
                       
                         
                           x 
                           b 
                         
                         ⁡ 
                         
                           ( 
                           
                             c 
                             + 
                             
                               
                                 ( 
                                 
                                   x 
                                   - 
                                   b 
                                 
                                 ) 
                               
                               2 
                             
                           
                           ) 
                         
                       
                       
                         3 
                         / 
                         2 
                       
                     
                     ⁢ 
                     
                       ⅇ 
                       
                         - 
                         x 
                       
                     
                   
                 
               
             
           
         
       
     
     Finally, we note that we will implement the acceptance decision by drawing a uniformly distributed random number ν from the interval [0, 1], and accepting our random sample if ν&lt;P α (x). The test for whether ν&lt;p α (x) or not can be speeded up in many instances by testing first whether ν is less than some other function of x that is simpler to calculate and which is always less than p α (x), and accepting the sample if it is. 
     m&lt;1 
     In this case we set 
               g   ⁡     (   x   )       =     {               mx     m   -   1       ⁢   t         t   m     ⁡     (     t   +     m     -   t         )                 if   ⁢           ⁢   0     ≦   x   ≦   t                 m   ⁢           ⁢     ⅇ     -   x           t   +     m   ⁢           ⁢     ⅇ     -   t                     if   ⁢           ⁢   x     &gt;   t             0       otherwise                 
where t=1−m.
 
     The cumulative density function is 
                 P   g     ⁡     (     x   &lt;   y     )       =     {               y   m     ⁢   t         t   m     ⁡     (     t   +     m   ⁢           ⁢     ⅇ     -   t           )                 if   ⁢           ⁢   0     ≤   y   ≤   t               1   -       m   ⁢           ⁢     ⅇ     -   y           t   +     m   ⁢           ⁢     ⅇ     -   t                       if   ⁢           ⁢   y     &gt;   t             0       otherwise                 
and we can therefore draw a random sample from g(x) by drawing a uniformly distributed random number u from the interval [0, 1] and solving P g (x&lt;y)=u for y.
 
     Similarly to the derivation in the previous section, we can now set 
     
       
         
           
             
               h 
               ⁡ 
               
                 ( 
                 x 
                 ) 
               
             
             = 
             
               
                 
                   g 
                   ⁡ 
                   
                     ( 
                     x 
                     ) 
                   
                 
                 
                   f 
                   ⁡ 
                   
                     ( 
                     x 
                     ) 
                   
                 
               
               = 
               
                 { 
                 
                   
                     
                       
                         
                           mt 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             Γ 
                             ⁡ 
                             
                               ( 
                               m 
                               ) 
                             
                           
                           ⁢ 
                           
                             ⅇ 
                             x 
                           
                         
                         
                           
                             t 
                             m 
                           
                           ⁡ 
                           
                             ( 
                             
                               t 
                               + 
                               
                                 m 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   ⅇ 
                                   
                                     - 
                                     t 
                                   
                                 
                               
                             
                             ) 
                           
                         
                       
                     
                     
                       
                         
                           if 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           0 
                         
                         ≤ 
                         x 
                         ≤ 
                         t 
                       
                     
                   
                   
                     
                       
                         
                           m 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             Γ 
                             ⁡ 
                             
                               ( 
                               m 
                               ) 
                             
                           
                           ⁢ 
                           
                             x 
                             t 
                           
                         
                         
                           t 
                           + 
                           
                             m 
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             
                               ⅇ 
                               
                                 - 
                                 t 
                               
                             
                           
                         
                       
                     
                     
                       
                         
                           if 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           x 
                         
                         &gt; 
                         t 
                       
                     
                   
                 
               
             
           
         
       
     
     The minima of both continuous sections are at the left hand end of the section, i.e. 
                   arg   ⁢           ⁢   min       x   ∈   I       ⁢           ⁢     g   ⁡     (   x   )         =     {         0           if   ⁢           ⁢   I     =     [     0   ,   t     ]                 t   +             if   ⁢           ⁢   I     =     (     x   ,   t     ]                     
and are therefore at
 
             K   =         Γ   ⁡     (   m   )       ⁢   mt         t   m     ⁡     (     t   +     m   ⁢           ⁢     ⅇ     -   t           )               
in both cases.
 
     Therefore the acceptance probability 
     
       
         
           
             
               
                 
                   p 
                   a 
                 
                 ⁡ 
                 
                   ( 
                   x 
                   ) 
                 
               
               ⁢ 
               
                   
               
               ⁢ 
               is 
               ⁢ 
               
                   
               
               ⁢ 
               
                 ⅇ 
                 
                   - 
                   y 
                 
               
               ⁢ 
               
                   
               
               ⁢ 
               if 
               ⁢ 
               
                   
               
               ⁢ 
               y 
             
             ≤ 
             
               t 
               ⁢ 
               
                   
               
               ⁢ 
               or 
               ⁢ 
               
                   
               
               ⁢ 
               
                 
                   ( 
                   
                     y 
                     t 
                   
                   ) 
                 
                 
                   m 
                   - 
                   1 
                 
               
               ⁢ 
               
                   
               
               ⁢ 
               if 
               ⁢ 
               
                   
               
               ⁢ 
               y 
             
             &gt; 
             
               t 
               . 
             
           
         
       
     
     Finally, we note that we will implement the acceptance decision by drawing a uniformly distributed random number ν from the interval [0, 1], and accepting our random sample if ν&lt;p α (x). The test for whether ν&lt;p α (x) or not can be rearranged by first calculating 
             w   =     {         x           if   ⁢           ⁢   x     ≤   t               t   ⁢           ⁢     log   ⁡     (     x   t     )                 if   ⁢           ⁢   x     &gt;   t                   
then testing whether ν&lt;e −w . This test can then be speeded up in many instances by first testing whether
 
             v   &gt;     1     1   +   w             
(in which case we reject the sample and try all over again), or whether ν&lt;1−w (in which case we accept the sample and have finished), and only if we reach this point do we then have to test whether ν&lt;e −w .
 
Random Samples from a Multinomial Distribution
 
     We finally turn to efficient methods for sampling from a multinomial distribution. 
     The multinomial distribution is analagous to the binomial distribution, but for tosses where there are more than 2 possible outcomes. The parameters are N, the total number of tosses, and p, the vector of probabilities for the different possible results of a toss. The distribution is given by 
               P   ⁡     (       n   ❘   N     ,   p     )       =         N   !         ∏     i   =   1     I     ⁢           ⁢       n   i     !         ⁢       ∏     i   =   1     I     ⁢           ⁢       p   i     n   i       .               
Converting Production of a Single Multinomial Random Sample Into a Sequence of Binomial Ones
 
     The best way known to the author for sampling from this distribution is to convert the problem into a sequence of binomial random samples. The first determines the values of n 1  and 
                 ∑     i   =   2     I     ⁢     n   i       ,         
using as parameters for the binomial draw N and p 1 . The kth determines the values of n k  and
 
                 ∑     i   =     k   +   1       I     ⁢     n   i       ,         
using as parameters for the binomial draw
 
             N   -       ∑     i   =   1       k   -   1       ⁢     n   i             
and p k . That leaves the question of how to efficiently produce a binomial random sample.
 
Production of Binomial Random Samples
 
     The binomial distribution is the special case of the multinomial distribution where I=2, except that usually (including here) the 2-element parameter vector p is presented as the single element p=p 1  (which uniquely determines p since the elements of the latter must sum to 1). 
     The best way known to the inventors for sampling from the binomial distribution is to first order the values of 
               q   n     =         N   !         (     N   -   n     )     !       ⁢         p   n     ⁡     (     1   -   p     )         N   -   n               
in descending order (conceptually, without actually calculating them all), then to draw a uniformly distributed random number x from the range [0, 1], then to subtract from x in succession the values of q n  in succession starting with the largest. The output value n is the index of the q n  which takes the remaining amount left in x below zero.
 
     Implementation of this can take advantage of the fact that the method works almost as well if the q n  are used in a slightly different order from the optimal one. We can therefore safely assume that 
                     arg   ⁢           ⁢   max     n     ⁢     (     q   n     )       =     round   ⁡     (   Np   )         ,         
and calculate this q n  first. Each subsequent one can then be calculated in order from either the one before or the one after it in succession.