Depth-probe simulation tutorial

Depth-probe simulation is an auxiliary simulation type, which helps to visualize the total intensity in dependence on the beam incidence angle and the position in the sample.

Example

We consider a neutron resonator, composed of one Ti/Pt bilayer.

The beam comes from the Si side. By convention the beam always comes ‘‘from above’’. Accordingly, we consider Si the ‘‘ambient’’ material, placed ‘‘on top’’ of the sample.

As a result, we obtain the neutron intensity as function of depth and incident angle $\alpha_i$.

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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/env python3
"""
Basic example of depth-probe simulation with BornAgain.

Sample layers are Si | Ti | Pt | Ti | TiO2 | D2O.
Beam comes from Si side.
Therefore we model the stack with Si on top.
The z axis points from D2O to Si; z=0 is at the Si/Ti interface.
"""
import bornagain as ba
from bornagain import angstrom, ba_plot as bp, deg, nm

# layer thicknesses in angstroms
t_Ti = 130*angstrom
t_Pt = 320*angstrom
t_Ti_top = 100*angstrom
t_TiO2 = 30*angstrom

#  beam data
ai_min = 0  # minimum incident angle
ai_max = 1*deg  # maximum incident angle
beam_sample_ratio = 0.01  # beam-to-sample size ratio
wl = 10*angstrom  # wavelength in angstroms

# convolution parameters
d_ang = 0.01*ba.deg  # spread width for incident angle
n_points = 25  # number of points to convolve over
n_sig = 3  # number of sigmas to convolve over

#  depth position span
z_min = -100*nm
z_max = 100*nm


def get_sample():
    """
    Constructs a sample with one resonating Ti/Pt layer
    """

    # Define materials
    material_D2O = ba.RefractiveMaterial("D2O", 0.00010116, 1.809e-12)
    material_Pt = ba.RefractiveMaterial("Pt", 0.00010117, 3.01822e-08)
    material_Si = ba.RefractiveMaterial("Si", 3.3009e-05, 0)
    material_Ti = ba.RefractiveMaterial("Ti", -3.0637e-05, 1.5278e-08)
    material_TiO2 = ba.RefractiveMaterial("TiO2", 4.1921e-05, 8.1293e-09)

    # Define layers
    layer_1 = ba.Layer(material_Si)
    layer_2 = ba.Layer(material_Ti, 13*nm)
    layer_3 = ba.Layer(material_Pt, 32*nm)
    layer_4 = ba.Layer(material_Ti, 10*nm)
    layer_5 = ba.Layer(material_TiO2, 3*nm)
    layer_6 = ba.Layer(material_D2O)

    # Define sample
    sample = ba.MultiLayer()
    sample.addLayer(layer_1)
    sample.addLayer(layer_2)
    sample.addLayer(layer_3)
    sample.addLayer(layer_4)
    sample.addLayer(layer_5)
    sample.addLayer(layer_6)

    return sample


def get_simulation(sample):
    """
    Returns a depth-probe simulation.
    """
    nz = bp.simargs['n']
    na = 10*nz
    alpha_distr = ba.DistributionGaussian(0, d_ang)
    footprint = ba.FootprintSquare(beam_sample_ratio)

    simulation = ba.DepthProbeSimulation(sample)
    simulation.setBeamParameters(wl, na, ai_min, ai_max, footprint)
    simulation.setZSpan(nz, z_min, z_max)
    simulation.addParameterDistribution(
        ba.ParameterDistribution.BeamInclinationAngle, alpha_distr,
        n_points, n_sig)
    return simulation


if __name__ == '__main__':
    bp.parse_args(sim_n=500, aspect='auto')
    sample = get_sample()
    simulation = get_simulation(sample)
    result = simulation.simulate()
    bp.plot_simulation_result(result)
Examples/varia/DepthProbe.py