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
|
#!/usr/bin/env python3
"""
Basic example of depth-probe simulation:
Computes intensity as function of incident angle alpha and depth z.
"""
import bornagain as ba
from bornagain import ba_plot as bp, deg, nm
import matplotlib.pyplot as plt
def get_sample():
# Materials
material_vac = ba.RefractiveMaterial("Vacuum", 0, 0)
material_A = ba.RefractiveMaterial("A", 6e-5, 0)
material_sub = ba.RefractiveMaterial("Substrate", 3e-05, 0)
# Sample
sample = ba.Sample()
sample.addLayer(ba.Layer(material_vac))
sample.addLayer(ba.Layer(material_A, 100*nm))
sample.addLayer(ba.Layer(material_sub))
return sample
def get_simulation(sample, flags):
n = 500
scan = ba.AlphaScan(n, 0*deg, 1*deg)
scan.setWavelength(0.3*nm)
z_axis = ba.EquiDivision("z (nm)", n, -130*nm, 30*nm)
simulation = ba.DepthprobeSimulation(scan, sample, z_axis, flags)
return simulation
def run_example(flags=0):
bp.parse_args(aspect='auto', intensity_max=1e2, intensity_min=1e-12)
sample = get_sample()
simulation = get_simulation(sample, flags)
result = simulation.simulate()
bp.plot_simulation_result(result)
plt.show()
if __name__ == '__main__':
run_example()
|