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
|
#!/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
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 = 50
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):
sample = get_sample()
simulation = get_simulation(sample, flags)
result = simulation.simulate()
from bornagain import ba_check
ba_check.persistence_test(result)
return
plotargs['aspect'] = 'auto'
plotargs['intensity_min'] = 1e-12
plotargs['intensity_max'] = 1e2
bp.plot_datafield(result, **plotargs)
if __name__ == '__main__':
run_example()
|