pado.propagator.Propagator

class Propagator(mode, polar='non')[source]
Parameters:
__init__(mode, polar='non')[source]

Light propagator for simulating wave propagation through free space.

Implement common diffraction methods including Fraunhofer, Fresnel, ASM and RS. Support complex field calculations.

Parameters:
  • mode (str) – Propagation method to use: - “Fraunhofer”: Far-field diffraction - “Fresnel”: Near-field diffraction - “ASM”: Angular Spectrum Method - “RS”: Rayleigh-Sommerfeld Method

  • polar (str) – Polarization mode (‘non’: scalar, ‘polar’: vector)

Examples

>>> # Create ASM propagator for scalar field
>>> prop = Propagator(mode="ASM", polar="non")
>>> # Create Fresnel propagator for vector field
>>> prop = Propagator(mode="Fresnel", polar="polar")
>>> # Create Fraunhofer propagator
>>> prop = Propagator(mode="ASM")
>>> field = torch.ones((1, 1, 1000, 1000))
>>> light = Light(field, pitch=2e-6, wvl=660e-9)
>>> light_prop = prop.forward(light, z=0.05)
forward(light, z, offset=(0, 0), linear=True, band_limit=True, b=1, target_plane=None, sampling_ratio=1, vectorized=False, steps=100)[source]

Propagate incident light through the propagator.

Parameters:
  • light (Light) – Incident light field

  • z (float) – Propagation distance in meters

  • offset (tuple) – Lateral shift (y, x) in meters for off-axis propagation

  • linear (bool) – Flag for linear convolution (with padding) or circular convolution (no padding)

  • band_limit (bool) – If True, apply band-limiting for ASM

  • b (float) – Scaling factor for observation plane (b>1: expansion, b<1: focusing)

  • target_plane (tuple, optional) – (x, y, z) coordinates for RS diffraction

  • sampling_ratio (int) – Spatial sampling ratio for RS computation

  • vectorized (bool) – If True, use vectorized implementation for RS (better performance but higher memory usage)

  • steps (int) – Number of computation steps for vectorized RS (higher values use less memory)

Returns:

Propagated light field

Return type:

Light

Examples

>>> # Basic propagation
>>> prop = Propagator(mode="ASM")
>>> light_prop = prop.forward(light, z=0.1)
>>> # Propagation with padding
>>> light_prop = prop.forward(light, z=0.1, linear=True)
>>> # Vector field propagation
>>> prop = Propagator(mode="Fresnel", polar="polar")
>>> light_prop = prop.forward(light, z=0.05)
>>> # Access x,y components
>>> x_component = light_prop.get_lightX()
>>> y_component = light_prop.get_lightY()
>>> # Vectorized RS propagation for better performance
>>> prop = Propagator(mode="RS")
>>> light_prop = prop.forward(light, z=0.1, vectorized=True, steps=50)
forward_non_polar(light, z, offset=(0, 0), linear=True, band_limit=True, b=1, target_plane=None, sampling_ratio=1, vectorized=False, steps=100)[source]

Propagate non-polarized light field using selected propagation method.

Parameters:
  • light (Light) – Input light field

  • z (float) – Propagation distance in meters

  • offset (tuple) – Lateral shift (y, x) in meters for off-axis propagation

  • linear (bool) – If True, use linear convolution with zero-padding

  • band_limit (bool) – If True, apply band-limiting for ASM

  • b (float) – Scaling factor for observation plane (b>1: expansion, b<1: focusing)

  • target_plane (tuple, optional) – (x, y, z) coordinates for RS diffraction

  • sampling_ratio (int) – Spatial sampling ratio for RS computation

  • vectorized (bool) – If True, use vectorized implementation for RS

  • steps (int) – Number of computation steps for vectorized RS

Returns:

Propagated light field

Return type:

Light

forward_Fraunhofer(light, z, linear=True)[source]

Propagate light using Fraunhofer diffraction.

Implement far-field diffraction with multi-wavelength support. The propagated field is independent of z distance, which only affect the output pixel pitch.

Parameters:
  • light (Light) – Input light field

  • z (float) – Propagation distance in meters

  • linear (bool) – If True, use linear convolution with zero-padding

Returns:

Propagated light field

Return type:

Light

forward_Fresnel(light, z, linear)[source]

Propagate light using Fresnel diffraction.

Implement Fresnel approximation with multi-wavelength support. Valid when z >> (x² + y²)_max/λ.

Parameters:
  • light (Light) – Input light field

  • z (float) – Propagation distance in meters

  • linear (bool) – If True, use linear convolution with zero-padding

Returns:

Propagated light field

Return type:

Light

forward_FFT(light, z=None)[source]

Propagate light using simple FFT-based propagation.

Apply exp(1j * phase) before FFT without considering propagation distance z or padding. Used for basic Fourier transform of the input field.

Parameters:
  • light (Light) – Input light field

  • z (float, optional) – Not used in this method

Returns:

FFT of input field

Return type:

Light

forward_ASM(light, z, offset=(0, 0), linear=True, band_limit=True, b=1)[source]

Select appropriate ASM propagation method based on parameters.

Automatically choose between standard ASM, band-limited ASM, and scaled ASM depending on the scaling factor b and offset requirements.

Parameters:
  • light (Light) – Input light field

  • z (float) – Propagation distance in meters

  • offset (tuple) – Lateral shift (y, x) in meters

  • linear (bool) – If True, use linear convolution

  • band_limit (bool) – If True, apply band-limiting

  • b (float) – Scaling factor (b>1: expansion, b<1: focusing)

Returns:

Propagated light field using selected ASM method

Return type:

Light

forward_standard_ASM(light, z, offset=(0, 0), linear=True)[source]

Propagate light using standard Angular Spectrum Method.

Implement basic ASM propagation with optional off-axis shift. Support multi-wavelength channels and linear/circular convolution.

Parameters:
  • light (Light) – Input light field

  • z (float) – Propagation distance in meters

  • offset (tuple) – Lateral shift (y, x) in meters

  • linear (bool) – If True, use linear convolution with zero-padding

Returns:

Propagated light field

Return type:

Light

forward_shifted_BL_ASM(light, z, offset=(0, 0), linear=True)[source]

Propagate light using band-limited Angular Spectrum Method.

Implement shifted band-limited ASM for improved numerical stability in off-axis propagation. Based on Matsushima’s method.

Parameters:
  • light (Light) – Input light field

  • z (float) – Propagation distance in meters

  • offset (tuple) – offset (y, x) between source and target plane in meters for off-axis propagation

  • linear (bool) – If True, use linear convolution with zero-padding

Returns:

Propagated light field

Return type:

Light

References

Matsushima, “Shifted angular spectrum method for off-axis numerical propagation”

forward_ScASM(light, z, b, linear=True)[source]

Propagate light using scaled Angular Spectrum Method.

This function perform a scaled forward angular spectrum propagation. It take an input optical field ‘light’, propagate it over a distance ‘z’, and scale the observation plane by a factor ‘b’ relative to the source plane. If ‘linear’ is True, zero-padding is applied to avoid wrap-around effects from FFT-based convolutions. refer to M. Abedi, H. Saghafifar, and L. Rahimi, “Improvement of optical wave propagation simulations: the scaled angular spectrum method for far-field and focal analysis,” Opt. Continuum 3, 935-947 (2024)

Parameters:
  • light (Light) – Input light field

  • z (float) – Propagation distance in meters

  • b (float) – Scaling factor for observation plane (b>1)

  • linear (bool) – If True, use linear convolution with zero-padding

Returns:

Propagated light field with scaled observation plane

Return type:

Light

References

Abedi et al., “Improvement of optical wave propagation simulations: the scaled angular spectrum method for far-field and focal analysis”

forward_ScASM_focusing(light, z, b, linear=True)[source]

Propagate light using scaled ASM for focusing.

Implement scaled ASM propagation for focusing to a smaller observation plane. Use FFT to transform to frequency domain, apply transfer function, then use Sc-IDFT to resample field at smaller observation plane. Support multi-wavelength channels and linear/circular convolution.

Parameters:
  • light (Light) – Input light field

  • z (float) – Propagation distance in meters

  • b (float) – Scaling factor (b<1 for focusing to smaller plane)

  • linear (bool) – If True, use linear convolution with zero-padding

Returns:

Propagated light field at focusing plane

Return type:

Light

forward_RayleighSommerfeld(light, z, target_plane=None, sampling_ratio=1, vectorized=False, steps=100)[source]

Propagate light using Rayleigh-Sommerfeld diffraction.

Implement exact scalar diffraction calculation. Computationally intensive but accurate for both near and far field. Support arbitrary target plane geometry.

Parameters:
  • light (Light) – Input light field

  • z (float) – Propagation distance in meters

  • target_plane (tuple, optional) – (x, y, z) coordinates of target plane points

  • sampling_ratio (int) – Spatial sampling ratio for computation (>1 for faster calculation)

  • vectorized (bool) – If True, use vectorized implementation for better performance

  • steps (int) – Number of computation steps for vectorized mode (higher values use less memory)

Returns:

Propagated light field

Return type:

Light

_forward_RayleighSommerfeld_vectorized(light, z, target_plane=None, steps=100)[source]

Vectorized implementation of RayleighSommerfeld propagation.

Parameters:
  • light (Light) – Input light field

  • z (float) – Propagation distance in meters

  • target_plane (tuple, optional) – (x, y, z) coordinates of target plane points

  • steps (int) – How many steps to divide computation into to manage memory usage

Returns:

Propagated light field

Return type:

Light