Debian Codegraph @

hugo/content/ref/instr/beam/divergence/index.md

raw
1 +++
2 title = "Beam divergence"
3 weight = 50
4 +++
5
6 ## Beam divergence
7
8 By default, the incident beam is perfectly monochromatic and collimated.
9 Here we show how to set finite distributions of wavelengths and of grazing angles.
10
11 * The wavelength follows a log-normal distribution around the mean value of 0.1 nm with a scale parameter equal to $0.1$.
12 * Both incident angles follow a Gaussian distribution around the average values $\alpha\_i = 0.2 ^{\circ}$ and $\varphi\_i = 0^{\circ}$, respectively and $\sigma_{\alpha\_i} = \sigma\_{\varphi\_i} = 0.1^{\circ}$.
13
14 First, the [distributions](/ref/other/distributions) should be defined:
15
16 ```python
17 distr_lambda = ba.DistributionLogNormal(0.1*nm, 0.1, 5, 2)
18 distr_alpha = ba.DistributionGaussian(0.2*deg, 0.1*deg, 5, 2)
19 distr_phi = ba.DistributionGaussian(0, 0.1*deg, 5, 2)
20 ```
21
22 Then the distributions are to be applied to the `simulation` object in the following way:
23
24 ```python
25 simulation = ba.ScatteringSimulation(...)
26 simulation.addParameterDistribution(role, distribution)
27 ```
28
29 The `role` is a special object itself, indicating which parameter is distributed.
30 There are three roles:
31
32 ```python
33 role_wavelength = ba.ParameterDistribution.BeamWavelength
34 role_grazing_angle = ba.ParameterDistribution.BeamGrazingAngle
35 role_azimuthal_angle = ba.ParameterDistribution.BeamAzimuthalAngle
36 ```
37
38 Distributions are passed to the `simulation` together with their `role`:
39
40 ```python
41 simulation.addParameterDistribution(role_wavelength, distr_lambda)
42 simulation.addParameterDistribution(role_grazing_angle, distr_alpha)
43 simulation.addParameterDistribution(role_azimuthal_angle, distr_phi)
44 ```
45
46 #### Example
47
48 The DWBA simulation example is shown for a standard sample model:
49
50 * The sample is composed of monodisperse cylinders deposited on a substrate.
51 * The cylinders are dilute and distributed at random,
52 hence there is no interference between scattered waves.
53
54 {{< galleryscg >}}
55 {{< figscg src="/img/draw/BeamDivergence_setup.jpg" width="350px" caption="Real-space model">}}
56 {{< figscg src="/img/auto/scatter2d/BeamDivergence.png" width="350px" caption="Scattering intensity">}}
57 {{< /galleryscg >}}
58
59 {{< show-ex file="scatter2d/BeamDivergence.py" >}}