pyfli.analysis.precision.fit_free_lifetime#
Fit-free mono-exponential lifetimes from the photon histogram: mean arrival time and phasor lifetime.
Functions
|
|
|
|
|
Background-subtracted counts, deliberately not clipped at zero: clipping would discard the negative noise excursions and bias the moments at low counts. |
|
All fit-free lifetime maps for an image cube, ready for |
|
Gate start times |
|
Lifetime whose exact gated-model first moment equals the measured mean arrival time (method of moments with the wrap-around / gate / IRF model). |
|
|
|
First-harmonic phasor lifetime at the laser repetition frequency, calibrated with the IRF, via |
- gate_times(n_gates, laser_period)[source]#
Gate start times
k * laser_period / n_gatesin ns (endpoint excluded).
- mean_arrival_time_naive(decay, irf, laser_period, background_per_bin=0.0)[source]#
<t>_decay - <t>_IRFper decay (ns) – the textbook first-moment lifetime, exact only for an unlimited window without wrap-around or gating.
- mean_arrival_lifetime(decay, irf, laser_period, background_per_bin=0.0, tau_grid=None)[source]#
Lifetime whose exact gated-model first moment equals the measured mean arrival time (method of moments with the wrap-around / gate / IRF model).
- Parameters:
decay (
np.ndarray) – Photon histograms, time axis last.irf (
np.ndarray) – Shared IRF(T,).laser_period (
float) – Laser repetition period in ns.background_per_bin (
float) – Expected background counts per gate, subtracted before the moment.tau_grid (
np.ndarray | None) – Lifetimes (ns) of the lookup table; defaults to 2000 log-spaced values in[0.01, 5 * laser_period].
- Returns:
Lifetime per decay (ns); NaN for empty decays or means outside the table.
- Return type:
np.ndarray
- phasor_lifetime(decay, irf, laser_period, background_per_bin=0.0, bin_corrected=False, device='cpu')[source]#
First-harmonic phasor lifetime at the laser repetition frequency, calibrated with the IRF, via
PhasorAnalyzer.- Parameters:
decay (
np.ndarray) – Photon histograms, time axis last.irf (
np.ndarray) – Shared IRF(T,).laser_period (
float) – Laser repetition period in ns (the phasor frequency is1 / laser_period).background_per_bin (
float) – Expected background counts per gate, subtracted before the phasor.bin_corrected (
bool) – False (default): the standard phase lifetimeS / (omega * G)fromPhasorAnalyzer.compute_lifetime. True: invert the calibrated phasorz = (1 - q) / (1 - q * exp(i*omega*dt))of the exact wrapped, gated exponential forq = exp(-dt / tau), which removes the gate-width bias.device (
Any | None) – Torch device forPhasorAnalyzer(calibration runs in torch).
- Returns:
Lifetime per decay (ns), shape
decay.shape[:-1].- Return type:
np.ndarray
- fit_free_lifetime_maps(decay, irf, laser_period, mask=None, background_per_bin=0.0)[source]#
All fit-free lifetime maps for an image cube, ready for
CVPlot/FactorAnalysis:{"tau_mean_arrival", "tau_mean_arrival_naive", "tau_phasor", "tau_phasor_bin_corrected"}, each(H, W)with NaN outside mask.irf may be a shared
(T,)IRF or the(H, W, T)cube, in which case the mean IRF over mask is used.