Deconvolution, Time-Correlated Single Photon Counting

I'm doing the TCSPC (Time-Correlated Single Photon Counting) experiment.
I have two decays, one is the fluorescence an the other one respresent the response of the system. I would like to know if ther is a function that allows me to to deconvolve the two signals ?
Disclaimer: I know nothing about TCSPC.

If your data take the form of a sum of two exponential decays, you could fit it with the built-in dblexp_XOffset or dblexp fit function. This will work if the decays have sufficiently different time constants.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
As far as I know the usual way to analyse TCSPC decays is not to deconvolve the experimental data, but rather to convolve the IRF with the model function and to see if that matches the experimental data. Unfortunately I have only limited experience with this. This project looks like it could be useful: http://www.igorexchange.com/node/3603.

741 is correct. The correct way in fitting TCSPC data (something I do regularly) is to convolve the Instrument Response Function with the model equation[ single exponential, multi-exponential, stretched exponential, etc], which is then fit to the measured data.

Of course, you have to be careful to account for the differences between the IRF and data waves (different baseline offset, different peak amplitudes, a possible shift between start time of the signal if the IRF wasn't measured carefully)
Thank you to you for your answers.
I'm using the version 6.12A of Igor, and I do not want to update (I'm not expert Igor). It seems that the program pFLIM can do it. The procedure pFLIM compile is OK, but I can not make it work! What I want is a simple procedure where I give my fluorescence signal and my IRF, I can calculate the real decay then I can make Fit...
Decay_1.ibw IRF.ibw
fay.tor wrote:
I'm using the version 6.12A of Igor, and I do not want to update (I'm not expert Igor).

That sounds like you don't want to update *because* you are not an expert. I would say that, since the latest versions contain many bug fixes, that a non-expert really *should* upgrade. It's free, and not at all difficult. Pull down the Help menu and select (at the bottom of the menu) Updates for Igor Pro 6.12. That will launch a browser to a page with download information.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Many thanks John,
But that is not why I do not want to do the update. I have a procedure that works in this version and when I do the updates it does not work (several errors) and as I am not an expert I can not change these procedures ...;)
Thans John,

As I predicted. I've just updated and errors in my previous procedure beginning! I do not know how many there are but I start it the:

TO nvar = root: WinGlobals: $ (strProfil): TZ

I do not understand (I've already said that I'm not an expert ). Can you please tell me what is this error and how to fix it ? I hope that is the only error coz my procedure file is too long...
fay.tor wrote:
TO nvar = root: WinGlobals: $ (strProfil): TZ


You need to remove the spaces from the path. Make it "root:WinGlobals:$(strProfil):TZ". This is a perfect example of a syntax that a bug allowed to work, but which should be an error.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Thank you very much John, my old procedure works now, but still the problem of deconvolution :-(
fay.tor wrote:
Thank you very much John, my old procedure works now, but still the problem of deconvolution :-(


And as I demonstrated at the beginning of the thread, I'm not much help with that :)

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
fay.tor wrote:
... What I want is a simple procedure where I give my fluorescence signal and my IRF, I can calculate the real decay then I can make Fit...


The two approaches are ...

1) Use the deconvolution algorithm given in the Sample Experiments to deconvolve the IRF from your signal. Fit the resulting "real decay" curve to a model decay equation.

2) Fit your experimental signal to a convolution of the measured IRF + a model decay equation.

Both of these two processes have their pros and cons. Both of them require that you have a working set of basic skills in using Igor Pro. Here are some starting points to understand where you might be having problems ...

* What do you mean by "... but I can not make it work"! in your statement about pFLIM? Do you mean, "I know that pFLIM does not have a way to do either method 1 or method 2"? Alternatively, do you mean, "I do not know how to use pFLIM method 1 or pFLIM method 2 on my data"?

... if pFLIM is not going to do what you need, then ...

* Have you tried using the Sample Experiment on deconvolution to deconvolve the IRF from your signal? At what point are you having problems doing this?

* Have you tried fitting your signal to a model equation even though you have not deconvolved the IRF? At what level are you having problems doing this?

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
I do not know if the program pFLIM can do what I want, but in any case I can not make it work. I can compile the procedure, but when I excute something I get an error!
I'm sure there is a simple method to do this ... I hope that someone using Igor for TCSPC data passes by..

You are talking about "Sample Experiments" where can I find it?
fay.tor wrote:
... I can compile the procedure, but when I excute something I get an error!
I'm sure there is a simple method to do this ... I hope that someone using Igor for TCSPC data passes by..


From what I can tell from the explanation of the pFLIM package, the instructions that are given might be the same as though someone who uses Igor for TCSPC analysis is sitting next to you and telling you what to do. The frustration here is trying to understand what specifically is going wrong when you follow those instructions (if indeed you are even reading the instructions and following them)?????

fay.tor wrote:
You are talking about "Sample Experiments" where can I find it?


The demo experiment is in your Igor Pro folder using the following path -> Igor Pro 6.3 Folder : Examples : Analysis. The experiment you want is Spectral Deconvolution Demo.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
It is some 20 years or so since I last did TCSPC experiments, and back then I used Igor for presentation of the results but not the analysis (as the apparatus I used had a satisfactory analysis built in).
The usual way to analyse the data is to make an exponential decay then convolve this with your instrument function and match to your experimental decay. One reason for this is the weighting factors - as TCSPC is usually a photon counting experiment, so the weighting given to each data point is simply the square root of its photon count. If one were to try to deconvolve the instrument function, then don't think it would be straight-forward to determine what are appropriate values for the weighting factors.
I have had a play and have written the following demonstration code. This is far from robust, and I have not thoroughly tested it, but it does appear to work and fit a convolved 2-exponential decay to the data. (It took me a while to figure out the x-offsets that result from the convolution function and how that could be made compatible with the cursor limits of the fit).
With your two waves (IRF and Decay_1) in the current datafolder, run the following two functions from the command line:
MakeGraph()
Use the cursors to refine your fit region.
TCSPC_Fit()
Hope this helps.
Kurt
Function MakeGraph()
    // assumes that waves IRF and Decay_1 already exist in current dataFolder
    string sDecayWave = "Decay_1"
    string sIRFWave = "IRF"
    // Reference these waves
    wave wDecay = $sDecayWave
    wave wIRF = $sIRFWave
    // Make the plot and assign trace names
    Display wIRF/TN=IRF, wDecay/TN=Decay
    ModifyGraph mode=2, rgb(IRF)=(0,0,65280)
    ModifyGraph log(left)=1, mirror(left)=1, minor(left)=1
    ModifyGraph mirror=1, minor=1
    // display and set cursors
    ShowInfo
    WaveStats/Q wDecay
    Cursor/A=1/H=2 A, Decay, V_maxloc
    Cursor/A=1/H=2 B, Decay, 2500
End

Function TCSPC_Fit()
    // assumes that waves IRF and Decay_1 already exist in current dataFolder
    string sDecayWave = "Decay_1"
    string sIRFWave = "IRF"
    // Reference these waves
    wave wDecay = $sDecayWave
    wave wIRF = $sIRFWave
    // Make a normalised IRF wave
    Duplicate/O wIRF, wIRF_N
    variable vSum = sum(wIRF, -inf, inf)
    wIRF_N[] /= vSum
    // Make Fit-related waves
    Duplicate/O wDecay,wWeight
    wWeight[] = 1 / sqrt(wWeight[p]) // weighting is from shot noise - set to 1/stdev for each data point
    Make/O/N=5 W_coef, W_sigma
    Make/O/N=1 W_fitConstants // the x-axis offset
    // run non-convolution curve fit first to effectively get a set of starting parameters
    W_coef[0] = 0 // hold offset at zero
   
//  This would be for a single exponentail fit:
//  CurveFit/H="100"/NTHR=0/L=(pcsr(B)-pcsr(A)+1) exp_XOffset, kwCWave=W_coef, wDecay[pcsr(A),pcsr(B)] /D /R /W=wWeight

//  This is for a double exponential fit:
    CurveFit/H="10000"/NTHR=0/L=(pcsr(B)-pcsr(A)+1) dblexp_XOffset, kwCWave=W_coef, wDecay[pcsr(A),pcsr(B)] /D /R /W=wWeight
   
    string sFitDecay="fit_"+sDecayWave
    wave wFit=$sFitDecay
    ModifyGraph rgb($sFitDecay)=(0,65280,0)
    Make/O/N=5 wFitParams
    wFitParams[]=W_coef[p]
    FuncFit/NTHR=0/L=(pcsr(B)-pcsr(A)+1) TCSPC_Convolution,wFitParams, wDecay[pcsr(A),pcsr(B)] /D /R /W=wWeight
End

Function TCSPC_Convolution(wFitParams,yw,xw) : FitFunc
    Wave wFitParams,yw,xw
    wave wIRF_N
    // make exponential decay wave
    Make/O/N=(pcsr(B) - pcsr(A) + 1) wExpDecay
    wExpDecay[] = wFitParams[0] + wFitParams[1] * exp(- x / wFitParams[2])
//  This is for 2-exponential fit only:
    wExpDecay[] += wFitParams[3] * exp(- x / wFitParams[4])
   
    //Convolve with IRF
    Convolve wIRF_N, wExpDecay
    //assign the result (note: offset due to cursor fit range)
    yw[] = wExpDecay[p + pcsr(A)]
End
Thank you very much KurtB, and sorry for the late reply, now I have other problem that "TCSPC" to settle ... I'll try that.
I must seriously learn programming in Igor or at least understand the program!! I confessed that I'm a zero.

PS: KurtB, normally all my decays are a first order