7 Lifetime Features (Fit)
Biological samples often contain mixtures of fluorescent species, each with its own characteristic lifetime. By modeling the decay as a sum of exponentials, the analysis can separate and quantify these different contributions. For example, NADH in cells exists in both free (short lifetime, ~0.4 ns) and protein-bound (longer lifetime, ~2–3 ns) states; by fitting the fluorescence decay with a bi-exponential model, one can estimate the fraction of each state, which provides direct insight into cellular metabolism and energy production pathways.
This extractor calculates cell-level component fractions (\(\alpha_i\)), lifetimes (\(\tau_i\)), mean lifetime (\(\tau_{mean}\)), intensity-weighted mean lifetime (\(\tau_{m,iw}\)), and the reduced chi-square (\(\chi^2_r\)) goodness-of-fit metric. The decay model is:
\[I(t) = \sum_{i=1}^n A_i \, e^{-t/\tau_i}\]
7.1 Fitting
For raw decays, FLIM Playground uses reconvolution fitting with the confirmed number of components, fixed lifetimes, time gates, and metric. The IRF shift is fixed at the confirmed channel or FOV value. Cell-level fitting defaults to Local; see When to choose Hybrid over Local for the mode behavior and trade-offs.
For pixel pre-fit inputs, the app calculates fitting features from the supplied values.
Local is the recommended default for cell-level fits after shift calibration. It performs a one-time differential-evolution warm start on the mean decay, then fits each cell with a local optimizer (leastsq for WLS or nelder otherwise). Hybrid runs differential evolution separately for each cell before the same local refinement, so it usually takes longer.
The benchmark below simulated mono-, bi-, and tri-exponential decays with a fixed, correctly calibrated IRF, Poisson noise, 2% background, and 20-cell batches at 1,000–300,000 photons. The error is median per-cell lifetime MAPE; lower is better.
| Model | Accuracy result |
|---|---|
| Mono-exponential | Accuracy was indistinguishable |
| Bi-exponential | Accuracy was indistinguishable |
| Tri-exponential | Local was equal or better overall; at 1,000 photons, MLE was 30.8% for Local vs. 33.0% for Hybrid, and WLS was 13.7% vs. 36.1% |
A separate production-path timing used 342 real T-cell decays with a bi-exponential model, a fixed measured IRF, fit_shift=False, and eight physical worker processes. The complete batch was fit in:
| Fit metric | Local | Hybrid | Hybrid/Local |
|---|---|---|---|
| MLE | 5.7 s | 45.7 s | 8.0× |
| WLS | 7.2 s | 47.6 s | 6.6× |
This larger batch exposes the cost of the per-cell global searches that multiprocessing can hide in a small 20-cell benchmark.
Choose Hybrid when Local produces a suspicious fit, such as a lifetime at a parameter boundary, a weak or merged component, failed convergence, or a visibly poor residual. It can also help with difficult real data whose model or IRF differs from the warm-start assumptions. If Local produces a valid fit with good residuals, Hybrid is unlikely to improve the lifetime estimate.
These results support Local as the default; they do not show that Hybrid is never useful for model mismatch or very low-count tri-exponential decays.
In the final dataset, the primary fitting features are prefixed by the combination of the feature extractor name (i.e. Lifetime fit) and the channel name, allowing Data Analysis to group the features. For example, Lifetime fit_nadh: a1 means the fraction of the first lifetime component for the NAD(P)H channel.
Not every column produced by this extractor carries that prefix. The lifetimes (\(\tau_i\), \(\tau_{mean}\), \(\tau_{m,iw}\)) and the leading fractions do, but the raw amplitudes (\(A_i\)), the constant offset, the reduced chi-square, and the final fraction (which is derived as the remainder of the others) are written with only the channel name, e.g. nadh_reduced_chi_square. These are treated as bookkeeping values, so Data Analysis places them in the Uncategorized Features group rather than under Lifetime fit_nadh.
The extracted CSV mixes three units, so check the column before using a value in a formula:
- Lifetimes (
t1,t2,t3,tm,tm_iw) are exported in picoseconds, even though this chapter writes the formulas in nanoseconds. - Fractions (
a1,a2,a3) are exported as percentages in the range 0–100, not as the 0–1 fraction \(\alpha_i\) used in the formulas below. Divide by 100 before substituting them into \(\tau_{mean}\) or \(\tau_{m,iw}\). - Phasor-derived lifetimes from the Lifetime fit free extractor (
Tau_phase,Tau_mod) are in nanoseconds.
7.1.1 Preprocessing
For image inputs, FLIM Playground sums pixel decays within each cell ROI mask into one curve1. This reduces variability and bias and allows shorter acquisition times at the cost of subcellular resolution. Users do not need to specify the bin factor (each pixel sums up the surrounding pixels’ decay curves) to account for insufficient photon counts. ROI-level aggregation also keeps the workload manageable.
The app also applies the confirmed IRF shift: it upsamples the IRF 10 times using linear interpolation, shifts it by the shift value \(\times 10\), then downsamples it to the original size.
7.1.2 Fraction of components
In addition to the absolute amplitudes of each component directly from the fitting result, FLIM Playground calculates the fraction of each component, \(\alpha_i\), as the amplitude of the component divided by the sum of all amplitudes. This normalization allows lifetime to be independent of the absolute intensity of the signal.
\(\alpha_i\) is a value between 0 and 1, and it is used in that form throughout the formulas in this chapter. In the exported dataset, however, the corresponding a1/a2/a3 columns are stored as percentages (\(\alpha_i \times 100\), ranging from 0 to 100). The final fraction is not fitted independently; it is derived as the remainder that makes the fractions sum to 100.
7.1.3 Mean lifetime
The mean lifetime, \(\tau_{mean}\), is calculated as the weighted average of the lifetimes of all components, where the weights are the fractions of each component.
\[\tau_{mean} = \sum_{i=1}^n \alpha_i \tau_i\]
7.1.4 Intensity-weighted mean lifetime
The mean lifetime above is amplitude-weighted: each component is weighted by its fraction \(\alpha_i\). The intensity-weighted mean lifetime, \(\tau_{m,iw}\), instead weights each component by its relative intensity contribution (\(\alpha_i \tau_i\)), so longer-lived components — which emit more photons per molecule — count more.
\[\tau_{m,iw} = \frac{\sum_{i=1}^n \alpha_i \tau_i^2}{\sum_{i=1}^n \alpha_i \tau_i} = \frac{\sum_{i=1}^n \alpha_i \tau_i^2}{\tau_{mean}}\]
For a single component, \(\tau_{m,iw} = \tau_1\).
Both fitting and the pixel pre-fit workflow export \(\tau_{mean}\) (tm) and \(\tau_{m,iw}\) (tm_iw) only for two or three components. For a single component, both mean lifetimes equal \(\tau_1\): use the exported t1 column, as no separate tm or tm_iw columns are written.
7.1.5 Goodness of fit
For each fitted decay, FLIM Playground also reports the reduced chi-square (\(\chi^2_r\)) as a goodness-of-fit diagnostic:
\[\chi^2_r = \frac{1}{N - p}\sum_{n} \frac{\bigl(y_n - \hat{y}_n\bigr)^2}{\hat{y}_n}\]
where the sum runs over the time bins within the time gates that have a positive model value (\(\hat{y}_n > 0\)), \(y_n\) is the measured count, \(\hat{y}_n\) is the fitted value, \(N\) is the number of those bins, and \(p\) is the number of free parameters (amplitudes, lifetimes, and the offset, minus any fixed lifetimes). Values near 1 indicate a good fit.
7.2 Pixel pre-fit
FLIM Playground accepts SPCImage lifetime features as 2D spatial arrays, with one feature value per pixel. It averages pixel values within each cell ROI mask, excluding the 0 values SPCImage assigns to unfitted pixels, such as those below a threshold. It uses np.ma.masked_array and np.ma.average to exclude these values from the averages.