pado.optical_element.PolarizedSLM¶
- class PolarizedSLM(dim, pitch, wvl, device)[source]¶
-
- __init__(dim, pitch, wvl, device)[source]¶
SLM which can control phase & amplitude of each polarization component.
- Parameters:
Examples
>>> slm = PolarizedSLM(dim=(1,1,1024,1024), pitch=6.4e-6, wvl=633e-9, device='cuda:0')
- set_amplitude_change(amplitude, wvl)[source]¶
Set amplitude change for both polarization components.
- Parameters:
amplitude (torch.Tensor) – Amplitude change [B, 1, R, C, 2] in polar representation
wvl (float) – Wavelength in meters
- Return type:
Examples
>>> amp = torch.ones((1,1,1024,1024,2)) * 0.8 # 80% transmission for both polarizations >>> slm.set_amplitude_change(amp, wvl=633e-9)
- set_phase_change(phase_change, wvl)[source]¶
Set phase change for both polarization components.
- Parameters:
phase_change (torch.Tensor) – Phase change [B, 1, R, C, 2] in polar representation
wvl (float) – Wavelength in meters
- Return type:
Examples
>>> phase = torch.ones((1,1,1024,1024,2)) * np.pi # π phase shift for both polarizations >>> slm.set_phase_change(phase, wvl=633e-9)
- set_amplitudeX_change(amplitude, wvl)[source]¶
Set amplitude change for X polarization component.
- Parameters:
amplitude (torch.Tensor) – Amplitude change [B, 1, R, C] for X component
wvl (float) – Wavelength in meters
- Return type:
Examples
>>> ampX = torch.ones((1,1,1024,1024)) * 0.8 # 80% transmission for X polarization >>> slm.set_amplitudeX_change(ampX, wvl=633e-9)
- set_amplitudeY_change(amplitude, wvl)[source]¶
Set amplitude change for Y polarization component.
- Parameters:
amplitude (torch.Tensor) – Amplitude change [B, 1, R, C] for Y component
wvl (float) – Wavelength in meters
- Return type:
Examples
>>> ampY = torch.ones((1,1,1024,1024)) * 0.6 # 60% transmission for Y polarization >>> slm.set_amplitudeY_change(ampY, wvl=633e-9)
- set_phaseX_change(phase_change, wvl)[source]¶
Set phase change for X polarization component.
- Parameters:
phase_change (torch.Tensor) – Phase change [B, 1, R, C] for X component
wvl (float) – Wavelength in meters
- Return type:
Examples
>>> phaseX = torch.ones((1,1,1024,1024)) * np.pi/2 # π/2 phase shift for X polarization >>> slm.set_phaseX_change(phaseX, wvl=633e-9)
- set_phaseY_change(phase_change, wvl)[source]¶
Set phase change for Y polarization component.
- Parameters:
phase_change (torch.Tensor) – Phase change [B, 1, R, C] for Y component
wvl (float) – Wavelength in meters
- Return type:
Examples
>>> phaseY = torch.ones((1,1,1024,1024)) * np.pi # π phase shift for Y polarization >>> slm.set_phaseY_change(phaseY, wvl=633e-9)
- get_phase_changeX()[source]¶
Return phase change for X polarization component.
- Returns:
Phase change [B, 1, R, C] for X component
- Return type:
Examples
>>> phaseX = slm.get_phase_changeX() # Get X polarization phase profile
- get_phase_changeY()[source]¶
Return phase change for Y polarization component.
- Returns:
Phase change [B, 1, R, C] for Y component
- Return type:
Examples
>>> phaseY = slm.get_phase_changeY() # Get Y polarization phase profile
- get_amplitude_changeX()[source]¶
Return amplitude change for X polarization component.
- Returns:
Amplitude change [B, 1, R, C] for X component
- Return type:
Examples
>>> ampX = slm.get_amplitude_changeX() # Get X polarization amplitude profile
- get_amplitude_changeY()[source]¶
Return amplitude change for Y polarization component.
- Returns:
Amplitude change [B, 1, R, C] for Y component
- Return type:
Examples
>>> ampY = slm.get_amplitude_changeY() # Get Y polarization amplitude profile
- forward(light, interp_mode='nearest')[source]¶
Apply polarization-dependent modulation to input light.
- Parameters:
- Returns:
Modulated light field
- Return type:
Examples
>>> modulated_light = slm.forward(input_light) # Apply polarization modulation >>> modulated_light = slm.forward(input_light, interp_mode='bilinear') # Use bilinear interpolation