## 基本原理

#偏振光演示
import numpy as np
import matplotlib.pyplot as plt
def polarShow():
z = np.arange(0,5,0.01)      #传播方向，单位um
dWave = 0.6328
x1 = z*0
y1 = np.cos(2*np.pi*z/dWave)#此光波偏振方向为y
x2 = np.cos(2*np.pi*z/dWave)#此光波偏振方向为y
y2 = z*0
ax = plt.subplot(projection='3d')
ax.plot3D(z,x1,y1)
ax.plot3D(z,x2,y2)
ax.plot3D(z,x1,y2)
plt.show()


## 椭圆偏振光

#两个存在相位差的线偏振光演示
def polarShow(dWave = 0.6328,delta=0.5):
z = np.arange(0,5,0.01)
x1 = z*0
y1 = np.cos(2*np.pi*z/dWave+delta)#此光波偏振方向为y

x2 = np.cos(2*np.pi*z/dWave)#此光波偏振方向为x
y2 = z*0

x3 = x1+x2
y3 = y1+y2

ax = plt.subplot(projection='3d')
ax.plot3D(z,x1,y1)
ax.plot3D(z,x2,y2)
ax.plot3D(z,x3,y3)
ax.plot3D(z,x1,y2)
plt.show()


#偏振光演示
def polarShow(dWave = 0.6328):
z = np.arange(0,5,0.01)
x = np.cos(2*np.pi*z/dWave) #x偏振光
delta = [0, 1/6, 1/4, 1/3, 1/2, 2/3, 3/4, 5/6, 1]
ths = [d*np.pi for d in delta]
titles = [f"{

int(180*d)}°" for d in delta]
for i in range(9):
#子图绘制，表示3×3的布局中的第(1+i)个图
ax =plt.subplot(3, 3, 1+i)
ax.set_title(titles[i])
y = np.cos(2*np.pi*z/dWave+ths[i])#此光波偏振方向为y
ax.plot(x,y)
plt.xticks([])
plt.yticks([])  #去掉坐标轴