deeptrack.optical.holography Module#
Core features for manipulating optical fields using Fourier transforms and propagation matrices.
This module includes operations to simulate optical field propagation and perform transformations in the frequency domain. These features can be combined in processing pipelines for optical simulations and holographic reconstructions.
Key Features#
Optical Field Processing
Provides Fourier transforms, rescaling, and wavefront propagation for complex-valued optical fields, handling both real and imaginary components.
Fourier Optics and Wave Propagation
Implements Fourier transforms with optional padding for accurate frequency-domain analysis and propagation matrices to simulate free-space wavefront propagation with spatial and frequency domain shifts.
Phase & Amplitude Manipulation
Enables scaling, normalization, and modulation of phase and amplitude to preserve intensity distribution and enhance wavefront reconstruction.
Backend Compatibility
get_propagation_matrix supports both NumPy and PyTorch arrays via deeptrack.backend.xp. The Rescale, FourierTransform, InverseFourierTransform, and FourierTransformTransformation features currently operate on NumPy arrays only.
Module Structure#
Classes:
- Rescale: Rescales an optical field by subtracting the real part of the
field before multiplication.
FourierTransform: Creates matrices for propagating an optical field.
InverseFourierTransform: Creates matrices for propagating an optical field.
- FourierTransformTransformation: Applies a power of the forward or inverse
propagation matrix to an optical field.
Functions:
- get_propagation_matrix(shape, to_z, pixel_size, wavelength, dx=0, dy=0)
Computes the propagation matrix for simulating the propagation of an optical field.
Examples#
Simulate optical field propagation with Fourier transforms:
>>> import deeptrack as dt
>>> import numpy as np
Define a random optical field: >>> field = np.random.rand(128, 128, 2)
Rescale the field and compute the Fourier transform: >>> rescale_op = dt.holography.Rescale(0.5) >>> scaled_field = rescale_op(field) >>> ft_op = dt.holography.FourierTransform() >>> transformed_field = ft_op(scaled_field)
Reconstruct the field using the inverse Fourier transform: >>> ift_op = dt.holography.InverseFourierTransform() >>> reconstructed_field = ift_op(transformed_field)
Functions#
|
Get the active voxel size used for simulation, in meters. |
|
Computes the propagation matrix for simulating the propagation of an optical field. |
Classes#
|
Base feature class. |
|
Computes the Fourier transform of an optical field with optional symmetric padding. |
|
Applies a power of the forward or inverse propagation matrix to an optical field. |
|
Computes the inverse Fourier transform of an optical field and removes padding. |
|
Rescales an optical field by modifying its real and imaginary components. |