-
Notifications
You must be signed in to change notification settings - Fork 54
/
test_AiryBeam1D.py
44 lines (40 loc) · 1.08 KB
/
test_AiryBeam1D.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
"""
Test script for testing the AiryBeam1D command.
"""
from LightPipes import *
import matplotlib.pyplot as plt
import numpy as np
wavelength = 2.3*um
size = 30*mm
N = 500
N2=N//2
x0=0.3*mm
a=0.1/mm
dz=1.25*cm
NZ=200
F0=Begin(size,wavelength,N)
F0=AiryBeam1D(F0,x0=x0, a=a)
Ix=np.zeros(N)
for k in range(0,NZ):
F=Forvard(F0,dz*k)
I=Intensity(F)
Ix=np.vstack([Ix,I[N2]])
plt.figure(figsize = (12,5))
plt.imshow(Ix,
extent=[-size/2/mm, size/2/mm, 0, NZ*dz/cm],
aspect=0.08,
origin='lower',
cmap='jet',
)
plt.title('1D Airy beam')
plt.xlabel('x [mm]')
plt.ylabel('z [cm]')
s = r'LightPipes for Python' + '\n'+ '1D Airy beam' + '\n\n'\
r'$\lambda = {:4.2f}$'.format(wavelength/um) + r' ${\mu}m$' + '\n'\
r'$size = {:4.2f}$'.format(size/mm) + r' $mm$' + '\n'\
r'$N = {:4d}$'.format(N) + '\n'\
r'$x_0 = {:4.2f}$'.format(x0/mm) + r' $mm$' + '\n'\
r'$a = $' + '{:4.2f}'.format(a*mm) + r' $/mm$' + '\n'\
r'${\copyright}$ Fred van Goor, May 2022'
plt.text(16, 50, s, bbox={'facecolor': 'white', 'pad': 5})
plt.show()