Return single component lifetime best resolved at frequency.
Parameters:
frequency (array_like) – Laser pulse or modulation frequency.
unit_conversion (float, optional, default: 1e-3) – Product of frequency and lifetime units’ prefix factors.
The default is 1e-3 for MHz and ns, or Hz and ms.
Use 1.0 for Hz and s.
Returns:
lifetime – Single component lifetime best resolved at frequency.
Return type:
ndarray
Notes
The lifetime \(\tau\) that is best resolved at frequency \(f\) is
(Redford & Clegg 2005. Eq. B.6):
Return optimal frequency for resolving single component lifetime.
Parameters:
lifetime (array_like) – Single component lifetime.
unit_conversion (float, optional, default: 1e-3) – Product of frequency and lifetime units’ prefix factors.
The default is 1e-3 for MHz and ns, or Hz and ms.
Use 1.0 for Hz and s.
Returns:
frequency – Optimal laser pulse or modulation frequency for resolving lifetime.
Return type:
ndarray
Notes
The optimal frequency \(f\) to resolve a single component lifetime
\(\tau\) is
(Redford & Clegg 2005. Eq. B.6):
Return synthetic signal, instrument response function (IRF), and
time axis, sampled over one period of the fundamental frequency.
The signal is convolved with the IRF, which is approximated by a
normal distribution.
Parameters:
frequency (float) – Fundamental laser pulse or modulation frequency in MHz.
lifetime (array_like) – Lifetime components in ns.
fraction (array_like, optional) – Fractional intensities or pre-exponential amplitudes of the lifetime
components. Fractions are normalized to sum to 1.
Must be specified if lifetime is not a scalar.
mean (array_like, optional, default: 1.0) – Average signal intensity (DC). Must be scalar for now.
background (array_like, optional, default: 0.0) – Background signal intensity. Must be smaller than mean.
samples (int, default: 64) – Number of signal samples to return. Must be at least 16.
harmonic (int, sequence of int, or 'all', optional, default: 'all') – Harmonics used to synthesize signal.
If ‘all’, all harmonics are used.
Else, harmonics must be at least one and no larger than half of
samples.
Use ‘all’ to synthesize an exponential time-domain decay signal,
or 1 to synthesize a homodyne signal.
zero_phase (float, optional) – Position of instrument response function in radians.
Must be in range [0, pi]. The default is the 8th sample.
zero_stdev (float, optional) – Standard deviation of instrument response function in radians.
Must be at least 1.5 samples and no more than one tenth of samples
to allow for sufficient sampling of the function.
The default is 1.5 samples. Increase samples to narrow the IRF.
preexponential (bool, optional, default: False) – If true, fraction values are pre-exponential amplitudes,
else fractional intensities.
unit_conversion (float, optional, default: 1e-3) – Product of frequency and lifetime units’ prefix factors.
The default is 1e-3 for MHz and ns, or Hz and ms.
Use 1.0 for Hz and s.
Returns:
signal (ndarray) – Signal generated from lifetimes at frequency, convolved with
instrument response function.
zero (ndarray) – Instrument response function.
time (ndarray) – Time for each sample in signal in units of lifetime.
This implementation is based on an inverse discrete Fourier transform
(DFT). Because DFT cannot be used on signals with discontinuities
(for example, an exponential decay starting at zero) without producing
strong artifacts (ripples), the signal is convolved with a continuous
instrument response function (IRF). The minimum width of the IRF is
limited due to sampling requirements.
Examples
Synthesize a multi-exponential time-domain decay signal for two
lifetime components of 4.2 and 0.9 ns at 40 MHz:
Return phasor coordinates on universal semicircle at other harmonics.
Return phasor coordinates at any harmonic from the real component of
phasor coordinates of a single exponential lifetime at a certain harmonic.
The input and output phasor coordinates lie on the universal semicircle.
Parameters:
real (array_like) – Real component of phasor coordinates of single exponential lifetime
at harmonic.
harmonic (array_like) – Harmonic of real coordinate. Must be integer >= 1.
other_harmonic (array_like) – Harmonic for which to return phasor coordinates. Must be integer >= 1.
real_other (ndarray) – Real component of phasor coordinates at other_harmonic.
imag_other (ndarray) – Imaginary component of phasor coordinates at other_harmonic.
Notes
The phasor coordinates
\(g_{n}\) (real_other) and \(s_{n}\) (imag_other)
of a single exponential lifetime at harmonic \(n\) (other_harmonic)
is calculated from the real part of the phasor coordinates
\(g_{m}\) (real) at harmonic \(m\) (harmonic) according to
(Torrado, Malacrida, & Ranjit. 2022. Eq. 25):
Calibration of phasor coordinates from time-resolved measurements is
necessary to account for the instrument response function (IRF) and delays
in the electronics.
Parameters:
real (array_like) – Real component of phasor coordinates to be calibrated.
imag (array_like) – Imaginary component of phasor coordinates to be calibrated.
reference_mean (array_like or None) – Intensity of phasor coordinates from reference of known lifetime.
Used to re-normalize averaged phasor coordinates.
reference_real (array_like) – Real component of phasor coordinates from reference of known lifetime.
Must be measured with the same instrument setting as the phasor
coordinates to be calibrated. Dimensions must be the same as real.
reference_imag (array_like) – Imaginary component of phasor coordinates from reference of known
lifetime.
Must be measured with the same instrument setting as the phasor
coordinates to be calibrated.
frequency (array_like) – Fundamental laser pulse or modulation frequency in MHz.
lifetime (array_like) – Lifetime components in ns. Must be scalar or one-dimensional.
harmonic (int, sequence of int, or 'all', default: 1) – Harmonics included in real and imag.
If an integer, the harmonics at which real and imag were acquired
or calculated.
If a sequence, the harmonics included in the first axis of real and
imag.
If ‘all’, the first axis of real and imag contains lower
harmonics.
The default is the first harmonic (fundamental frequency).
skip_axis (int or sequence of int, optional) – Axes in reference_mean to exclude from reference center calculation.
By default, all axes except harmonics are included.
fraction (array_like, optional) – Fractional intensities or pre-exponential amplitudes of the lifetime
components. Fractions are normalized to sum to 1.
Must be same size as lifetime.
preexponential (bool, optional) – If true, fraction values are pre-exponential amplitudes,
else fractional intensities (default).
unit_conversion (float, optional) – Product of frequency and lifetime units’ prefix factors.
The default is 1e-3 for MHz and ns, or Hz and ms.
Use 1.0 for Hz and s.
method (str, optional) –
Method used for calculating center of reference phasor coordinates:
'mean': Arithmetic mean.
'median': Spatial median.
nan_safe (bool, optional) – Ensure method is applied to same elements of reference arrays.
By default, distribute NaNs among reference arrays before applying
method.
reverse (bool, optional) – Reverse calibration.
Returns:
real (ndarray) – Calibrated real component of phasor coordinates.
imag (ndarray) – Calibrated imaginary component of phasor coordinates.
Raises:
ValueError – The array shapes of real and imag, or reference_real and
reference_imag do not match.
Number of harmonics or frequencies does not match the first axis
of real and imag.
Return phasor coordinates from apparent single lifetimes.
Parameters:
phase_lifetime (ndarray) – Apparent single lifetime from phase.
modulation_lifetime (ndarray, optional) – Apparent single lifetime from modulation.
If None, modulation_lifetime is same as phase_lifetime.
frequency (array_like) – Laser pulse or modulation frequency in MHz.
unit_conversion (float, optional) – Product of frequency and lifetime units’ prefix factors.
The default is 1e-3 for MHz and ns, or Hz and ms.
Use 1.0 for Hz and s.
The apparent single lifetimes phase_lifetime (\(\tau_{\phi}\))
and modulation_lifetime (\(\tau_{M}\)) are converted to phasor
coordinates real (\(G\)) and imag (\(S\)) at
frequency \(f\) according to:
Return phasor coordinates of FRET acceptor channel.
Calculate phasor coordinates of a FRET (Förster Resonance Energy Transfer)
acceptor channel as a function of frequency, donor and acceptor lifetimes,
FRET efficiency, fraction of donors undergoing FRET, fraction of directly
excited acceptors, fraction of donor fluorescence in acceptor channel,
and background fluorescence.
The phasor coordinates of the acceptor channel contain fractions of:
acceptor sensitized by energy transfer
directly excited acceptor
donor bleedthrough
background fluorescence
Parameters:
frequency (array_like) – Laser pulse or modulation frequency in MHz.
donor_lifetime (array_like) – Lifetime of donor without FRET in ns.
acceptor_lifetime (array_like) – Lifetime of acceptor in ns.
fret_efficiency (array_like, optional, default 0) – FRET efficiency in range [0, 1].
donor_fretting (array_like, optional, default 1) – Fraction of donors participating in FRET. Range [0, 1].
donor_bleedthrough (array_like, optional, default 0) – Weight of donor fluorescence in acceptor channel
relative to fluorescence of fully sensitized acceptor.
A weight of 1 means the fluorescence from donor and fully sensitized
acceptor are equal.
The background in the donor channel does not bleed through.
acceptor_bleedthrough (array_like, optional, default 0) – Weight of fluorescence from directly excited acceptor
relative to fluorescence of fully sensitized acceptor.
A weight of 1 means the fluorescence from directly excited acceptor
and fully sensitized acceptor are equal.
acceptor_background (array_like, optional, default 0) – Weight of background fluorescence in acceptor channel
relative to fluorescence of fully sensitized acceptor.
A weight of 1 means the fluorescence of background and fully
sensitized acceptor are equal.
background_real (array_like, optional, default 0) – Real component of background fluorescence phasor coordinate
at frequency.
background_imag (array_like, optional, default 0) – Imaginary component of background fluorescence phasor coordinate
at frequency.
unit_conversion (float, optional) – Product of frequency and lifetime units’ prefix factors.
The default is 1e-3 for MHz and ns, or Hz and ms.
Use 1.0 for Hz and s.
Calculate phasor coordinates of a FRET (Förster Resonance Energy Transfer)
donor channel as a function of frequency, donor lifetime, FRET efficiency,
fraction of donors undergoing FRET, and background fluorescence.
The phasor coordinates of the donor channel contain fractions of:
donor not undergoing energy transfer
donor quenched by energy transfer
background fluorescence
Parameters:
frequency (array_like) – Laser pulse or modulation frequency in MHz.
donor_lifetime (array_like) – Lifetime of donor without FRET in ns.
fret_efficiency (array_like, optional, default 0) – FRET efficiency in range [0, 1].
donor_fretting (array_like, optional, default 1) – Fraction of donors participating in FRET. Range [0, 1].
donor_background (array_like, optional, default 0) – Weight of background fluorescence in donor channel
relative to fluorescence of donor without FRET.
A weight of 1 means the fluorescence of background and donor
without FRET are equal.
background_real (array_like, optional, default 0) – Real component of background fluorescence phasor coordinate
at frequency.
background_imag (array_like, optional, default 0) – Imaginary component of background fluorescence phasor coordinate
at frequency.
unit_conversion (float, optional) – Product of frequency and lifetime units’ prefix factors.
The default is 1e-3 for MHz and ns, or Hz and ms.
Use 1.0 for Hz and s.
Return phasor coordinates from lifetime components.
Calculate phasor coordinates as a function of frequency, single or
multiple lifetime components, and the pre-exponential amplitudes
or fractional intensities of the components.
Parameters:
frequency (array_like) – Laser pulse or modulation frequency in MHz.
A scalar or one-dimensional sequence.
lifetime (array_like) – Lifetime components in ns. See notes below for allowed dimensions.
fraction (array_like, optional) – Fractional intensities or pre-exponential amplitudes of the lifetime
components. Fractions are normalized to sum to 1.
See notes below for allowed dimensions.
preexponential (bool, optional, default: False) – If true, fraction values are pre-exponential amplitudes,
else fractional intensities.
unit_conversion (float, optional, default: 1e-3) – Product of frequency and lifetime units’ prefix factors.
The default is 1e-3 for MHz and ns, or Hz and ms.
Use 1.0 for Hz and s.
keepdims (bool, optional, default: False) – If true, length-one dimensions are left in phasor coordinates.
Returns:
real (ndarray) – Real component of phasor coordinates.
imag (ndarray) – Imaginary component of phasor coordinates.
See notes below for dimensions of the returned arrays.
Raises:
ValueError – Input arrays exceed their allowed dimensionality or do not match.
The phasor coordinates \(G\) (real) and \(S\) (imag) for
many lifetime components \(j\) with lifetimes \(\tau\) and
pre-exponential amplitudes \(\alpha\) at frequency \(f\) are:
The following combinations of lifetime and fraction parameters are
supported:
lifetime is scalar or one-dimensional, holding single component
lifetimes. fraction is None.
Return arrays of shape (frequency.size, lifetime.size).
lifetime is two-dimensional, fraction is one-dimensional.
The last dimensions match in size, holding lifetime components and
their fractions.
Return arrays of shape (frequency.size, lifetime.shape[1]).
lifetime is one-dimensional, fraction is two-dimensional.
The last dimensions must match in size, holding lifetime components and
their fractions.
Return arrays of shape (frequency.size, fraction.shape[1]).
lifetime and fraction are up to two-dimensional of same shape.
The last dimensions hold lifetime components and their fractions.
Return arrays of shape (frequency.size, lifetime.shape[0]).
Length-one dimensions are removed from returned arrays
if keepdims is false (default).
Examples
Phasor coordinates of a single lifetime component (in ns) at a
frequency of 80 MHz:
Return equally spaced phasor coordinates on universal semicircle.
Parameters:
samples (int, optional, default: 101) – Number of coordinates to return.
Returns:
real (ndarray) – Real component of phasor coordinates on universal semicircle.
imag (ndarray) – Imaginary component of phasor coordinates on universal semicircle.
Raises:
ValueError – The number of samples is smaller than 1.
Notes
If more than one sample, the first and last phasor coordinates returned
are (0,0) and (1,0).
The center coordinate, if any, is (0.5,0.5).
The universal semicircle is composed of the phasor coordinates of
single lifetime components, where the relation of polar coordinates
(phase \(\phi\) and modulation \(M\)) is:
\[M = \cos{\phi}\]
Examples
Calculate three phasor coordinates on universal semicircle:
Return intersection of line through phasors with universal semicircle.
Return the phasor coordinates of the two intersections of the universal
semicircle with the line between two phasor coordinates.
Return NaN if the line does not intersect the semicircle.
Parameters:
real0 (array_like) – Real component of first set of phasor coordinates.
imag0 (array_like) – Imaginary component of first set of phasor coordinates.
real1 (array_like) – Real component of second set of phasor coordinates.
imag1 (array_like) – Imaginary component of second set of phasor coordinates.
Return apparent single lifetimes from phasor coordinates.
Parameters:
real (array_like) – Real component of phasor coordinates.
imag (array_like) – Imaginary component of phasor coordinates.
frequency (array_like) – Laser pulse or modulation frequency in MHz.
unit_conversion (float, optional) – Product of frequency and returned lifetime units’ prefix factors.
The default is 1e-3 for MHz and ns, or Hz and ms.
Use 1.0 for Hz and s.
The phasor coordinates real (\(G\)) and imag (\(S\))
are converted to apparent single lifetimes
phase_lifetime (\(\tau_{\phi}\)) and
modulation_lifetime (\(\tau_{M}\)) at frequency \(f\)
according to:
Return two lifetime components from multi-harmonic phasor coordinates.
Return estimated lifetimes and fractional intensities of two
single-exponential components from a set of multi-harmonic
phasor coordinates using the graphical approach described
in [1].
Return NaN for coordinates outside the universal semicircle.
Parameters:
real (array_like) – Real component of phasor coordinates.
Must contain at least two linearly increasing harmonics
in the first dimension.
imag (array_like) – Imaginary component of phasor coordinates.
Must have same shape as real.
frequency (float) – Laser pulse or modulation frequency in MHz.
lifetime_range (tuple of float, optional) – Start, stop, and step of lifetime range in ns to search for components.
Defines the search range for the first lifetime component.
The default is (0.0,20.0,0.1).
unit_conversion (float, optional, default: 1e-3) – Product of frequency and lifetime units’ prefix factors.
The default is 1e-3 for MHz and ns, or Hz and ms.
Use 1.0 for Hz and s.
dtype (dtype_like, optional) – Floating point data type used for calculation and output values.
Either float32 or float64. The default is float64.
num_threads (int, optional) – Number of OpenMP threads to use for parallelization.
By default, multi-threading is disabled.
If zero, up to half of logical CPUs are used.
OpenMP may not be available on all platforms.
fraction (ndarray) – Fractional intensities of resolved lifetime components.
Raises:
ValueError – The shapes of real and imaginary coordinates do not match.
The number of harmonics is less than the number of components.
The lifetime range is invalid.
References
Notes
This function currently supports only two lifetime components.
Examples
Resolve two lifetime components from the phasor coordinates of a mixture
of 4.2 and 0.9 ns lifetimes with 70/30% fractions at 80 and 160 MHz:
The normal lifetime of phasor coordinates represents the single lifetime
equivalent corresponding to the perpendicular projection of the coordinates
onto the universal semicircle, as defined in [2].
Parameters:
real (array_like) – Real component of phasor coordinates.
imag (array_like) – Imaginary component of phasor coordinates.
frequency (array_like) – Laser pulse or modulation frequency in MHz.
unit_conversion (float, optional) – Product of frequency and returned lifetime units’ prefix factors.
The default is 1e-3 for MHz and ns, or Hz and ms.
Use 1.0 for Hz and s.
Return polar coordinates from apparent single lifetimes.
Parameters:
phase_lifetime (ndarray) – Apparent single lifetime from phase.
modulation_lifetime (ndarray, optional) – Apparent single lifetime from modulation.
If None, modulation_lifetime is same as phase_lifetime.
frequency (array_like) – Laser pulse or modulation frequency in MHz.
unit_conversion (float, optional) – Product of frequency and lifetime units’ prefix factors.
The default is 1e-3 for MHz and ns, or Hz and ms.
Use 1.0 for Hz and s.
The apparent single lifetimes phase_lifetime (\(\tau_{\phi}\))
and modulation_lifetime (\(\tau_{M}\)) are converted to polar
coordinates phase (\(\phi\)) and modulation (\(M\)) at
frequency \(f\) according to:
Return polar coordinates for calibration from reference coordinates.
Return rotation angle and scale factor for calibrating phasor coordinates
from measured and known polar coordinates of a reference, for example,
a sample of known lifetime.
Parameters:
measured_phase (array_like) – Angular component of measured polar coordinates in radians.
measured_modulation (array_like) – Radial component of measured polar coordinates.
known_phase (array_like) – Angular component of reference polar coordinates in radians.
known_modulation (array_like) – Radial component of reference polar coordinates.
Return polar coordinates for calibration from reference phasor.
Return rotation angle and scale factor for calibrating phasor coordinates
from measured and known phasor coordinates of a reference, for example,
a sample of known lifetime.
Parameters:
measured_real (array_like) – Real component of measured phasor coordinates.
measured_imag (array_like) – Imaginary component of measured phasor coordinates.
known_real (array_like) – Real component of reference phasor coordinates.
known_imag (array_like) – Imaginary component of reference phasor coordinates.
Return apparent single lifetimes from polar coordinates.
Parameters:
phase (array_like) – Angular component of polar coordinates.
modulation (array_like) – Radial component of polar coordinates.
frequency (array_like) – Laser pulse or modulation frequency in MHz.
unit_conversion (float, optional) – Product of frequency and returned lifetime units’ prefix factors.
The default is 1e-3 for MHz and ns, or Hz and ms.
Use 1.0 for Hz and s.
The polar coordinates phase (\(\phi\)) and modulation (\(M\))
are converted to apparent single lifetimes
phase_lifetime (\(\tau_{\phi}\)) and
modulation_lifetime (\(\tau_{M}\)) at frequency \(f\)
according to: