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.
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:
- Returns:
Phase modulation pattern of the lens
- Return type:
Examples
>>> phase = lens.compute_phase(633e-9) # Centered lens >>> phase = lens.compute_phase(633e-9, shift_x=10e-6) # Shifted lens