symop.modes.labels¶
Mode label implementations.
This package provides concrete implementations of logical mode labels: - ModeLabel: composite label combining path, polarization, and envelope. - PathLabel: spatial or logical path identifier. - PolarizationLabel: normalized Jones-vector polarization label.
These labels define overlap behavior and stable signatures used for mode construction and caching.
- class ModeLabel(path: Path, polarization: Polarization, envelope: Envelope) None¶
Bases:
objectMode label composed of a path label and a polarization label.
The overlap factorizes into the product of the component overlaps:
\[\langle m_1, m_2 \rangle = \langle p_1, p_2 \rangle \langle \pi_1, \pi_2 \rangle \langle \zeta_1, \zeta_2 \rangle,\]where \(p\) denotes the path component ,:math:pi denotes the polarization component and \(\zeta\) denotes the envelope component.
- Parameters:
path (Path)
polarization (Polarization)
envelope (Envelope)
- path¶
Path label.
- polarization¶
Polarization label.
- envelope¶
Envelope label.
- approx_signature(*, decimals: int = 12, ignore_global_phase: bool = False) tuple[object, ...]¶
Approximate signature.
Parameters are forwarded to component
approx_signature()methods.
- envelope: Envelope¶
- overlap(other: ModeLabel) complex¶
Compute the overlap with another mode label.
The total overlap factorizes into path, polarization, and envelope contributions. Evaluatinon short-circuits when an intremediate factor is zero.
- path: Path¶
- polarization: Polarization¶
- property signature: tuple[object, ...]¶
Stable signature for caching/comparison.
- Returns:
Tuple identifying the mode label and its components.
- Return type:
Signature
- with_envelope(envelope: Envelope) Self¶
Return a copy with replaced envelope.
- Parameters:
envelope (
Envelope) – New envelope.- Returns:
Updated mode label.
- Return type:
- class Path(name: str) None¶
Bases:
objectPath label identifying a spatial (or logical) mode path.
Two path labels overlap if and only if their names are identical:
\[\begin{split}\langle \mathrm{path}(a), \mathrm{path}(b) \rangle = \begin{cases} 1, & a=b \\ 0, & a\neq b \end{cases}.\end{split}\]- Parameters:
name (str)
- approx_signature(*, decimals: int = 12, ignore_global_phase: bool = False) tuple[object, ...]¶
Approximate signature with rounded floating parameters.
- class Polarization(jones: tuple[complex, complex]) None¶
Bases:
objectPolarization label represented by a normalized Jones vector.
The Jones vector is stored as a 2-component complex vector:
\[\begin{split}\mathbf{v} = \begin{pmatrix} a \\ b \end{pmatrix},\end{split}\]normalized such that \(\|\mathbf{v}\|_2 = 1\).
Canonicalization¶
Jones vectors have a physically irrelevant global phase. This class canonicalizes the input vector by removing an overall phase so that the first non-negligible component is real and non-negative. This makes signatures stable and reduces spurious differences due to global phase.
- jones¶
Tuple \((a, b)\) representing the Jones vector components.
- classmethod A() Self¶
Anti-diagonal linear polarization.
- Returns:
\(\frac{1}{\sqrt{2}}(1, -1)\).
- Return type:
- classmethod D() Self¶
Diagonal linear polarization.
- Returns:
\(\frac{1}{\sqrt{2}}(1, 1)\).
- Return type:
- classmethod L() Self¶
Left-circular polarization (one common convention).
- Returns:
\(\frac{1}{\sqrt{2}}(1, i)\).
- Return type:
- classmethod R() Self¶
Right-circular polarization (one common convention).
- Returns:
\(\frac{1}{\sqrt{2}}(1, -i)\).
- Return type:
- approx_signature(*, decimals: int = 12, ignore_global_phase: bool = False) tuple[object, ...]¶
Approximate signature with rounded components.
- classmethod linear(theta: float) Self¶
Linear polarization at angle \(\theta\).
The Jones vector is:
\[\begin{split}\mathbf{v}(\theta) = \begin{pmatrix}\cos\theta \\ \sin\theta\end{pmatrix}.\end{split}\]- Parameters:
theta (
float) – Polarization angle (radians).- Returns:
Linear polarization label at angle \(\theta\).
- Return type:
- overlap(other: Polarization) complex¶
Compute the polarization overlap.
This is the usual complex inner product of normalized Jones vectors:
\[\langle \mathbf{v}_1, \mathbf{v}_2 \rangle = \mathbf{v}_1^\dagger \mathbf{v}_2.\]- Parameters:
other (
Polarization) – Another polarization label.- Returns:
Complex overlap \(\langle \mathbf{v}_1, \mathbf{v}_2 \rangle\).
- Return type:
- rotated(theta: float) Self¶
Rotate the polarization by angle \(\theta\).
This applies the real rotation matrix:
\[\begin{split}R(\theta)=\begin{pmatrix} \cos\theta & -\sin\theta\\ \sin\theta & \cos\theta \end{pmatrix}\end{split}\]to the Jones vector.
- Parameters:
theta (
float) – Rotation angle (radians).- Returns:
Rotated polarization label.
- Return type:
- property signature: tuple[object, ...]¶
Stable signature for caching/comparison.
The signature is based on the canonicalized Jones components.
- transformed(unitary: ndarray, *, atol: float = 1e-12) Self¶
Apply a 2x2 unitary Jones transformation.
This method applies a unitary matrix \(U\) to the Jones vector,
\[\mathbf{v}' = U \mathbf{v},\]where \(U\) must satisfy
\[U^\dagger U = I\]up to the specified tolerance.
Since
Polarizationcanonicalizes global phase, transformed states that differ only by a global phase compare equal.- Parameters:
- Returns:
Transformed polarization label.
- Return type:
- Raises:
ValueError – If
unitarydoes not have shape(2, 2)or is not unitary within the requested tolerance.
Modules
Composite mode labels. |
|
Path labels for spatial or logical mode identification. |
|
Polarization labels. |