-
Notifications
You must be signed in to change notification settings - Fork 0
/
diffraction_grating_pair.py
184 lines (125 loc) · 3.88 KB
/
diffraction_grating_pair.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
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
172
173
174
175
176
177
178
179
180
181
182
183
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 19 11:02:23 2016
@author: cpkmanchee
Notes:
Diffraction grating pair
"""
import numpy as np
import matplotlib.pyplot as plt
import sympy as sym
'''
Simulate grating pair
pulse = input pulse object
L = grating separation (m), use (-) L for stretcher, (+) L for compressor geometry
N = lns/mm of gratings
AOI = angle of incidence (deg)
theta = diffraction angle (assumed 1 order, as is standard)
d = groove spacing
EVERYTHING IS FOR 1st order
'''
#constants
h = 6.62606957E-34 #J*s
c = 299792458.0 #m/s
def gdd2len(GDD, N, AOI, lambda0):
m = 1
g = AOI*np.pi/180 #convert AOI into rad
d = 1E-3/N #gives grove spacing in m
w0 = 2*np.pi*c/lambda0
theta = np.arcsin(m*2*np.pi*c/(w0*d) - np.sin(g))
L = np.abs(GDD*(d**2*w0**3*np.cos(theta)**3)/(-m**2*2*4*(np.pi**2)*c))
L_real = L/np.cos(theta)
return L, L_real
def beta2(N, AOI, lambda0):
m = 1
g = AOI*np.pi/180 #convert AOI into rad
d = 1E-3/N #gives grove spacing in m
w0 = 2*np.pi*c/lambda0
theta = np.arcsin(m*2*np.pi*c/(w0*d) - np.sin(g))
beta2 = (-m**2*2*4*(np.pi**2)*c)/(d**2*w0**3*np.cos(theta)**3)
return beta2
def dispCoef(L, N, AOI, lambda0):
m = 1
g = AOI*np.pi/180 #convert AOI into rad
d = 1E-3/N #gives grove spacing in m
w0 = 2*np.pi*c/lambda0
theta = np.arcsin(m*2*np.pi*c/(w0*d) - np.sin(g))
phi0 = 2*L*w0*np.cos(theta)/c
phi1 = (phi0/w0)*(1+(2*np.pi*c*m*np.sin(theta)/(w0*d*np.cos(theta)**2)))
phi2 = (-m**2*2*4*(np.pi**2)*L*c/(d**2*w0**3))*(1/np.cos(theta)**3)
phi3 = (-3*phi2/w0)*(1+(2*np.pi*c*m*np.sin(theta)/(w0*d*np.cos(theta)**2)))
phi4 = ((2*phi3)**2/(3*phi2)) + phi2*(2*np.pi*c*m/(w0**2*d*np.cos(theta)**2))**2
return np.array([phi0,phi1,phi2,phi3,phi4])
def diffAngle(N, AOI, lambda0):
m = 1
g = AOI*np.pi/180 #convert AOI into rad
d = 1E-3/N #gives grove spacing in m
w0 = 2*np.pi*c/lambda0
theta = np.arcsin(m*2*np.pi*c/(w0*d) - np.sin(g))
return theta*180/np.pi
def transBeamSize(GDD, N, AOI, lambda0, dlambda):
L, L_real = gdd2len(GDD, N, AOI, lambda0)
dth = np.abs(diffAngle(N, AOI, lambda0 + dlambda/2) - diffAngle(N, AOI, lambda0-dlambda/2))
dxMax = 2*L_real*np.arctan(dth*np.pi/(2*180))
return dxMax
def litAngle(N, lambda0):
d = 1E-3/N
a = (180/np.pi)*np.arcsin(lambda0/(2*d))
return a
def symDisp(L, N, AOI, lambda0):
m = 1
g = AOI*np.pi/180 #convert AOI into rad
d = 1E-3/N #gives grove spacing in m
w0 = 2*np.pi*c/lambda0
#theta = np.arcsin(m*2*np.pi*c/(w0*d) - np.sin(g))
w = sym.symbols('w')
orders = 5
phi = np.zeros(orders)
phi0 = (2*L*w/c)*(1-(m*2*np.pi*c/(w*d) - sym.sin(g))**2)**(1/2)
for i in range(orders):
phi[i] = sym.diff(phi0,w,i).subs(w,w0)
return phi
aoi = np.linspace(35,90,50)
l0 = 1030E-9
dl = 40E-9
gdd = 37E-24
n = 1200
l,lr = gdd2len(gdd,n,aoi,l0)
x = transBeamSize(gdd,n,aoi,l0,dl)
da = diffAngle(n,aoi,l0)
xr = x/np.cos(da*np.pi/180)
plt.figure(0)
plt.plot(aoi,l,'--',aoi,lr,'-')
plt.figure(1)
plt.plot(aoi,x,'--',aoi,xr,'-')
plt.figure(2)
plt.plot(aoi,da,'-')
n = 1500
l,lr = gdd2len(gdd,n,aoi,l0)
x = transBeamSize(gdd,n,aoi,l0,dl)
da = diffAngle(n,aoi,l0)
xr = x/np.cos(da*np.pi/180)
plt.figure(0)
plt.plot(aoi,l,'--',aoi,lr,'-')
plt.figure(1)
plt.plot(aoi,x,'--',aoi,xr,'-')
plt.figure(2)
plt.plot(aoi,da,'-')
n = 1760
l,lr = gdd2len(gdd,n,aoi,l0)
x = transBeamSize(gdd,n,aoi,l0,dl)
da = diffAngle(n,aoi,l0)
xr = x/np.cos(da*np.pi/180)
plt.figure(0)
plt.plot(aoi,l,'--',aoi,lr,'-')
plt.figure(1)
plt.plot(aoi,x,'--',aoi,xr,'-')
plt.figure(2)
plt.plot(aoi,da,'-')
n=1500
alpha = np.abs(diffAngle(n,aoi,l0)-aoi)
l,lr = gdd2len(gdd,n,aoi,l0)
x_allowed = lr*np.sin(alpha*np.pi/180)/2
plt.figure(3)
plt.plot(aoi,x_allowed)
plt.show()