Skip to content

Polarization

polarization

Polarization optics: Jones-calculus building blocks and Mask subclasses that act on a Beam's (Ex, Ey) transverse field components.

Jones matrices here follow the convention

[Ex']   [J00 J01] [Ex]
[Ey'] = [J10 J11] [Ey]

JonesMask wraps a 2x2 Jones matrix as a Mask (see structured_optics.masks) so it can be applied to a Beam the same way spatial masks are, e.g.:

beam = beam * Polarizer(angle=0, proj="H") * QWP(angle=np.pi/4)

HPROJ module-attribute

HPROJ = np.array([[1, 0], [0, 0]], dtype='complex')

np.ndarray: Jones projector onto horizontal linear polarization.

VPROJ module-attribute

VPROJ = np.array([[0, 0], [0, 1]], dtype='complex')

np.ndarray: Jones projector onto vertical linear polarization.

DPROJ module-attribute

DPROJ = np.array([[1, 1], [1, 1]], dtype='complex') / 2

np.ndarray: Jones projector onto diagonal (+45 deg) linear polarization.

APROJ module-attribute

APROJ = np.array([[1, -1], [-1, 1]], dtype='complex') / 2

np.ndarray: Jones projector onto anti-diagonal (-45 deg) linear polarization.

RPROJ module-attribute

RPROJ = np.array([[1, 1j], [-1j, 1]], dtype='complex') / 2

np.ndarray: Jones projector onto right-circular polarization.

LPROJ module-attribute

LPROJ = np.array([[1, -1j], [1j, 1]], dtype='complex') / 2

np.ndarray: Jones projector onto left-circular polarization.

JonesMask

Bases: Mask

A Mask defined by a 2x2 Jones matrix, acting on (Ex, Ey) only.

Subclasses implement matrix(beam); Ez (if present) is left untouched.

matrix abstractmethod

matrix(beam) -> np.ndarray

Return the 2x2 Jones matrix to apply to beam's (Ex, Ey).

Parameters:

Name Type Description Default
beam Beam

The beam the matrix will be applied to. Provided so subclasses can compute a matrix that depends on beam state.

required

Returns:

Type Description
ndarray

A 2x2 (possibly complex) Jones matrix.

Source code in structured_optics\polarization.py
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
@abstractmethod
def matrix(self, beam) -> np.ndarray:
    """Return the 2x2 Jones matrix to apply to `beam`'s (Ex, Ey).

    Parameters
    ----------
    beam : Beam
        The beam the matrix will be applied to. Provided so
        subclasses can compute a matrix that depends on beam state.

    Returns
    -------
    np.ndarray
        A 2x2 (possibly complex) Jones matrix.
    """
    raise NotImplementedError

apply

apply(beam)

Apply this Jones matrix to a copy of beam's Ex/Ey components.

Parameters:

Name Type Description Default
beam Beam

The beam to transform. If beam.pol == 1 (scalar/non-vector beam), the beam is returned unchanged, since there is no (Ex, Ey) decomposition to act on.

required

Returns:

Type Description
Beam

beam unchanged if beam.pol == 1; otherwise a copy of beam with Ex, Ey replaced by J @ [Ex, Ey], where J = self.matrix(beam). Ez (if present) and the original beam are left untouched.

Source code in structured_optics\polarization.py
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
def apply(self, beam):
    """Apply this Jones matrix to a copy of `beam`'s Ex/Ey components.

    Parameters
    ----------
    beam : Beam
        The beam to transform. If `beam.pol == 1` (scalar/non-vector
        beam), the beam is returned unchanged, since there is no
        (Ex, Ey) decomposition to act on.

    Returns
    -------
    Beam
        `beam` unchanged if `beam.pol == 1`; otherwise a copy of
        `beam` with `Ex`, `Ey` replaced by
        ``J @ [Ex, Ey]``, where `J = self.matrix(beam)`. `Ez` (if
        present) and the original `beam` are left untouched.
    """
    if beam.pol == 1:
        return beam
    J = self.matrix(beam)
    result = beam.copy()
    Ex, Ey = beam.Ex.copy(), beam.Ey.copy()
    result.Ex = J[0, 0] * Ex + J[0, 1] * Ey
    result.Ey = J[1, 0] * Ex + J[1, 1] * Ey
    return result

HWP

HWP(angle: float)

Bases: JonesMask

A half-wave plate, oriented with its fast axis at angle.

Parameters:

Name Type Description Default
angle float

Orientation of the fast axis, in radians.

required
Source code in structured_optics\polarization.py
176
177
178
179
180
181
182
183
def __init__(self, angle: float):
    """
    Parameters
    ----------
    angle : float
        Orientation of the fast axis, in radians.
    """
    self.angle = angle

matrix

matrix(beam)

Return the half-wave plate's Jones matrix.

Parameters:

Name Type Description Default
beam Beam

Unused; accepted to satisfy the JonesMask.matrix interface.

required

Returns:

Type Description
ndarray

The result of J_hwp(self.angle).

Source code in structured_optics\polarization.py
185
186
187
188
189
190
191
192
193
194
195
196
197
198
def matrix(self, beam):
    """Return the half-wave plate's Jones matrix.

    Parameters
    ----------
    beam : Beam
        Unused; accepted to satisfy the `JonesMask.matrix` interface.

    Returns
    -------
    np.ndarray
        The result of ``J_hwp(self.angle)``.
    """
    return J_hwp(self.angle)

QWP

QWP(angle: float)

Bases: JonesMask

A quarter-wave plate, oriented with its fast axis at angle.

Parameters:

Name Type Description Default
angle float

Orientation of the fast axis, in radians.

required
Source code in structured_optics\polarization.py
204
205
206
207
208
209
210
211
def __init__(self, angle: float):
    """
    Parameters
    ----------
    angle : float
        Orientation of the fast axis, in radians.
    """
    self.angle = angle

matrix

matrix(beam)

Return the quarter-wave plate's Jones matrix.

Parameters:

Name Type Description Default
beam Beam

Unused; accepted to satisfy the JonesMask.matrix interface.

required

Returns:

Type Description
ndarray

The result of J_qwp(self.angle).

Source code in structured_optics\polarization.py
213
214
215
216
217
218
219
220
221
222
223
224
225
226
def matrix(self, beam):
    """Return the quarter-wave plate's Jones matrix.

    Parameters
    ----------
    beam : Beam
        Unused; accepted to satisfy the `JonesMask.matrix` interface.

    Returns
    -------
    np.ndarray
        The result of ``J_qwp(self.angle)``.
    """
    return J_qwp(self.angle)

Polarizer

Polarizer(angle: float = 0, proj: str = 'H')

Bases: JonesMask

An ideal linear or circular polarizer, oriented at angle and projecting onto the polarization state named by proj.

Parameters:

Name Type Description Default
angle float

Rotation applied to the base projector, in radians. Defaults to 0.

0
proj str

Polarization state to project onto before rotation. One of "H", "V", "D", "A", "R", "L" (see _PROJECTORS). Defaults to "H".

'H'
Source code in structured_optics\polarization.py
233
234
235
236
237
238
239
240
241
242
243
244
245
def __init__(self, angle: float = 0, proj: str = "H"):
    """
    Parameters
    ----------
    angle : float, optional
        Rotation applied to the base projector, in radians.
        Defaults to 0.
    proj : str, optional
        Polarization state to project onto before rotation. One of
        "H", "V", "D", "A", "R", "L" (see `_PROJECTORS`). Defaults
        to "H".
    """
    self.angle, self.proj = angle, proj

matrix

matrix(beam)

Return the polarizer's Jones matrix.

Parameters:

Name Type Description Default
beam Beam

Unused; accepted to satisfy the JonesMask.matrix interface.

required

Returns:

Type Description
ndarray

The result of rotating _PROJECTORS[self.proj] by self.angle via J_rot.

Source code in structured_optics\polarization.py
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
def matrix(self, beam):
    """Return the polarizer's Jones matrix.

    Parameters
    ----------
    beam : Beam
        Unused; accepted to satisfy the `JonesMask.matrix` interface.

    Returns
    -------
    np.ndarray
        The result of rotating `_PROJECTORS[self.proj]` by
        `self.angle` via `J_rot`.
    """
    return J_rot(_PROJECTORS[self.proj], self.angle)

J_rot

J_rot(matrix, ang)

Rotate a Jones matrix about the optical axis by ang.

Applies the similarity transform R(ang) @ matrix @ R(ang)^H, where R(ang) is the standard 2x2 rotation matrix and ^H denotes the conjugate transpose. This is the general way to express any Jones element (retarder, projector, etc.) at an arbitrary orientation.

Parameters:

Name Type Description Default
matrix ndarray

2x2 Jones matrix to rotate, expressed in the element's own (unrotated) basis.

required
ang float

Rotation angle, in radians.

required

Returns:

Type Description
ndarray

The rotated 2x2 Jones matrix.

Source code in structured_optics\polarization.py
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
def J_rot(matrix, ang):
    """Rotate a Jones matrix about the optical axis by `ang`.

    Applies the similarity transform ``R(ang) @ matrix @ R(ang)^H``, where
    `R(ang)` is the standard 2x2 rotation matrix and `^H` denotes the
    conjugate transpose. This is the general way to express any Jones
    element (retarder, projector, etc.) at an arbitrary orientation.

    Parameters
    ----------
    matrix : np.ndarray
        2x2 Jones matrix to rotate, expressed in the element's own
        (unrotated) basis.
    ang : float
        Rotation angle, in radians.

    Returns
    -------
    np.ndarray
        The rotated 2x2 Jones matrix.
    """
    rt = np.array([[np.cos(ang), -np.sin(ang)],[np.sin(ang), np.cos(ang)]], dtype='complex')
    return rt@matrix@np.conjugate(rt.T)

J_phase_retarder

J_phase_retarder(delta)

Build the Jones matrix of a linear phase retarder in its own basis.

Parameters:

Name Type Description Default
delta float

Retardance between the fast and slow axes, in radians.

required

Returns:

Type Description
ndarray

The 2x2 diagonal Jones matrix diag(exp(1j*delta/2), exp(-1j*delta/2)).

Source code in structured_optics\polarization.py
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
def J_phase_retarder(delta):
    """Build the Jones matrix of a linear phase retarder in its own basis.

    Parameters
    ----------
    delta : float
        Retardance between the fast and slow axes, in radians.

    Returns
    -------
    np.ndarray
        The 2x2 diagonal Jones matrix
        ``diag(exp(1j*delta/2), exp(-1j*delta/2))``.
    """
    return np.array([[np.exp(1j*delta/2), 0],[0, np.exp(-1j*delta/2)]])

J_hwp

J_hwp(ang)

Build the Jones matrix of a half-wave-plate-type retarder at angle ang.

Parameters:

Name Type Description Default
ang float

Orientation of the retarder's fast axis, in radians.

required

Returns:

Type Description
ndarray

The 2x2 Jones matrix from rotating J_phase_retarder(np.pi/2) by ang via J_rot.

Source code in structured_optics\polarization.py
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
def J_hwp(ang):
    """Build the Jones matrix of a half-wave-plate-type retarder at angle `ang`.

    Parameters
    ----------
    ang : float
        Orientation of the retarder's fast axis, in radians.

    Returns
    -------
    np.ndarray
        The 2x2 Jones matrix from rotating `J_phase_retarder(np.pi/2)` by
        `ang` via `J_rot`.
    """
    return J_rot(J_phase_retarder(np.pi/2), ang)

J_qwp

J_qwp(ang)

Build the Jones matrix of a quarter-wave-plate-type retarder at angle ang.

Parameters:

Name Type Description Default
ang float

Orientation of the retarder's fast axis, in radians.

required

Returns:

Type Description
ndarray

The 2x2 Jones matrix from rotating J_phase_retarder(np.pi/4) by ang via J_rot.

Source code in structured_optics\polarization.py
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
def J_qwp(ang):
    """Build the Jones matrix of a quarter-wave-plate-type retarder at angle `ang`.

    Parameters
    ----------
    ang : float
        Orientation of the retarder's fast axis, in radians.

    Returns
    -------
    np.ndarray
        The 2x2 Jones matrix from rotating `J_phase_retarder(np.pi/4)` by
        `ang` via `J_rot`.
    """
    return J_rot(J_phase_retarder(np.pi/4), ang)