File: TransmissionVsDepth.py

package info (click to toggle)
bornagain 23.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 103,948 kB
  • sloc: cpp: 423,131; python: 40,997; javascript: 11,167; awk: 630; sh: 318; ruby: 173; xml: 130; makefile: 51; ansic: 24
file content (40 lines) | stat: -rwxr-xr-x 1,167 bytes parent folder | download
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
#!/usr/bin/env python3
"""
Flattened depth-probe simulation:
Intensity as function of depth z for a few incident angles alpha_i.
"""

import bornagain as ba
from bornagain import ba_plot as bp, deg, nm


def get_sample():
    material_vac = ba.RefractiveMaterial("Vacuum", 0, 0)
    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, 100*nm))
    sample.addLayer(ba.Layer(material_sub))

    return sample

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

    z_axis = ba.EquiDivision("z (nm)", 20, -130*nm, 30*nm)
    simulation = ba.DepthprobeSimulation(scan, sample, z_axis, 0)

    result = simulation.simulate().flat()
    result.setTitle(f'{alpha_i_deg} deg')
    return result

if __name__ == '__main__':
    sample = get_sample()
    angles = [0.4, 0.5, 0.6, 0.65, 0.7]
    results = [simulate(sample, ai) for ai in angles]
    from bornagain import ba_check
    ba_check.persistence_test(result)