Instrument definition comparison

Result

Instrument definition comparison result

Sample

Instrument definition comparison sample

Python script

 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# dependencies = ["bornagain>=25,<26"]
# ///
"""
Specular reflectometry of a Ti/Ni multilayer with a non-unit beam
intensity factor. Demonstrates that angle-scan and Q-scan yield
consistent results when the same intensity factor is applied.

10 bilayers of Ti (3 nm) and Ni (7 nm) on a Si substrate.
"""
import numpy as np
from math import pi, sin
import bornagain as ba
ba.require_versions("bornagain>=25,<26")
from bornagain import angstrom, deg, nm


INTENSITY = 1.05


def get_sample():
    vacuum = ba.Vacuum()
    si_color = (0.28, 0.57, 0.82)
    si_mat = ba.SLDMaterial("Si_substrate", si_color, 2.0704e-6, 2.3726e-11)
    ni_color = (0.93, 0.48, 0.14)
    ni_mat = ba.SLDMaterial("Ni", ni_color, 9.4245e-6, 1.1423e-9)
    ti_color = (0.05, 0.62, 0.55)
    ti_mat = ba.SLDMaterial("Ti", ti_color, -1.9493e-6, 9.6013e-10)

    stack = ba.LayerStack(10)
    stack.addLayer(ba.Layer(ti_mat, 3*nm))
    stack.addLayer(ba.Layer(ni_mat, 7*nm))

    sample = ba.Sample()
    sample.addLayer(ba.Layer(vacuum))
    sample.addStack(stack)
    sample.addLayer(ba.Layer(si_mat))
    return sample


def simulate(sample):
    n = 500
    lam = 1.54*angstrom

    scan_a = ba.AlphaScan(n, 5*deg/n, 5*deg)
    scan_a.setWavelength(lam)
    scan_a.setIntensity(INTENSITY)
    result_a = ba.SpecularSimulation(scan_a, sample).simulate()
    result_a.setTitle("angle scan")

    qs = [4*pi*sin(a)/lam
          for a in np.linspace(5*deg/n, 5*deg, n)]
    scan_q = ba.QzScan(qs)
    scan_q.setIntensity(INTENSITY)
    result_q = ba.SpecularSimulation(scan_q, sample).simulate()
    result_q.setTitle("Q scan")

    return [result_a, result_q]


if __name__ == '__main__':
    sample = get_sample()
    ba.showSample3D(sample, sample_size=120*nm, seed=0)
    results = simulate(sample)
    ba.plot_multicurve(results)
    ba.plt.show()
auto/Examples/specular/instrument/InstrumentDefinitionComparison.py