Just print the transmission

In this example, the DepthProbe simulation is performed for one single incident angle and one single observation point in the substrate, which has no absorption, and where wave propagation is classically allowed (no evanescence). Therefore the simulated intensity is just the transmission of the sample.

The script prints a single number,

0.2697579887648236
 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
#!/usr/bin/env python3
"""
Print transmission of a multilayer,
using a flattened depth-probe simulation.
"""

import bornagain as ba
from bornagain import deg, nm

depth = 100 * nm

def get_sample():
    material_vac = ba.Vacuum()
    material_A = ba.RefractiveMaterial("A", 6e-5, 0)
    material_sub = ba.RefractiveMaterial("Substrate", 3e-05, 0)

    sample = ba.Sample()
    sample.addLayer(ba.Layer(material_vac))
    sample.addLayer(ba.Layer(material_A, depth))
    sample.addLayer(ba.Layer(material_sub))

    return sample

def simulate():
    alpha = 0.64 * deg
    scan = ba.AlphaScan(1, alpha, alpha)
    scan.setWavelength(0.3*nm)

    z_axis = ba.EquiDivision("z (nm)", 1, -depth, -depth)
    simulation = ba.DepthprobeSimulation(scan, get_sample(), z_axis, 0)

    result = simulation.simulate().flat()
    assert result.size() == 1
    return result.valAt(0)

if __name__ == '__main__':
    print(simulate())
auto/Examples/varia/Transmission.py