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

flatten ex/fit

parent 2bdd793a
No related branches found
No related tags found
1 merge request!1746webdoc: reorganize fit directories
Pipeline #104304 passed
Showing
with 27 additions and 62 deletions
......@@ -5,21 +5,14 @@ weight = 100
## Fitting
In fitting, we estimate the optimum parameters in a numerical model,
specifically a scattering simulation,
by minimizing the difference between simulated and reference data.
For an introduction, see [Python tutorial > Fitting](/py/fit).
BornAgain supports
+ a variety of minimization algorithms;
+ choice of fitting parameters, their properties and correlations;
+ full control over objective function calculations, including the use of different normalizations and assignments of different masks and weights to different areas of the reference data;
+ possibility to fit simultaneously an arbitrary number of data sets.
For an informal API documentation, see [Reference > Fitting](/ref/fit).
In the following we will show how to fit using the BornAgain Python API.
For fitting through the graphical user interface, see [GUI > Fitting](/gui/gui-fitting).
For most examples,
The following examples refer to experimental or synthetic data
in directory {{% ref-src "testdata" %}}.
To make these data findable,
the environment variable `BA_DATA_DIR` must point
to the copy of directory {{% ref-src "testdata" %}} in your local BornAgain installation.
to the copy of the `testdata/` directory in your local BornAgain installation.
{{% children depth="2" %}}
+++
title = "Advanced examples"
weight = 30
+++
### Advanced examples
{{% children %}}
+++
title = "Basic examples"
weight = 20
+++
### Basic examples
{{% children %}}
+++
title = "Extended examples"
weight = 40
+++
### Extended examples
{{% children %}}
+++
title = "Experiment at GALAXI"
weight = 30
+++
## Experiment at GALAXI
This is an example of a real data fit. We use our own measurements performed at the laboratory diffractometer [GALAXI](http://www.fz-juelich.de/jcns/jcns-2//DE/Leistungen/GALAXI/_node.html) in Forschungszentrum Jülich.
{{< galleryscg >}}
{{< figscg src="/img/draw/FitGALAXIData_setup.jpg" width="350px" caption="Real-space model">}}
{{< figscg src="/img/draw/FitGALAXIData.png" width="350px" caption="Fit window">}}
{{< /galleryscg >}}
* The sample represents a 4 layer system (substrate, teflon, hmdso and air) with Ag nanoparticles placed inside the hmdso layer on top of the teflon layer.
* The sample is generated with the help of a `SampleBuilder`, which is able to create samples depending on parameters defined in the constructor and passed through to the `create_sample` method.
* The nanoparticles have a broad log-normal size distribution.
* The rectangular detector is created to represent the PILATUS detector from the experiment (line 19).
* In the simulation settings the beam is initialized and the detector is assigned to the simulation. A region of interest is assigned at line 39 to simulate only a small rectangular window. Additionally, a rectangular mask is added to exclude the reflected beam from the analysis (line 40).
* The real data is loaded from a tiff file into a histogram representing the detector's channels.
* The `run_fitting()` function contains the initialization of the fitting kernel: loading experimental data, assignment of fit pair, fit parameters selection (line 62).
{{< show-ex file="fit/scatter2d/expfit_galaxi.py" >}}
+++
title = "Experiment description"
weight = 37
title = "Experiment at GALAXI"
weight = 30
+++
## Experiment at GALAXI
This is an example of a real data fit. We use our own measurements performed at the laboratory diffractometer [GALAXI](http://www.fz-juelich.de/jcns/jcns-2//DE/Leistungen/GALAXI/_node.html) in Forschungszentrum Jülich.
{{< galleryscg >}}
{{< figscg src="/img/draw/FitGALAXIData_setup.jpg" width="350px" caption="Real-space model">}}
{{< figscg src="/img/draw/FitGALAXIData.png" width="350px" caption="Fit window">}}
{{< /galleryscg >}}
* The sample represents a 4 layer system (substrate, teflon, hmdso and air) with Ag nanoparticles placed inside the hmdso layer on top of the teflon layer.
* The sample is generated with the help of a `SampleBuilder`, which is able to create samples depending on parameters defined in the constructor and passed through to the `create_sample` method.
* The nanoparticles have a broad log-normal size distribution.
* The rectangular detector is created to represent the PILATUS detector from the experiment (line 19).
* In the simulation settings the beam is initialized and the detector is assigned to the simulation. A region of interest is assigned at line 39 to simulate only a small rectangular window. Additionally, a rectangular mask is added to exclude the reflected beam from the analysis (line 40).
* The real data is loaded from a tiff file into a histogram representing the detector's channels.
* The `run_fitting()` function contains the initialization of the fitting kernel: loading experimental data, assignment of fit pair, fit parameters selection (line 62).
{{< show-ex file="fit/scatter2d/expfit_galaxi.py" >}}
## Experiment description
To successfully simulate and fit results of some real experiment it is important to have
......
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