optiland.rays.polarization_state#

Polarization State

This module contains the PolarizationState class, which represents the polarization state of a light ray or ray bundle. This class may be used to define the polarization state of the light rays in an optical system.

Kramer Harrison, 2024

Functions

create_polarization(pol_type)

Create a polarization state based on the given polarization type.

Classes

PolarizationState([is_polarized, Ex, Ey, ...])

Represents the polarization state of a light ray.

class PolarizationState(is_polarized: bool = False, Ex: float | None = None, Ey: float | None = None, phase_x: float | None = None, phase_y: float | None = None)[source]#

Represents the polarization state of a light ray.

Variables:
  • is_polarized (bool) – Indicates whether the state is polarized.

  • Ex (Optional[float]) – Electric field component in the x-direction.

  • Ey (Optional[float]) – Electric field component in the y-direction.

  • phase_x (Optional[float]) – Phase of the x-component of the electric field.

  • phase_y (Optional[float]) – Phase of the y-component of the electric field.

classmethod from_dict(data: dict[str, bool | float | None]) → PolarizationState[source]#

Restore and validate an incident state using the active backend.

Parameters:

data – Values produced by to_dict(). For unpolarized light, the four numerical values may also be omitted.

Returns:

The restored incident polarization state.

Raises:

ValueError – If the values are inconsistent with is_polarized.

to_dict() → dict[str, bool | float | None][source]#

Return backend-independent values suitable for JSON serialization.

The dictionary stores is_polarized, normalized electric-field amplitudes Ex/Ey, and phases phase_x/phase_y in radians. The four numerical values are None for unpolarized light. Tensor values are detached from their computational graph.

create_polarization(pol_type: str)[source]#

Create a polarization state based on the given polarization type.

Parameters:

pol_type (str) – The type of polarization. Must be one of the following: - ‘unpolarized’ for unpolarized light - ‘H’ for horizontal polarization - ‘V’ for vertical polarization - ‘L+45’ for linear polarization at +45 degrees - ‘L-45’ for linear polarization at -45 degrees - ‘RCP’ for right circular polarization - ‘LCP’ for left circular polarization

Returns:

The created polarization state.

Return type:

PolarizationState

Raises:

ValueError – If an invalid polarization type is provided.