Skip to content
Snippets Groups Projects
Commit 0301536d authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

split off py/ex for examples; correct structure

parent 6fe99982
No related branches found
No related tags found
1 merge request!1479Webdoc: start decoupling tutorial (with examples) from reference
Showing
with 41 additions and 8 deletions
+++
title = "Examples"
weight = 5
+++
## Commented Python script examples
{{% children %}}
\ No newline at end of file
......@@ -9,7 +9,7 @@ This example shows scattering
from a monolayer that contains a dilute random assembly
of monodisperse cylindrical disks.
This is the same system as in our [basic GISAS example]({{% ref-py "sim/gisas" %}})
This is the same system as in our [basic GISAS example]({{% ref-py "ex/gisas" %}})
except that there is no substrate.
In consequence, there are no reflections,
and therefore the DWBA boils down to the ordinary Born approximation.
......
......@@ -10,7 +10,7 @@ This example demonstrates fitting of 2D GISAS data.
## Faked experimental data
The sample and instrument model is basically the same as
in our [basic GISAS simulation example]({{% ref-py "sim/gisas" %}}),
in our [basic GISAS simulation example]({{% ref-py "ex/gisas" %}}),
except that it depends on four external parameters:
beam intensity, detector background, radius and height of the cylindrical nanoparticles.
......@@ -44,7 +44,7 @@ and terminates with the following result:
### Explanation
The function `get_sample` is basically the same as
in our [basic GISAS simulation example]({{% ref-py "sim/gisas" %}}),
in our [basic GISAS simulation example]({{% ref-py "ex/gisas" %}}),
except that radius and height of the cylindrical disks are now
supplied as external parameters.
These parameters are passed through the function argument `params`
......
......@@ -13,7 +13,7 @@ Here we show how to set a finite blur.
* The incident angles are $\sigma_{\alpha\_i} = \sigma\_{\varphi\_i} = 0.1^{\circ}$.
Besides this, the example is a DWBA simulation for our standard sample model,
[Cylinders in DWBA]({{% ref-py "sim/gisas" %}})
[Cylinders in DWBA]({{% ref-py "ex/gisas" %}})
* The sample is composed of monodisperse cylinders deposited on a substrate.
* The cylinders are dilute, and positioned at random,
......
......@@ -8,7 +8,7 @@ weight = 20
In this example we demonstrate how to plot intensity data with detector axes expressed in different units. It serves as a supporting example to the
[Accessing simulation results]({{% ref-py "export/_index.md" %}}) tutorial.
* The standard [Cylinders in DWBA]({{%ref-py "sim/gisas" %}}))
* The standard [Cylinders in DWBA]({{%ref-py "ex/gisas" %}}))
sample is used to setup the simulation.
* When the simulation is completed, the `Simulation::result()` method is used to get a `SimulationResult` object.
* Depending on an additional parameter `IDetector2D.NBINS`, `IDetector2D.DEGREES`, `IDetector2D.QYQZ`, it will be plotted with axes defined either in millimeters (default units of `RectangularDetector`), detector bins, degrees or in $Q$-space.
......
......@@ -8,7 +8,7 @@ weight = 10
This is an extended example for the further treatment of simulation results: accessing the results, plotting, cropping, slicing and exporting. This serves as a supporting example to the [Accessing simulation results
]({{% ref-py "export/_index.md" %}}) tutorial.
* The standard [Cylinders in DWBA]({{%ref-py "sim/gisas" %}}) sample
* The standard [Cylinders in DWBA]({{%ref-py "ex/gisas" %}}) sample
is used for running the simulation.
* The simulation results are retrieved as a `Histogram2D` object and then processed in various functions to achieve a resulting image.
......
......@@ -9,7 +9,7 @@ To set up and run a BornAgain simulation, one needs to create an instance of
a simulation class. This class contains information about the scattering
target ("sample") and about the simulated instrument (beam or scan, detector).
#### Simulation cclasses
#### Simulation classes
The following simulation classes are available:
......
+++
title = "Simulation classes"
weight = 0
weight = 10
+++
## Simulation classes
......
+++
title = "Scattering"
weight = 20
+++
## Scattering simulation
To set up and run a scattering simulation, use
```python
import bornagain as ba
beam = ...
sample = ...
detector = ...
simulation = ba.ScatteringSimulation(beam, sample, detector)
# ... set options
result = simulation.simulate()
```
For the constructor arguments, see sections [beam]({{% ref-py "instr/beam" %}})
[sample]({{% ref-py "sample" %}}), and [detector](/py/instr/det).
For optional settings, see [simulation options]({{% ref-py "sim/setup/options" %}}).
For the return type of function `simulate()`,
see [SimulationResult]({{% ref-py "result/simulation-result" %}}).
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment