-
Notifications
You must be signed in to change notification settings - Fork 0
/
Polarimeter_def.py
47 lines (24 loc) · 1.13 KB
/
Polarimeter_def.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#from errno import EINPROGRESS
from ftplib import parse150
import numpy as np
import math
def propagate(opl,Ein=np.array([[1],[0]])):
pp1 = np.array([[np.exp(1j*opl),0],[0,np.exp(1j*opl)]]);
Eout1 = np.dot(pp1,Ein)
return Eout1
def faradayrotaor(theta1, Ein=np.array([[1],[0]])):
FR1 = np.array([[math.cos(theta1*math.pi/180),math.sin(theta1*math.pi/180)],[-1*math.sin(theta1*math.pi/180),math.cos(theta1*math.pi/180)]]);
Eout2 = np.dot(FR1,Ein)
return Eout2
def waveplate(phase,theta1,Ein=np.array([[1],[0]])):
WP1 = np.array([[math.cos(theta1*math.pi/180),math.sin(theta1*math.pi/180)],[-1*math.sin(theta1*math.pi/180),math.cos(theta1*math.pi/180)]]);
WP2 = np.array([[np.exp(1j*0), 0],[0, np.exp(1j*phase*math.pi/180)]]);
WP3 = np.array([[math.cos(-1*theta1*math.pi/180),math.sin(-1*theta1*math.pi/180)],[-1*math.sin(-1*theta1*math.pi/180),math.cos(-1*theta1*math.pi/180)]]);
Eout1 = np.dot(WP1,Ein)
Eout2 = np.dot(WP2,Eout1)
Eout3 = np.dot(WP3,Eout2)
return Eout3
def reflect(Ein=np.array([[1],[0]])):
R1 = np.array([[-1,0],[0,1]]);
Eout4 = np.dot(R1, Ein)
return Eout4