pado.optical_element.RefractiveLens

class RefractiveLens(dim, pitch, focal_length, wvl, device, polar='non', designated_wvl=None)[source]
Parameters:
__init__(dim, pitch, focal_length, wvl, device, polar='non', designated_wvl=None)[source]

Create a thin refractive lens optical element.

Simulates a thin refractive lens that modifies the phase of incident light based on its focal length and wavelength.

Parameters:
  • dim (tuple) – Shape of the lens field (B, Ch, R, C) where: B: Batch size Ch: Number of channels R: Number of rows C: Number of columns

  • pitch (float) – Pixel pitch in meters

  • focal_length (float) – Focal length of the lens in meters

  • wvl (float or list) – Wavelength(s) of light in meters. Can be single value or list for multi-channel

  • device (str) – Device to store the lens field (‘cpu’, ‘cuda:0’, etc.)

  • polar (str, optional) – Polarization mode. Defaults to ‘non’

  • designated_wvl (float, optional) – Override wavelength for all channels. Defaults to None

Return type:

None

Examples

>>> # Create single channel lens
>>> lens = RefractiveLens((1,1,512,512), 2e-6, 0.1, 633e-9, 'cpu')
>>> # Create multi-channel lens with different wavelengths
>>> lens = RefractiveLens((1,3,512,512), 2e-6, 0.1, [633e-9,532e-9,450e-9], 'cuda:0')
set_focal_length(focal_length)[source]

Set the focal length of the lens.

Parameters:

focal_length (float) – New focal length in meters

Return type:

None

Examples

>>> lens.set_focal_length(0.2)  # Set 20cm focal length
compute_phase(wvl, shift_x=0, shift_y=0)[source]

Compute the phase modulation for the lens.

Calculates the phase change introduced by the lens based on its focal length, wavelength and any lateral shifts.

Parameters:
  • wvl (float) – Wavelength of light in meters

  • shift_x (float, optional) – Horizontal displacement of lens center in meters. Defaults to 0

  • shift_y (float, optional) – Vertical displacement of lens center in meters. Defaults to 0

Returns:

Phase modulation pattern of the lens

Return type:

torch.Tensor

Examples

>>> phase = lens.compute_phase(633e-9)  # Centered lens
>>> phase = lens.compute_phase(633e-9, shift_x=10e-6)  # Shifted lens