deeptrack.aberrations Module#

Features that aberrate and modify pupil functions.

This module provides tools to simulate optical aberrations in microscopy by modifying the pupil function of an image. These aberrations can be used to study and model the effects of real-world optical imperfections.

Key Features#

The module allows simulation of both amplitude and phase aberrations, including specific common aberrations, through a set of modular classes:

  • Amplitude Aberrations

    Modulate the intensity profile of the pupil function:
    • GaussianApodization: Introduces Gaussian pupil apodization to

    reduce the amplitude at higher spatial frequencies.

  • Phase Aberrations

    Introduce phase shifts in the pupil function using Zernike polynomials:
    • Zernike: Adds phase aberrations based on user-defined Zernike

    coefficients.

  • Common Aberrations

    Implements commonly encountered Zernike phase aberrations for convenience:
    • Piston: Uniform phase shift (n=0, m=0).

    • VerticalTilt: Linear tilt along the y-axis (n=1, m=-1).

    • HorizontalTilt: Linear tilt along the x-axis (n=1, m=1).

    • ObliqueAstigmatism: Oblique astigmatism (n=2, m=-2).

    • Defocus: Defocus (n=2, m=0).

    • Astigmatism: Regular astigmatism (n=2, m=2).

    • ObliqueTrefoil: Oblique trefoil (n=3, m=-3).

    • VerticalComa: Vertical coma (n=3, m=-1).

    • HorizontalComa: Horizontal coma (n=3, m=1).

    • Trefoil: Trefoil aberration (n=3, m=3).

    • SphericalAberration: Spherical aberration (n=4, m=0).

Module Structure#

Classes:

  • Aberration: Base class for all aberrations.

  • GaussianApodization: Implements pupil apodization.

  • Zernike: Adds phase aberrations using Zernike polynomials.

  • Specific Zernike-based aberration subclasses, e.g., Defocus,

    Astigmatism, etc.

Examples#

Applying Gaussian Apodization

>>> import deeptrack as dt
>>> particle = dt.PointParticle(position=(32, 32))
>>> aberrated_optics = dt.Fluorescence(
>>>     NA=0.6,
>>>     resolution=1e-7,
>>>     magnification=1,
>>>     wavelength=530e-9,
>>>     output_region=(0, 0, 64, 48),
>>>     padding=(64, 64, 64, 64),
>>>     aberration=aberrations.GaussianApodization(sigma=0.9),
>>>     z = -1.0 * dt.units.micrometer,
>>> )
>>> aberrated_particle = aberrated_optics(particle)
>>> aberrated_particle.plot(cmap="gray")

Classes#

Aberration([_input])

Base class for optical aberrations.

Astigmatism(*args[, coefficient])

Zernike polynomial with n=2, m=2.

Defocus(*args[, coefficient])

Zernike polynomial with n=2, m=0.

Feature([_input])

Base feature class.

GaussianApodization([sigma, offset])

Introduces pupil apodization.

HorizontalComa(*args[, coefficient])

Zernike polynomial with n=3, m=1.

HorizontalTilt(*args[, coefficient])

Zernike polynomial with n=1, m=1.

ObliqueAstigmatism(*args[, coefficient])

Zernike polynomial with n=2, m=-2.

ObliqueTrefoil(*args[, coefficient])

Zernike polynomial with n=3, m=-3.

Piston(*args[, coefficient])

Zernike polynomial with n=0, m=0.

SphericalAberration(*args[, coefficient])

Zernike polynomial with n=4, m=0.

Trefoil(*args[, coefficient])

Zernike polynomial with n=3, m=3.

VerticalComa(*args[, coefficient])

Zernike polynomial with n=3, m=-1.

VerticalTilt(*args[, coefficient])

Zernike polynomial with n=1, m=-1.

Zernike(n, m[, coefficient])

Introduces a Zernike phase aberration.