| 1 |
+++ |
| 2 |
title = "GISAS" |
| 3 |
weight = 10 |
| 4 |
+++ |
| 5 |
|
| 6 |
## GISAS simulation example |
| 7 |
|
| 8 |
In the following introductory example, |
| 9 |
we take a standard sample model from module |
| 10 |
[bornagain.std_samples]({{% url-src %}}/Wrap/Python/std_samples.py), |
| 11 |
a dilute random assembly of monodisperse cylindrical disks on a substrate. |
| 12 |
|
| 13 |
{{< galleryscg >}} |
| 14 |
{{< figscg src="/img/draw/CylindersInDWBA_setup.jpg" width="350px" caption="Real-space model">}} |
| 15 |
{{< figscg src="/img/auto/scatter2d/Cylinders.png" width="350px" caption="Scattering intensity">}} |
| 16 |
{{< /galleryscg >}} |
| 17 |
|
| 18 |
{{< show-ex file="scatter2d/Cylinders.py" >}} |
| 19 |
<p> |
| 20 |
|
| 21 |
### Explanation |
| 22 |
|
| 23 |
#### Function get_simulation |
| 24 |
|
| 25 |
The simulation of type [ScatteringSimulation](../) |
| 26 |
is defined by beam, sample, and detector. |
| 27 |
|
| 28 |
The incoming beam is defined by the constructor `Beam` with arguments intensity, |
| 29 |
wavelength, and glancing angle. |
| 30 |
|
| 31 |
To define the wavelength, we use the unit multiplier `nm`. |
| 32 |
As it happens, the internal unit for microscopic lengths in BornAgain is one nanometer; |
| 33 |
therefore the constant `nm` is just `1`, and `*nm` could be omitted from the code, |
| 34 |
but we recommend to leave it for the benefit of human readers. |
| 35 |
|
| 36 |
The spherical detector has nPix=200 bins for both coordinate axis. |
| 37 |
The azimuthal angle $\varphi\_\text{f}$ extends from $-2^\circ$ to $+2^\circ$; |
| 38 |
the glancing angle $\alpha\_\text{f}$ from $0^\circ$ to $3^\circ$. |
| 39 |
|
| 40 |
#### Main program |
| 41 |
|
| 42 |
The last stance in the script is the main program. |
| 43 |
|
| 44 |
The function `parse_args` digests command-line arguments; in particular, |
| 45 |
a command-line argument like `sim_n=100` can be used to overwrite the |
| 46 |
default pixel size (which is retrieved by `bp.simargs['n']` in function |
| 47 |
`get_simulation`. |
| 48 |
|
| 49 |
The function call `simulation.simulate()` runs the simulation and returns |
| 50 |
a [Datafield](/ref/data/datafield) object. |
| 51 |
|
| 52 |
|
| 53 |
### Further reading |
| 54 |
|
| 55 |
* [GISAS with specular reflection](/ref/sim/setup/options/specular) |
| 56 |
* [GISAS without DWBA terms](born-approximation), |
| 57 |
with a single sample layer so that the DWBA boils down to the ordinary Born approximation. |