forked from xhaju/gaussian-beam-propagator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_propagation.py
70 lines (51 loc) · 1.91 KB
/
example_propagation.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
import matplotlib as plt
import scipy as sp
from lens_system_design import *
##################################################
#Definitions
lambd=780.24e-9
pi=sp.pi
#We look for a Rayleigh range (which will be bigger than the waist in our wavelength) of less than 5 um
zR0=5e-6
#Therefore, the waist we are looking for is
w_0=sp.sqrt(zR0*lambd/pi)
#The maximum magnification we can get from a lens of focal f of a beam with rayleigh range zR is
f=32e-3
Mmax=1/sp.sqrt(denominator(f,f,zR0))
#if the waist is located at a distance d_in=f from the lens.
#That corresponds to a waist
w_1=w_0*Mmax
zR1=rayleigh_range(w_1,lambd)
#If we propagate that beam a length L forwards, the beam waist will be
L=50e-2
w_1prop=propagated_waist(w_1,L,zR1,0)
print 'Rayleigh Range: ',zR0
print 'Final waist: ',w_0
print 'Maximum magnification for a lens with focal {0:.2e}: {1:.2e}. This, in turn, will give an initial waist of {2:.3e}'.format(f,Mmax,w_1)
print 'If that waist is located at a distance {0:.2e} from the minimum waist, the *new* waist will be {1:.3e}.'.format(L,w_1prop)
##############################
#Try object BeamSection
##############################
print 'Now trying object BeamSection'
myBeam=BeamSection(780.24e-9,1.1e-6,0)
myBeam2=myBeam.transformByLens(32e-3,32e-3)
myBeam3=myBeam2.transformByLens(32e-3,96e-3)
#These should give the same initial and final waists, but at different positions
myBeam.report()
myBeam2.report()
myBeam3.report()
z=sp.arange(-10e-6,150e-3,1e-4)
#z=sp.arange(-10e-6,100e-6,1e-6)
plt.plot(z,myBeam.waist(z),label='first')
plt.plot(z,myBeam2.waist(z),label='second')
plt.plot(z,myBeam3.waist(z),label='third')
plt.legend()
##############################
# Try object BeamPropagation
##############################
lenses=sp.array([[32e-3,32e-3,32e-3,32e-3],[32e-3,96e-3,160e-3,224e-3]])
params=[7.8024e-7, 1.1e-6, 0]
prop=BeamPropagation(params,lenses)
prop.plotFull()
prop.plotFull(0,0.036)
plt.show()