pycorrelate.pycorrelate
In fluorescence correlation spectroscopy (FCS) the (normalized) cross-correlation function (CCF) of two continuous signals I1(t) and I2(t) is defined as:
The auto-correlation function (ACF) is just a special case where I1(t) = I2(t).
In actual experiments, signals are not continuous but come from single-photon detectors that produce a pulse for each photon. These pulses are usually timestamped with ~10ns resolution. The series of photon arrival times is used as input for ACF or CCF computations.
In principle, timestamps can be binned to produce a discrete-time signal. In signal processing, the (non-normalized) cross-correlation of two real discrete-time signals {Ai} and {Bi} is defined as
The previous formula is implemented by ucorrelate
and numpy.correlate.
Binning timestamps to obtain timetraces would be very inefficient for FCS analysis where time-lags spans may orders of magnitude. It is much more efficient to directly compute the cross-correlation function from timestamps. The popular multi-tau algorithm allows computing the correlation directly from timestamps on a fixed arrangement of quasi-log-spaced bins. More generally, Laurence algorithm (Laurence et al. Optics Letters (2006)) allows computing cross-correlation from timestamps on arbitrary bins of time-lags, with similar performances as the multi-tau. Computing cross-correlation C(τ) from timestamps is fundamentally a counting tasks. Given two timestamps arrays t and u and considering the k-th time-lag bin [τk, τk + 1), C(k) is the number of pairs where:
τk ≤ ti − uj < τk + 1
for all the possible i and j combinations.
where n({}) is the operator counting the elements in a set, Δτk is the duration of the k-th time-lag bin and T is the measurement duration. For FCS we normally want the normalized CCF, that is:
Eq. Ck
and Gk
are implemented by pcorrelate
, where the argument normalize allows choosing between the normalized and unnormalized version.
Note
In Laurence 2006 the expression for G(k) (there called CAB(τ)) does not include the Δτk in the denominator due to a typo.
- Laurence, T. A., Fore, S., Huser, T. (2006). Fast, flexible algorithm for calculating photon correlations. Optics Letters , 31 (6), 829–831. https://doi.org/10.1364/OL.31.000829
- Petra Schwille and Elke Haustein, Fluorescence Correlation Spectroscopy An Introduction to its Concepts and Applications
- Haustein, E., Schwille, P. (2003). Ultrasensitive investigations of biological systems by fluorescence correlation spectroscopy. Methods, 29 (2), 153–166. https://doi.org/10.1016/S1046-2023(02)00306-7