pyfli.phasor.phasorSEPL.lifetimes#

lifetimes.py#

Extract fluorescence lifetimes from phasor coordinates (g, s).

For single-exponential species on the universal semicircle, two equivalent estimators exist — phase lifetime and modulus lifetime. For species off the semicircle (multi-exponential, gated, truncated), both estimators are biased and corrected expressions must be used (Michalet 2021, Sec. VII).

References

Michalet X., AIP Advances 11, 035331 (2021), Sec. VII. ISS Technical Note: “FLIM Analysis using the Phasor Plots” Eq. 10.

Functions

fractional_components(g_mix, s_mix, g1, s1, ...)

Estimate the fractional contributions (f₁, f₂) of two pure species using the linear combination property of phasors.

lifetime_from_phasor(g, s, cfg[, method])

Convenience wrapper: estimate lifetime from phasor coordinates.

modulus_lifetime(g, s, cfg)

Modulus (demodulation) lifetime from phasor coordinates.

phase_lifetime(g, s, cfg)

Phase (angular) lifetime from phasor coordinates.

phase_lifetime_gated(g, s, cfg)

Modified phase lifetime for a single square gate of width W.

phase_lifetime(g, s, cfg)[source]#

Phase (angular) lifetime from phasor coordinates.

Derived from φ = arctan(s/g) and tan(φ) = ωτ_φ:

τ_φ = tan(φ) / ω = s / (g · ω)

Valid exactly for single-exponential species on the universal semicircle.

Parameters:
  • g (array_like) – Phasor coordinates.

  • s (array_like) – Phasor coordinates.

  • cfg (AcquisitionConfig) – Requires: omega.

Returns:

tau_phi

Return type:

ndarray  (ns)

modulus_lifetime(g, s, cfg)[source]#

Modulus (demodulation) lifetime from phasor coordinates.

Derived from m = |z| = 1/√(1 + ω²τ_m²):

τ_m = √(1/m² − 1) / ω = √( (1 − g² − s²) / (g² + s²) ) / ω

Valid exactly for single-exponential species on the universal semicircle.

Parameters:
  • g (array_like)

  • s (array_like)

  • cfg (AcquisitionConfig)

Returns:

tau_m

Return type:

ndarray  (ns)

lifetime_from_phasor(g, s, cfg, method='phase')[source]#

Convenience wrapper: estimate lifetime from phasor coordinates.

Parameters:
  • g (array_like)

  • s (array_like)

  • cfg (AcquisitionConfig)

  • method ({"phase", "modulus", "mean"}) – “phase” → τ_φ (arctan estimator) “modulus” → τ_m (demodulation estimator) “mean” → arithmetic mean of τ_φ and τ_m

Returns:

tau

Return type:

ndarray  (ns)

phase_lifetime_gated(g, s, cfg)[source]#

Modified phase lifetime for a single square gate of width W.

For gated data the standard arctan formula underestimates τ. Michalet 2021 (Sec. VII A) provides the correction via the implicit equation:

tan(φ_gate) / ω ≠ τ (bias!)

This function solves the forward model numerically: for each observed (g, s) we find τ such that phasor_gated_single(τ, cfg) == (g, s) by minimising |φ_forward − φ_measured|.

Parameters:
  • g (array_like)

  • s (array_like)

  • cfg (AcquisitionConfig  (mode GATED_SINGLE expected))

Returns:

tau

Return type:

ndarray  (ns)

fractional_components(g_mix, s_mix, g1, s1, g2, s2)[source]#

Estimate the fractional contributions (f₁, f₂) of two pure species using the linear combination property of phasors.

For a mixture of two species with known phasors (g₁,s₁) and (g₂,s₂):

g_mix = f₁·g₁ + f₂·g₂ s_mix = f₁·s₁ + f₂·s₂ f₁ + f₂ = 1

This system is overdetermined; we use the geometric lever-rule: the mixture point divides the line segment from species 1 to species 2 such that f₁ = d(mix→2) / d(1→2).

Convention: f₁ is the fraction of species 1, i.e. it equals 1 when the mixture phasor coincides with (g₁, s₁).

Parameters:
  • g_mix (array_like) – Observed mixture phasor(s).

  • s_mix (array_like) – Observed mixture phasor(s).

  • g1 (float   Pure species 1 phasor.)

  • s1 (float   Pure species 1 phasor.)

  • g2 (float   Pure species 2 phasor.)

  • s2 (float   Pure species 2 phasor.)

Returns:

f1, f2 – Fractional intensities of species 1 and 2. f2 = 1 − f1.

Return type:

ndarray