极化#
该模块实现了模拟光场偏振的例程,并可用于计算偏振光学元件对光场的影响。
琼斯·维特斯。
斯托克斯矢量。
琼斯矩阵。
穆勒矩阵。
实例#
我们计算一个通用的琼斯向量:
>>> from sympy import symbols, pprint, zeros, simplify
>>> from sympy.physics.optics.polarization import (jones_vector, stokes_vector,
... half_wave_retarder, polarizing_beam_splitter, jones_2_stokes)
>>> psi, chi, p, I0 = symbols("psi, chi, p, I0", real=True)
>>> x0 = jones_vector(psi, chi)
>>> pprint(x0, use_unicode=True)
⎡-ⅈ⋅sin(χ)⋅sin(ψ) + cos(χ)⋅cos(ψ)⎤
⎢ ⎥
⎣ⅈ⋅sin(χ)⋅cos(ψ) + sin(ψ)⋅cos(χ) ⎦
And the more general Stokes vector:
>>> s0 = stokes_vector(psi, chi, p, I0)
>>> pprint(s0, use_unicode=True)
⎡ I₀ ⎤
⎢ ⎥
⎢I₀⋅p⋅cos(2⋅χ)⋅cos(2⋅ψ)⎥
⎢ ⎥
⎢I₀⋅p⋅sin(2⋅ψ)⋅cos(2⋅χ)⎥
⎢ ⎥
⎣ I₀⋅p⋅sin(2⋅χ) ⎦
We calculate how the Jones vector is modified by a half-wave plate:
>>> alpha = symbols("alpha", real=True)
>>> HWP = half_wave_retarder(alpha)
>>> x1 = simplify(HWP*x0)
我们计算了一束光通过半波片然后通过偏振分束器的非常常见的操作。我们将此琼斯矢量作为双琼斯矢量状态的第一个条目,该状态通过4x4琼斯矩阵对偏振分束器进行变换,以获得透射和反射琼斯矢量:
>>> PBS = polarizing_beam_splitter()
>>> X1 = zeros(4, 1)
>>> X1[:2, :] = x1
>>> X2 = PBS*X1
>>> transmitted_port = X2[:2, :]
>>> reflected_port = X2[2:, :]
这使我们能够计算出两个端口的功率如何取决于初始极化:
>>> transmitted_power = jones_2_stokes(transmitted_port)[0]
>>> reflected_power = jones_2_stokes(reflected_port)[0]
>>> print(transmitted_power)
cos(-2*alpha + chi + psi)**2/2 + cos(2*alpha + chi - psi)**2/2
>>> print(reflected_power)
sin(-2*alpha + chi + psi)**2/2 + sin(2*alpha + chi - psi)**2/2
有关详细信息和示例,请参见各个函数的说明。
工具书类#
- sympy.physics.optics.polarization.half_wave_retarder(theta)[源代码]#
A half-wave retarder Jones matrix at angle
theta
.- 参数:
theta : numeric type or SymPy Symbol
快轴相对于水平面的角度。
- 返回:
SymPy Matrix
表示缓速器的琼斯矩阵。
实例
一种普通的半波片。
>>> from sympy import pprint, symbols >>> from sympy.physics.optics.polarization import half_wave_retarder >>> theta= symbols("theta", real=True) >>> HWP = half_wave_retarder(theta) >>> pprint(HWP, use_unicode=True) ⎡ ⎛ 2 2 ⎞ ⎤ ⎢-ⅈ⋅⎝- sin (θ) + cos (θ)⎠ -2⋅ⅈ⋅sin(θ)⋅cos(θ) ⎥ ⎢ ⎥ ⎢ ⎛ 2 2 ⎞⎥ ⎣ -2⋅ⅈ⋅sin(θ)⋅cos(θ) -ⅈ⋅⎝sin (θ) - cos (θ)⎠⎦
- sympy.physics.optics.polarization.jones_2_stokes(e)[源代码]#
Return the Stokes vector for a Jones vector
e
.- 参数:
e : SymPy Matrix
琼斯矢量。
- 返回:
SymPy Matrix
琼斯矢量。
实例
庞加莱球体上的轴。
>>> from sympy import pprint, pi >>> from sympy.physics.optics.polarization import jones_vector >>> from sympy.physics.optics.polarization import jones_2_stokes >>> H = jones_vector(0, 0) >>> V = jones_vector(pi/2, 0) >>> D = jones_vector(pi/4, 0) >>> A = jones_vector(-pi/4, 0) >>> R = jones_vector(0, pi/4) >>> L = jones_vector(0, -pi/4) >>> pprint([jones_2_stokes(e) for e in [H, V, D, A, R, L]], ... use_unicode=True) ⎡⎡1⎤ ⎡1 ⎤ ⎡1⎤ ⎡1 ⎤ ⎡1⎤ ⎡1 ⎤⎤ ⎢⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥⎥ ⎢⎢1⎥ ⎢-1⎥ ⎢0⎥ ⎢0 ⎥ ⎢0⎥ ⎢0 ⎥⎥ ⎢⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥, ⎢ ⎥⎥ ⎢⎢0⎥ ⎢0 ⎥ ⎢1⎥ ⎢-1⎥ ⎢0⎥ ⎢0 ⎥⎥ ⎢⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥⎥ ⎣⎣0⎦ ⎣0 ⎦ ⎣0⎦ ⎣0 ⎦ ⎣1⎦ ⎣-1⎦⎦
- sympy.physics.optics.polarization.jones_vector(psi, chi)[源代码]#
一个Jones向量,对应于一个具有 \(psi\) 倾斜,以及 \(chi\) 圆形。
- 参数:
psi : numeric type or SymPy Symbol
极化相对于 \(x\) 轴。
chi : numeric type or SymPy Symbol
与偏振椭圆主轴线相邻的角。
- 返回:
Matrix :
琼斯矢量。
实例
庞加莱球体上的轴。
>>> from sympy import pprint, symbols, pi >>> from sympy.physics.optics.polarization import jones_vector >>> psi, chi = symbols("psi, chi", real=True)
A general Jones vector.
>>> pprint(jones_vector(psi, chi), use_unicode=True) ⎡-ⅈ⋅sin(χ)⋅sin(ψ) + cos(χ)⋅cos(ψ)⎤ ⎢ ⎥ ⎣ⅈ⋅sin(χ)⋅cos(ψ) + sin(ψ)⋅cos(χ) ⎦
Horizontal polarization.
>>> pprint(jones_vector(0, 0), use_unicode=True) ⎡1⎤ ⎢ ⎥ ⎣0⎦
Vertical polarization.
>>> pprint(jones_vector(pi/2, 0), use_unicode=True) ⎡0⎤ ⎢ ⎥ ⎣1⎦
Diagonal polarization.
>>> pprint(jones_vector(pi/4, 0), use_unicode=True) ⎡√2⎤ ⎢──⎥ ⎢2 ⎥ ⎢ ⎥ ⎢√2⎥ ⎢──⎥ ⎣2 ⎦
Anti-diagonal polarization.
>>> pprint(jones_vector(-pi/4, 0), use_unicode=True) ⎡ √2 ⎤ ⎢ ── ⎥ ⎢ 2 ⎥ ⎢ ⎥ ⎢-√2 ⎥ ⎢────⎥ ⎣ 2 ⎦
Right-hand circular polarization.
>>> pprint(jones_vector(0, pi/4), use_unicode=True) ⎡ √2 ⎤ ⎢ ── ⎥ ⎢ 2 ⎥ ⎢ ⎥ ⎢√2⋅ⅈ⎥ ⎢────⎥ ⎣ 2 ⎦
Left-hand circular polarization.
>>> pprint(jones_vector(0, -pi/4), use_unicode=True) ⎡ √2 ⎤ ⎢ ── ⎥ ⎢ 2 ⎥ ⎢ ⎥ ⎢-√2⋅ⅈ ⎥ ⎢──────⎥ ⎣ 2 ⎦
- sympy.physics.optics.polarization.linear_polarizer(theta=0)[源代码]#
A linear polarizer Jones matrix with transmission axis at an angle
theta
.- 参数:
theta : numeric type or SymPy Symbol
传输轴相对于水平面的角度。
- 返回:
SymPy Matrix
代表偏振器的琼斯矩阵。
实例
一种普通的偏光镜。
>>> from sympy import pprint, symbols >>> from sympy.physics.optics.polarization import linear_polarizer >>> theta = symbols("theta", real=True) >>> J = linear_polarizer(theta) >>> pprint(J, use_unicode=True) ⎡ 2 ⎤ ⎢ cos (θ) sin(θ)⋅cos(θ)⎥ ⎢ ⎥ ⎢ 2 ⎥ ⎣sin(θ)⋅cos(θ) sin (θ) ⎦
- sympy.physics.optics.polarization.mueller_matrix(J)[源代码]#
Jones矩阵对应的Mueller矩阵 \(J\) .
- 参数:
J : SymPy Matrix
琼斯矩阵。
- 返回:
SymPy Matrix
相应的Mueller矩阵。
实例
通用光学元件。
>>> from sympy import pprint, symbols >>> from sympy.physics.optics.polarization import (mueller_matrix, ... linear_polarizer, half_wave_retarder, quarter_wave_retarder) >>> theta = symbols("theta", real=True)
A linear_polarizer
>>> pprint(mueller_matrix(linear_polarizer(theta)), use_unicode=True) ⎡ cos(2⋅θ) sin(2⋅θ) ⎤ ⎢ 1/2 ──────── ──────── 0⎥ ⎢ 2 2 ⎥ ⎢ ⎥ ⎢cos(2⋅θ) cos(4⋅θ) 1 sin(4⋅θ) ⎥ ⎢──────── ──────── + ─ ──────── 0⎥ ⎢ 2 4 4 4 ⎥ ⎢ ⎥ ⎢sin(2⋅θ) sin(4⋅θ) 1 cos(4⋅θ) ⎥ ⎢──────── ──────── ─ - ──────── 0⎥ ⎢ 2 4 4 4 ⎥ ⎢ ⎥ ⎣ 0 0 0 0⎦
A half-wave plate
>>> pprint(mueller_matrix(half_wave_retarder(theta)), use_unicode=True) ⎡1 0 0 0 ⎤ ⎢ ⎥ ⎢ 4 2 ⎥ ⎢0 8⋅sin (θ) - 8⋅sin (θ) + 1 sin(4⋅θ) 0 ⎥ ⎢ ⎥ ⎢ 4 2 ⎥ ⎢0 sin(4⋅θ) - 8⋅sin (θ) + 8⋅sin (θ) - 1 0 ⎥ ⎢ ⎥ ⎣0 0 0 -1⎦
A quarter-wave plate
>>> pprint(mueller_matrix(quarter_wave_retarder(theta)), use_unicode=True) ⎡1 0 0 0 ⎤ ⎢ ⎥ ⎢ cos(4⋅θ) 1 sin(4⋅θ) ⎥ ⎢0 ──────── + ─ ──────── -sin(2⋅θ)⎥ ⎢ 2 2 2 ⎥ ⎢ ⎥ ⎢ sin(4⋅θ) 1 cos(4⋅θ) ⎥ ⎢0 ──────── ─ - ──────── cos(2⋅θ) ⎥ ⎢ 2 2 2 ⎥ ⎢ ⎥ ⎣0 sin(2⋅θ) -cos(2⋅θ) 0 ⎦
- sympy.physics.optics.polarization.phase_retarder(theta=0, delta=0)[源代码]#
A phase retarder Jones matrix with retardance
delta
at angletheta
.- 参数:
theta : numeric type or SymPy Symbol
快轴相对于水平面的角度。
delta : numeric type or SymPy Symbol
光速轴和快轴之间的相位差。
- 返回:
SymPy Matrix :
表示缓速器的琼斯矩阵。
实例
普通缓速器。
>>> from sympy import pprint, symbols >>> from sympy.physics.optics.polarization import phase_retarder >>> theta, delta = symbols("theta, delta", real=True) >>> R = phase_retarder(theta, delta) >>> pprint(R, use_unicode=True) ⎡ -ⅈ⋅δ -ⅈ⋅δ ⎤ ⎢ ───── ───── ⎥ ⎢⎛ ⅈ⋅δ 2 2 ⎞ 2 ⎛ ⅈ⋅δ⎞ 2 ⎥ ⎢⎝ℯ ⋅sin (θ) + cos (θ)⎠⋅ℯ ⎝1 - ℯ ⎠⋅ℯ ⋅sin(θ)⋅cos(θ)⎥ ⎢ ⎥ ⎢ -ⅈ⋅δ -ⅈ⋅δ ⎥ ⎢ ───── ─────⎥ ⎢⎛ ⅈ⋅δ⎞ 2 ⎛ ⅈ⋅δ 2 2 ⎞ 2 ⎥ ⎣⎝1 - ℯ ⎠⋅ℯ ⋅sin(θ)⋅cos(θ) ⎝ℯ ⋅cos (θ) + sin (θ)⎠⋅ℯ ⎦
- sympy.physics.optics.polarization.polarizing_beam_splitter(Tp=1, Rs=1, Ts=0, Rp=0, phia=0, phib=0)[源代码]#
角度偏振分束器琼斯矩阵 \(theta\) .
- 参数:
J : SymPy Matrix
琼斯矩阵。
Tp : numeric type or SymPy Symbol
P偏振分量的透过率。
Rs : numeric type or SymPy Symbol
S偏振分量的反射率。
Ts : numeric type or SymPy Symbol
S偏振分量的透过率。
Rp : numeric type or SymPy Symbol
P偏振分量的反射率。
phia : numeric type or SymPy Symbol
输出模式a的透射和反射分量之间的相位差。
phib : numeric type or SymPy Symbol
输出模式b的透射和反射分量之间的相位差。
- 返回:
SymPy Matrix
表示PBS的4x4矩阵。这个矩阵作用于一个4x1向量,它的前两个条目是其中一个PBS端口上的Jones向量,最后两个条目是另一个端口上的Jones向量。
实例
通用偏振分束器。
>>> from sympy import pprint, symbols >>> from sympy.physics.optics.polarization import polarizing_beam_splitter >>> Ts, Rs, Tp, Rp = symbols(r"Ts, Rs, Tp, Rp", positive=True) >>> phia, phib = symbols("phi_a, phi_b", real=True) >>> PBS = polarizing_beam_splitter(Tp, Rs, Ts, Rp, phia, phib) >>> pprint(PBS, use_unicode=False) [ ____ ____ ] [ \/ Tp 0 I*\/ Rp 0 ] [ ] [ ____ ____ I*phi_a] [ 0 \/ Ts 0 -I*\/ Rs *e ] [ ] [ ____ ____ ] [I*\/ Rp 0 \/ Tp 0 ] [ ] [ ____ I*phi_b ____ ] [ 0 -I*\/ Rs *e 0 \/ Ts ]
- sympy.physics.optics.polarization.quarter_wave_retarder(theta)[源代码]#
A quarter-wave retarder Jones matrix at angle
theta
.- 参数:
theta : numeric type or SymPy Symbol
快轴相对于水平面的角度。
- 返回:
SymPy Matrix
表示缓速器的琼斯矩阵。
实例
普通的四分之一波片。
>>> from sympy import pprint, symbols >>> from sympy.physics.optics.polarization import quarter_wave_retarder >>> theta= symbols("theta", real=True) >>> QWP = quarter_wave_retarder(theta) >>> pprint(QWP, use_unicode=True) ⎡ -ⅈ⋅π -ⅈ⋅π ⎤ ⎢ ───── ───── ⎥ ⎢⎛ 2 2 ⎞ 4 4 ⎥ ⎢⎝ⅈ⋅sin (θ) + cos (θ)⎠⋅ℯ (1 - ⅈ)⋅ℯ ⋅sin(θ)⋅cos(θ)⎥ ⎢ ⎥ ⎢ -ⅈ⋅π -ⅈ⋅π ⎥ ⎢ ───── ─────⎥ ⎢ 4 ⎛ 2 2 ⎞ 4 ⎥ ⎣(1 - ⅈ)⋅ℯ ⋅sin(θ)⋅cos(θ) ⎝sin (θ) + ⅈ⋅cos (θ)⎠⋅ℯ ⎦
- sympy.physics.optics.polarization.reflective_filter(R)[源代码]#
A reflective filter Jones matrix with reflectance
R
.- 参数:
R : numeric type or SymPy Symbol
滤光片的反射率。
- 返回:
SymPy Matrix
表示滤波器的琼斯矩阵。
实例
通用过滤器。
>>> from sympy import pprint, symbols >>> from sympy.physics.optics.polarization import reflective_filter >>> R = symbols("R", real=True) >>> pprint(reflective_filter(R), use_unicode=True) ⎡√R 0 ⎤ ⎢ ⎥ ⎣0 -√R⎦
- sympy.physics.optics.polarization.stokes_vector(psi, chi, p=1, I=1)[源代码]#
A Stokes vector corresponding to a polarization ellipse with
psi
tilt, andchi
circularity.- 参数:
psi : numeric type or SymPy Symbol
The tilt of the polarization relative to the
x
axis.chi : numeric type or SymPy Symbol
与偏振椭圆主轴线相邻的角。
p : numeric type or SymPy Symbol
极化的程度。
I : numeric type or SymPy Symbol
磁场的强度。
- 返回:
Matrix :
斯托克斯矢量。
实例
庞加莱球体上的轴。
>>> from sympy import pprint, symbols, pi >>> from sympy.physics.optics.polarization import stokes_vector >>> psi, chi, p, I = symbols("psi, chi, p, I", real=True) >>> pprint(stokes_vector(psi, chi, p, I), use_unicode=True) ⎡ I ⎤ ⎢ ⎥ ⎢I⋅p⋅cos(2⋅χ)⋅cos(2⋅ψ)⎥ ⎢ ⎥ ⎢I⋅p⋅sin(2⋅ψ)⋅cos(2⋅χ)⎥ ⎢ ⎥ ⎣ I⋅p⋅sin(2⋅χ) ⎦
Horizontal polarization
>>> pprint(stokes_vector(0, 0), use_unicode=True) ⎡1⎤ ⎢ ⎥ ⎢1⎥ ⎢ ⎥ ⎢0⎥ ⎢ ⎥ ⎣0⎦
Vertical polarization
>>> pprint(stokes_vector(pi/2, 0), use_unicode=True) ⎡1 ⎤ ⎢ ⎥ ⎢-1⎥ ⎢ ⎥ ⎢0 ⎥ ⎢ ⎥ ⎣0 ⎦
Diagonal polarization
>>> pprint(stokes_vector(pi/4, 0), use_unicode=True) ⎡1⎤ ⎢ ⎥ ⎢0⎥ ⎢ ⎥ ⎢1⎥ ⎢ ⎥ ⎣0⎦
Anti-diagonal polarization
>>> pprint(stokes_vector(-pi/4, 0), use_unicode=True) ⎡1 ⎤ ⎢ ⎥ ⎢0 ⎥ ⎢ ⎥ ⎢-1⎥ ⎢ ⎥ ⎣0 ⎦
Right-hand circular polarization
>>> pprint(stokes_vector(0, pi/4), use_unicode=True) ⎡1⎤ ⎢ ⎥ ⎢0⎥ ⎢ ⎥ ⎢0⎥ ⎢ ⎥ ⎣1⎦
Left-hand circular polarization
>>> pprint(stokes_vector(0, -pi/4), use_unicode=True) ⎡1 ⎤ ⎢ ⎥ ⎢0 ⎥ ⎢ ⎥ ⎢0 ⎥ ⎢ ⎥ ⎣-1⎦
Unpolarized light
>>> pprint(stokes_vector(0, 0, 0), use_unicode=True) ⎡1⎤ ⎢ ⎥ ⎢0⎥ ⎢ ⎥ ⎢0⎥ ⎢ ⎥ ⎣0⎦
- sympy.physics.optics.polarization.transmissive_filter(T)[源代码]#
An attenuator Jones matrix with transmittance
T
.- 参数:
T : numeric type or SymPy Symbol
衰减器的透射率。
- 返回:
SymPy Matrix
表示滤波器的琼斯矩阵。
实例
通用过滤器。
>>> from sympy import pprint, symbols >>> from sympy.physics.optics.polarization import transmissive_filter >>> T = symbols("T", real=True) >>> NDF = transmissive_filter(T) >>> pprint(NDF, use_unicode=True) ⎡√T 0 ⎤ ⎢ ⎥ ⎣0 √T⎦