phasorpy._phasorpy#

Note

This module and its functions are not part of the public interface. They are intended to facilitate the development of the PhasorPy library.

Cython implementation of low-level functions for the PhasorPy library.

phasorpy._phasorpy._gaussian_signal(signal, mean, stdev)#

Return normal distribution, wrapped around at borders.

Parameters:
  • signal (memoryview of float32 or float64) – Writable buffer where calculated signal samples are stored.

  • mean (float) – Mean of normal distribution.

  • stdev (float) – Standard deviation of normal distribution.

phasorpy._phasorpy._median_filter_2d(image, filtered_image, kernel_size, repeat=1, num_threads=1)#

Apply 2D median filter ignoring NaN.

phasorpy._phasorpy._phasor_from_lifetime(phasor, frequency, lifetime, fraction, unit_conversion, preexponential)#

Calculate phasor coordinates from lifetime components.

Parameters:
  • phasor (3D memoryview of float32 or float64) –

    Writable buffer of three dimensions where calculated phasor coordinates are stored:

    1. real and imaginary components

    2. frequencies

    3. lifetimes or fractions

  • frequency (2D memoryview of float64) – One-dimensional sequence of laser-pulse or modulation frequencies.

  • lifetime (2D memoryview of float64) –

    Buffer of two dimensions:

    1. lifetimes

    2. components of lifetimes

  • fraction (2D memoryview of float64) –

    Buffer of two dimensions:

    1. fractions

    2. fractions of lifetime components

  • unit_conversion (float) – Product of frequency and lifetime units’ prefix factors. 1e-3 for MHz and ns. 1.0 for Hz and s.

  • preexponential (bool) – If true, fractions are pre-exponential amplitudes, else fractional intensities.

phasorpy._phasorpy._phasor_from_signal(phasor, signal, sincos, normalize, num_threads)#

Return phasor coordinates from signal along middle axis.

Parameters:
  • phasor (3D memoryview of float32 or float64) –

    Writable buffer of three dimensions where calculated phasor coordinates are stored:

    1. mean, real, and imaginary components

    2. lower dimensions flat

    3. upper dimensions flat

  • signal (3D memoryview of float32 or float64) –

    Buffer of three dimensions containing signal:

    1. lower dimensions flat

    2. dimension over which to compute FFT, number samples

    3. upper dimensions flat

  • sincos (3D memoryview of float64) –

    Buffer of three dimensions containing sine and cosine terms to be multiplied with signal:

    1. number harmonics

    2. number samples

    3. cos and sin

  • normalize (bool) – Normalize phasor coordinates.

  • num_threads (int) – Number of OpenMP threads to use for parallelization.

Notes

This implementation requires contiguous input arrays.

phasorpy._phasorpy._phasor_from_signal_vector(phasor, signal, sincos, num_threads)#

Calculate phasor coordinate vectors from signal along last axis.

Parameters:
  • phasor (2D memoryview of float32 or float64) –

    Writable buffer of two dimensions where calculated phasor vectors are stored:

    1. other dimensions flat

    2. real and imaginary components

  • signal (2D memoryview of float32 or float64) –

    Buffer of two dimensions containing signal:

    1. other dimensions flat

    2. dimension over which to compute FFT, number samples

  • sincos (3D memoryview of float64) –

    Buffer of three dimensions containing sine and cosine terms to be multiplied with signal:

    1. number harmonics

    2. number samples

    3. cos and sin

  • num_threads (int) – Number of OpenMP threads to use for parallelization.

Notes

This implementation requires contiguous input arrays.

phasorpy._phasorpy._signal_denoise_vector(denoised, integrated, signal, spectral_vector, sigma, vmin, num_threads)#

Calculate denoised signal from spectral_vector.