| 1 |
+++ |
| 2 |
title = "Simultaneous fit of two datasets" |
| 3 |
weight = 40 |
| 4 |
+++ |
| 5 |
|
| 6 |
## Simultaneous fit of two datasets |
| 7 |
|
| 8 |
In this example we demonstrate how to fit two datasets simultaneously. |
| 9 |
|
| 10 |
Suppose that we have a sample measured twice for two different incident angles. We are going to fit both datasets simultaneously to find the unknown sample parameters. |
| 11 |
|
| 12 |
To do this, we define one dataset (a pair of real data and corresponding simulation builder) for the first incidence angle and another pair for the second incidence angle. We add both pairs to the `FitObjective` and run the fit as usual. |
| 13 |
|
| 14 |
In the given script we simulate a dilute random assembly of hemi-ellipsoids on a substrate. |
| 15 |
The particle form factor has 3 parameters: `radius_a` and `height` are parameters to find, `radius_b` is fixed. |
| 16 |
|
| 17 |
The custom `PlotObserver` class plots the fit for the two datasets every 10th iteration. |
| 18 |
|
| 19 |
{{< galleryscg >}} |
| 20 |
{{< figscg src="/img/draw/multiple_datasets.png" width="600px" caption="Fit window">}} |
| 21 |
{{< /galleryscg >}} |
| 22 |
|
| 23 |
{{< show-ex file="fit/scatter2d/multiple_datasets.py" >}} |