| 1 |
+++ |
| 2 |
title = "Ditto, realistic instrument" |
| 3 |
weight = 11 |
| 4 |
+++ |
| 5 |
|
| 6 |
### Polarized specular reflectometry with non-perfect polarizer and analyzer |
| 7 |
|
| 8 |
In this example, we show how to perform a specular reflectometry simulation with polarized neutrons and |
| 9 |
both a non-perfect polarizer as well as analyzer. |
| 10 |
The example is inspired by and performed with parameters close to the ones in [the paper by Devishvili et al.](https://doi.org/10.1063/1.4790717). |
| 11 |
This example is a saturated iron film on top of a MgO substrate. |
| 12 |
On top of the iron layer is a thin Pd cap layer. |
| 13 |
|
| 14 |
|
| 15 |
We don't explain the whole script in detail here, it combines all concepts that were introduced before |
| 16 |
in the polarized reflectometry section. |
| 17 |
Instrument resolution is simulated as explained in the |
| 18 |
[ToF - Resolution effects example](/ref/instr/scan/tof-resolution). |
| 19 |
Furthermore, a constant background is added: |
| 20 |
|
| 21 |
```python |
| 22 |
simulation.setBackground( ba.ConstantBackground( 1e-7 ) ) |
| 23 |
``` |
| 24 |
|
| 25 |
For a more detailed explanation we refer to the example on |
| 26 |
[adding a constant background](/ref/sim/setup/bg). |
| 27 |
|
| 28 |
The values for the efficiency of the polarizer and analyzer are taken from the above mentioned paper by |
| 29 |
[Devishvili et al.](https://doi.org/10.1063/1.4790717): |
| 30 |
|
| 31 |
```python |
| 32 |
polarizer_efficiency = 0.986 |
| 33 |
analyzer_efficiency = 0.970 |
| 34 |
``` |
| 35 |
|
| 36 |
These values are used to initialize the polarizer and analyzer: |
| 37 |
|
| 38 |
```python |
| 39 |
simulation.setBeamPolarization(polarization * polarizer_efficiency) |
| 40 |
simulation.setAnalyzerProperties(analyzer, analyzer_efficiency, 0.5) |
| 41 |
``` |
| 42 |
|
| 43 |
This setup is then utilized to simulate the four reflectivity channels |
| 44 |
|
| 45 |
```python |
| 46 |
results_pp = run_simulation(polarization = R3(0, 1, 0), |
| 47 |
analyzer = R3(0, 1, 0), |
| 48 |
polarizer_efficiency = polarizer_efficiency, |
| 49 |
analyzer_efficiency = analyzer_efficiency ) |
| 50 |
results_mm = run_simulation(polarization = R3(0, -1, 0), |
| 51 |
analyzer = R3(0, -1, 0), |
| 52 |
polarizer_efficiency = polarizer_efficiency, |
| 53 |
analyzer_efficiency = analyzer_efficiency ) |
| 54 |
|
| 55 |
results_pm = run_simulation(polarization = R3(0, 1, 0), |
| 56 |
analyzer = R3(0, -1, 0), |
| 57 |
polarizer_efficiency = polarizer_efficiency, |
| 58 |
analyzer_efficiency = analyzer_efficiency ) |
| 59 |
results_mp = run_simulation(polarization = R3(0, -1, 0), |
| 60 |
analyzer = R3(0, 1, 0), |
| 61 |
polarizer_efficiency = polarizer_efficiency, |
| 62 |
analyzer_efficiency = analyzer_efficiency ) |
| 63 |
``` |
| 64 |
|
| 65 |
The computed reflectivity looks like this: |
| 66 |
|
| 67 |
{{< galleryscg >}} |
| 68 |
{{< figscg src="/img/auto/specular/MagneticLayerImperfect.png" width="650px" caption="Reflectivity">}} |
| 69 |
{{< /galleryscg >}} |
| 70 |
|
| 71 |
Due to the different values for the polarizer and analyzer efficiency, we obtain |
| 72 |
different reflectivity curves for the two spin-flip channels. |
| 73 |
As one can verify, these results are in good agreement with the measurement as well as the |
| 74 |
simulations presented by [Devishvili et al.](https://doi.org/10.1063/1.4790717) |
| 75 |
|
| 76 |
|
| 77 |
Here is the complete example: |
| 78 |
|
| 79 |
{{< show-ex file="specular/MagneticLayerImperfect.py" >}} |