torchoptics.elements#

Optical element classes.

Classes#

AmplitudeModulator

Amplitude-only modulator element.

BeamSplitter

Beam splitter element.

CylindricalLens

Cylindrical lens element.

Detector

Detector element.

Element

Base class for optical elements.

HalfWaveplate

Half Waveplate element.

IdentityElement

Identity element.

LeftCircularPolarizer

Left circular polarizer element.

Lens

Lens element.

LinearDetector

Linear detector element, conceptually similar to torch.nn.Linear.

LinearPolarizer

Linear polarizer element.

ModulationElement

Base class for elements that modulate the field.

Modulator

Modulator element.

PhaseModulator

Phase-only modulator element.

PolarizedAmplitudeModulator

Polarized amplitude-only modulator element.

PolarizedModulationElement

Base class for elements that modulate the polarized field.

PolarizedModulator

Polarized modulator element.

PolarizedPhaseModulator

Polarized phase-only modulator element.

PolarizingBeamSplitter

Polarizing beam splitter element.

PolychromaticModulationElement

Base class for elements that modulate the field based on the wavelength.

PolychromaticPhaseModulator

Phase-only modulator element that modulates the optical field based on physical thickness.

QuarterWaveplate

Quarter Waveplate element.

RightCircularPolarizer

Right circular polarizer element.

Waveplate

Waveplate element.

Package Contents#

class torchoptics.elements.AmplitudeModulator(amplitude, z=0, spacing=None, offset=None)#

Bases: torchoptics.elements.elements.ModulationElement

Amplitude-only modulator element.

The amplitude modulator is described by an amplitude profile.

Parameters:
  • amplitude (Tensor) – Amplitude profile (real-valued tensor).

  • z (Scalar) – Position along the z-axis. Default: 0.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

modulation_profile()#

Return the modulation profile.

Return type:

torch.Tensor

class torchoptics.elements.BeamSplitter(shape, theta, phi_0, phi_r, phi_t, z=0, spacing=None, offset=None)#

Bases: torchoptics.elements.elements.Element

Beam splitter element.

The beam splitter is described by the following transfer matrix:

\[\begin{split}\tau = e^{i\phi_0} \begin{bmatrix} \sin \theta e^{i\phi_R} & \cos \theta e^{-i\phi_T} \\ \cos \theta e^{i\phi_T} & -\sin \theta e^{-i\phi_R} \end{bmatrix}\end{split}\]

Note

A 50:50 beam splitter is obtained by setting \(\theta = \pi/4\).

The dielectric 50:50 beam splitter has \(\phi_T = \phi_R = \phi_0 = 0\), while the symmetric beam splitter of Loudon (also 50:50) has \(\phi_T = 0\), \(\phi_R = -\pi/2\), and \(\phi_0 = \pi/2\).

Parameters:
  • shape (Vector2) – Number of grid points along the planar dimensions.

  • z (Scalar) – Position along the z-axis. Default: 0.

  • theta (Scalar) – Angle relating the transmitted and reflected beams.

  • phi_0 (Scalar) – Global phase shift.

  • phi_r (Scalar) – Reflection phase shift.

  • phi_t (Scalar) – Transmission phase shift.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

forward(field, other=None)#

Apply the beam splitter to the input fields.

Parameters:
  • field (Field) – The field to split.

  • other (Field | None) – The other field to split. Default: None.

Returns:

The split fields.

Return type:

tuple[Field, Field]

property transfer_matrix: torch.Tensor#

Return the transfer matrix of the beam splitter.

Return type:

torch.Tensor

class torchoptics.elements.CylindricalLens(shape, focal_length, theta=0, z=0, spacing=None, offset=None)#

Bases: torchoptics.elements.elements.PolychromaticModulationElement

Cylindrical lens element.

Represents a thin cylindrical lens with the following modulation profile:

\[\mathcal{M}(x, y) = \exp\left(-i \frac{\pi}{\lambda f} x^2 \right)\]
where:
  • \(\lambda\) is the wavelength of the light, and

  • \(f\) is the focal length of the lens.

Parameters:
  • shape (Vector2) – Number of grid points along the planar dimensions.

  • focal_length (Scalar) – Focal length of the lens.

  • z (Scalar) – Position along the z-axis. Default: 0.

  • theta (Scalar) – Angle of the lens in radians. Default: 0.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

modulation_profile(wavelength=None)#

Return the modulation profile.

Parameters:

wavelength (torchoptics.types.Scalar | None)

Return type:

torch.Tensor

class torchoptics.elements.Detector(shape, z=0, spacing=None, offset=None)#

Bases: torchoptics.elements.elements.Element

Detector element.

Computes the power measured by the detector for each grid cell using the following equation:

\[P_{i,j} = I_{i,j} \cdot \Delta A_{\text{cell}}\]
where:
  • \(P_{i,j}\) is the power measured in the grid cell at position \((i, j)\),

  • \(I_{i,j}\) is the intensity at position \((i, j)\), and

  • \(\Delta A_{\text{cell}}\) is the area of a single grid cell.

Parameters:
  • shape (Vector2) – Number of grid points along the planar dimensions.

  • z (Scalar) – Position along the z-axis. Default: 0.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

forward(field)#

Calculate the power per cell area.

Parameters:

field (Field) – The input field.

Returns:

The power per cell area.

Return type:

Tensor

class torchoptics.elements.Element(shape, z=0, spacing=None, offset=None)#

Bases: torchoptics.planar_grid.PlanarGrid

Base class for optical elements.

The forward() method must be implemented by the subclass.

Parameters:
  • shape (Vector2) – Number of grid points along the planar dimensions.

  • z (Scalar) – Position along the z-axis. Default: 0.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

validate_field(field)#

Validate that the field has the same geometry as the element.

Parameters:

field (Field) – The field to validate.

Return type:

None

visualize(**kwargs)#

Visualize the Element.

Return type:

matplotlib.figure.Figure | None

class torchoptics.elements.HalfWaveplate(shape, theta, z=0, spacing=None, offset=None)#

Bases: torchoptics.elements.elements.PolarizedModulationElement

Half Waveplate element.

The half waveplate is described by the following polarization matrix:

\[\begin{split}J = \begin{bmatrix} \cos^2(\theta) - \sin^2(\theta) & 2 \cos(\theta) \sin(\theta) & 0 \\ 2 \cos(\theta) \sin(\theta) & \sin^2(\theta) - \cos^2(\theta) & 0 \\ 0 & 0 & 1 \end{bmatrix}\end{split}\]
where
  • \(\theta\) is the fast axis angle.

Parameters:
  • shape (Vector2) – Number of grid points along the planar dimensions.

  • z (Scalar) – Position along the z-axis. Default: 0.

  • theta (Scalar) – Fast axis angle of the waveplate.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

polarized_modulation_profile()#

Return the polarized modulation profile.

Return type:

torch.Tensor

class torchoptics.elements.IdentityElement(shape, z=0, spacing=None, offset=None)#

Bases: torchoptics.elements.elements.Element

Identity element.

The identity element does not modify the input field. It is useful as a placeholder element in torchoptics.System.

Parameters:
  • shape (Vector2) – Number of grid points along the planar dimensions.

  • z (Scalar) – Position along the z-axis. Default: 0.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

forward(field)#

Return the input field without modification.

Parameters:

field (torchoptics.fields.Field)

Return type:

torchoptics.fields.Field

class torchoptics.elements.LeftCircularPolarizer(shape, z=0, spacing=None, offset=None)#

Bases: torchoptics.elements.elements.PolarizedModulationElement

Left circular polarizer element.

The left circular polarizer is described by the following polarization matrix:

\[\begin{split}J = \begin{bmatrix} \frac{1}{2} & -\frac{i}{2} & 0 \\ \frac{1}{2} & \frac{1}{2} & 0 \\ 0 & 0 & 1 \end{bmatrix}\end{split}\]
Parameters:
  • shape (Vector2) – Number of grid points along the planar dimensions.

  • z (Scalar) – Position along the z-axis. Default: 0.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

polarized_modulation_profile()#

Return the polarized modulation profile.

Return type:

torch.Tensor

class torchoptics.elements.Lens(shape, focal_length, z=0, spacing=None, offset=None)#

Bases: torchoptics.elements.elements.PolychromaticModulationElement

Lens element.

Represents a thin lens with the following modulation profile:

\[\mathcal{M}(x, y) = \exp\left(-i \frac{\pi}{\lambda f} (x^2 + y^2) \right)\]
where:
  • \(\lambda\) is the wavelength of the light, and

  • \(f\) is the focal length of the lens.

Parameters:
  • shape (Vector2) – Number of grid points along the planar dimensions.

  • focal_length (Scalar) – Focal length of the lens.

  • z (Scalar) – Position along the z-axis. Default: 0.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

modulation_profile(wavelength=None)#

Return the modulation profile.

Parameters:

wavelength (torchoptics.types.Scalar | None)

Return type:

torch.Tensor

class torchoptics.elements.LinearDetector(weight, z=0, spacing=None, offset=None)#

Bases: torchoptics.elements.elements.Element

Linear detector element, conceptually similar to torch.nn.Linear.

Applies a spatially varying weight to the field intensity and integrates over the plane, producing a weighted sum for each output channel.

The total weighted power measured by the detector is computed as:

\[P_c = \sum_{i, j} w_{c, i, j} \cdot I_{i, j} \cdot \Delta A_{\text{cell}}\]
where:
  • \(P_c\) is the total weighted power measured by the detector for channel \(c\),

  • \(w_{c, i, j}\) is the weight matrix for channel \(c\),

  • \(I_{i, j}\) is the intensity at position \((i, j)\), and

  • \(\Delta A_{\text{cell}}\) is the area of a single grid cell.

Note

This equation in its integral form is expressed as:

\[P_c = \int \int w_c(x, y) \cdot I(x, y) \, dx \, dy\]
Parameters:
  • weight (Tensor) – Weight matrix of shape (C, H, W).

  • z (Scalar) – Position along the z-axis. Default: 0.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

forward(field)#

Calculate the weighted power.

Parameters:

field (Field) – The input field.

Returns:

The weighted power.

Return type:

Tensor

visualize(*index, **kwargs)#

Visualize the detector output or the weight matrix.

Parameters:
  • *index (int) – The index of the channel to visualize.

  • sum_weight (bool) – Whether to plot the sum of the weight matrix. Default: False.

  • **kwargs – Additional keyword arguments for visualization.

Return type:

matplotlib.figure.Figure | None

class torchoptics.elements.LinearPolarizer(shape, theta, z=0, spacing=None, offset=None)#

Bases: torchoptics.elements.elements.PolarizedModulationElement

Linear polarizer element.

The linear polarizer is described by the following polarization matrix:

\[\begin{split}J = \begin{bmatrix} \cos^2(\theta) & \cos(\theta) \sin(\theta) & 0 \\ \cos(\theta) \sin(\theta) & \sin^2(\theta) & 0 \\ 0 & 0 & 1 \end{bmatrix}\end{split}\]

where \(\theta\) is the transmission axis of the polarizer.

Parameters:
  • shape (Vector2) – Number of grid points along the planar dimensions.

  • z (Scalar) – Position along the z-axis. Default: 0.

  • theta (Scalar) – Transmission axis of the polarizer.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

polarized_modulation_profile()#

Return the polarized modulation profile.

Return type:

torch.Tensor

class torchoptics.elements.ModulationElement(shape, z=0, spacing=None, offset=None)#

Bases: Element, abc.ABC

Base class for elements that modulate the field.

The modulation_profile property must be implemented by the subclass.

Parameters:
  • shape (Vector2) – Number of grid points along the planar dimensions.

  • z (Scalar) – Position along the z-axis. Default: 0.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

forward(field)#

Modulate the field.

Parameters:

field (Field) – The field to modulate.

Returns:

The modulated field.

Return type:

Field

abstract modulation_profile()#

Return the modulation profile.

Return type:

torch.Tensor

visualize(**kwargs)#

Visualize the modulation profile.

Parameters:

**kwargs – Additional keyword arguments for visualization.

Return type:

matplotlib.figure.Figure | None

class torchoptics.elements.Modulator(modulation, z=0, spacing=None, offset=None)#

Bases: torchoptics.elements.elements.ModulationElement

Modulator element.

The modulator is described by a complex modulation profile.

Parameters:
  • modulation (Tensor) – Complex modulation profile.

  • z (Scalar) – Position along the z-axis. Default: 0.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

modulation_profile()#

Return the modulation profile.

Return type:

torch.Tensor

class torchoptics.elements.PhaseModulator(phase, z=0, spacing=None, offset=None)#

Bases: torchoptics.elements.elements.ModulationElement

Phase-only modulator element.

The phase modulator is described by a phase profile.

Parameters:
  • phase (Tensor) – Phase profile (real-valued tensor).

  • z (Scalar) – Position along the z-axis. Default: 0.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

modulation_profile()#

Return the modulation profile.

Return type:

torch.Tensor

class torchoptics.elements.PolarizedAmplitudeModulator(amplitude, z=0, spacing=None, offset=None)#

Bases: torchoptics.elements.elements.PolarizedModulationElement

Polarized amplitude-only modulator element.

The polarized amplitude modulator is described by an amplitude profile.

Parameters:
  • amplitude (Tensor) – Amplitude profile (real-valued 3x3 tensor).

  • z (Scalar) – Position along the z-axis. Default: 0.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

polarized_modulation_profile()#

Return the polarized modulation profile.

Return type:

torch.Tensor

class torchoptics.elements.PolarizedModulationElement(shape, z=0, spacing=None, offset=None)#

Bases: Element

Base class for elements that modulate the polarized field.

The polarized_modulation_profile property must be implemented by the subclass.

Parameters:
  • shape (Vector2) – Number of grid points along the planar dimensions.

  • z (Scalar) – Position along the z-axis. Default: 0.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

forward(field)#

Modulate the polarized field.

Parameters:

field (Field) – The field to modulate.

Returns:

The modulated polarized field.

Return type:

Field

abstract polarized_modulation_profile()#

Return the polarized modulation profile.

Return type:

torch.Tensor

visualize(*index, **kwargs)#

Visualize the polarized modulation profile.

Parameters:
  • *index (int) – Index of the tensor to visualize.

  • **kwargs – Additional keyword arguments for visualization.

Return type:

matplotlib.figure.Figure | None

class torchoptics.elements.PolarizedModulator(polarized_modulation, z=0, spacing=None, offset=None)#

Bases: torchoptics.elements.elements.PolarizedModulationElement

Polarized modulator element.

The polarized modulator is described by a complex polarized modulation profile.

Parameters:
  • polarized_modulation_profile (Tensor) – Complex 3x3 polarized modulation profile.

  • z (Scalar) – Position along the z-axis. Default: 0.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

  • polarized_modulation (torch.Tensor)

polarized_modulation_profile()#

Return the polarized modulation profile.

Return type:

torch.Tensor

class torchoptics.elements.PolarizedPhaseModulator(phase, z=0, spacing=None, offset=None)#

Bases: torchoptics.elements.elements.PolarizedModulationElement

Polarized phase-only modulator element.

The polarized phase modulator is described by a polarized phase profile.

Parameters:
  • phase (Tensor) – Phase profile (real-valued 3x3 tensor).

  • z (Scalar) – Position along the z-axis. Default: 0.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

polarized_modulation_profile()#

Return the polarized modulation profile.

Return type:

torch.Tensor

class torchoptics.elements.PolarizingBeamSplitter(shape, z=0, spacing=None, offset=None)#

Bases: torchoptics.elements.elements.Element

Polarizing beam splitter element.

The polarizing beam splitter splits the input field into two orthogonal polarizations.

Parameters:
  • shape (torchoptics.types.Vector2)

  • z (torchoptics.types.Scalar)

  • spacing (torchoptics.types.Vector2 | None)

  • offset (torchoptics.types.Vector2 | None)

forward(field)#

Apply the beam splitter to the input field.

Parameters:

field (Field) – The field to split.

Returns:

The split fields.

Return type:

tuple[Field, Field]

class torchoptics.elements.PolychromaticModulationElement(shape, z=0, spacing=None, offset=None)#

Bases: Element

Base class for elements that modulate the field based on the wavelength.

The modulation_profile() property must be implemented by the subclass.

Parameters:
  • shape (Vector2) – Number of grid points along the planar dimensions.

  • z (Scalar) – Position along the z-axis. Default: 0.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

forward(field)#

Modulate the field.

Parameters:

field (Field) – The field to modulate.

Returns:

The modulated field.

Return type:

Field

abstract modulation_profile(wavelength=None)#

Return the modulation profile for the given wavelength.

Parameters:

wavelength (torchoptics.types.Scalar | None)

Return type:

torch.Tensor

visualize(wavelength=None, **kwargs)#

Visualize the modulation profile.

Parameters:
  • wavelength (Scalar | None) – Wavelength for the modulation profile.

  • **kwargs – Additional keyword arguments for visualization.

Return type:

matplotlib.figure.Figure | None

class torchoptics.elements.PolychromaticPhaseModulator(thickness, n, z=0, spacing=None, offset=None)#

Bases: torchoptics.elements.elements.PolychromaticModulationElement

Phase-only modulator element that modulates the optical field based on physical thickness.

The modulation is applied according to:

\[\mathcal{M}(x, y) = \exp\left(i \frac{2 \pi}{\lambda} \left[ n\left(\lambda\right) - 1 \right] t(x, y)\right)\]

where:

  • \(\mathcal{M}\) is the modulation profile applied to the optical field.

  • \(\lambda\) is the wavelength of the light.

  • \(n(\lambda)\) is the wavelength-dependent refractive index of the medium.

  • \(t(x, y)\) is the physical thickness of the medium at each point.

Parameters:
  • thickness (Tensor) – Physical thickness of the medium (real-valued tensor).

  • n (Scalar | Callable[[Scalar], Scalar]) – Refractive index. Can be a scalar (constant) or a callable that takes the wavelength and returns the refractive index (for dispersive media).

  • z (Scalar) – Position along the z-axis. Default: 0.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

modulation_profile(wavelength=None)#

Return the modulation profile.

Parameters:

wavelength (torchoptics.types.Scalar | None)

Return type:

torch.Tensor

class torchoptics.elements.QuarterWaveplate(shape, theta, z=0, spacing=None, offset=None)#

Bases: torchoptics.elements.elements.PolarizedModulationElement

Quarter Waveplate element.

The quarter waveplate is described by the following polarization matrix:

\[\begin{split}J = \begin{bmatrix} \cos^2(\theta) + i \sin^2(\theta) & (1 - i) \cos(\theta) \sin(\theta) & 0 \\ (1 - i) \cos(\theta) \sin(\theta) & \sin^2(\theta) + i \cos^2(\theta) & 0 \\ 0 & 0 & 1 \end{bmatrix}\end{split}\]
where
  • \(\theta\) is the fast axis angle.

Parameters:
  • shape (Vector2) – Number of grid points along the planar dimensions.

  • z (Scalar) – Position along the z-axis. Default: 0.

  • theta (Scalar) – Fast axis angle of the waveplate.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

polarized_modulation_profile()#

Return the polarized modulation profile.

Return type:

torch.Tensor

class torchoptics.elements.RightCircularPolarizer(shape, z=0, spacing=None, offset=None)#

Bases: torchoptics.elements.elements.PolarizedModulationElement

Right circular polarizer element.

The right circular polarizer is described by the following polarization matrix:

\[\begin{split}J = \begin{bmatrix} \frac{1}{2} & \frac{i}{2} & 0 \\ \frac{-i}{2} & \frac{1}{2} & 0 \\ 0 & 0 & 1 \end{bmatrix}\end{split}\]
Parameters:
  • shape (Vector2) – Number of grid points along the planar dimensions.

  • z (Scalar) – Position along the z-axis. Default: 0.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

polarized_modulation_profile()#

Return the polarized modulation profile.

Return type:

torch.Tensor

class torchoptics.elements.Waveplate(shape, phi, theta, z=0, spacing=None, offset=None)#

Bases: torchoptics.elements.elements.PolarizedModulationElement

Waveplate element.

The waveplate is described by the following polarization matrix:

\[\begin{split}J = \begin{bmatrix} \cos^2(\theta) + e^{i \phi} \sin^2(\theta) & (1 - e^{i \phi}) \cos(\theta) \sin(\theta) & 0 \\ (1 - e^{i \phi}) \cos(\theta) \sin(\theta) & \sin^2(\theta) + e^{i \phi} \cos^2(\theta) & 0 \\ 0 & 0 & 1 \end{bmatrix}\end{split}\]
where
  • \(\theta\) is the fast axis angle, and

  • \(\phi\) is the phase delay between the fast and slow axes.

Note

A quarter waveplate (QWP) is obtained by setting \(\phi = \pi/2\).

A half waveplate (HWP) is obtained by setting \(\phi = \pi\).

Parameters:
  • shape (Vector2) – Number of grid points along the planar dimensions.

  • z (Scalar) – Position along the z-axis. Default: 0.

  • phi (Scalar) – Phase delay of the waveplate.

  • theta (Scalar) – Fast axis angle of the waveplate.

  • spacing (Vector2 | None) – Distance between grid points along planar dimensions. Default: if None, uses a global default (see torchoptics.set_default_spacing()).

  • offset (Vector2 | None) – Center coordinates of the plane. Default: (0, 0).

polarized_modulation_profile()#

Return the polarized modulation profile.

Return type:

torch.Tensor