Debian Codegraph @

hugo/content/ref/instr/scan/_index.md

raw
1 +++
2 title = "Scan"
3 weight = 20
4 +++
5
6 ## Scan models
7
8 Scans are needed to construct simulations of types
9 [reflectometry](/ref/sim/class/specular),
10 [off-specular scattering](/ref/sim/class/offspec),
11 [depth probe](/ref/sim/class/depthprobe).
12
13 There are three types of scan:
14 - Alpha scans, for instruments that are mechanically scanning
15 the grazing angle $\alpha\_\text{i}$;
16 - Lambda scans, for instruments that are scanning the wavelength $\lambda$;
17 - Qz scans, for both angular-scanning or time-of-flight instruments.
18
19
20 #### Common properties
21
22 All scan types have `intensity`:
23
24 ```python
25 scan.setIntensity(intensity)
26 ```
27
28 [Polarization and analyzer](/ref/instr/pol) can be assigned to the scan when needed
29 (for [specular](/ref/sim/class/specular) and [off-specular](/ref/sim/class/offspec) simulations).
30
31 ```python
32 scan.setPolarization(polarization) # for specular & off-specular
33 scan.setAnalyzer(analyzer) # for specular
34 ```
35
36
37 ### Alpha scans
38
39 To specify a scan with `n` equidistant points in the grazing angle $\alpha\_\text{i}$, use
40 ```python
41 scan = ba.AlphaScan(n, alpha_start, alpha_stop)
42 ```
43
44 Usage is demonstrated by most examples in
45 {{% ref-ex "specular" %}}.
46
47 For other sequences of $\alpha\_\text{i}$ values, use the more generic
48 ```python
49 alpha_list = ba.ListScan("alpha_i (rad)", [0*deg, 0.01*deg, ... 1.2*deg]) # all points
50 scan = ba.AlphaScan(alpha_list)
51 ```
52
53 After constructing a scan, set the wavelength and optionally the azimuthal angle and a constant offset
54 $\delta\alpha\_\text{i}$ using
55 ```python
56 scan.setWavelength(lambda)
57 scan.setAzimuthalAngle(phi)
58
59 scan.setAlphaOffset(dalpha)
60 ```
61
62 `alpha`, `lambda`, `phi` may also have [distributions](/ref/other/distributions), then create them and assign to the scan:
63
64 ```python
65 scan.setWavelengthDistribution(lambda_distr)
66 scan.setGrazingAngleDistribution(alpha_distr)
67 scan.setAzimuthalAngleDistribution(phi_distr)
68 ```
69
70 [Footprint](/ref/instr/beam/footprint) can be assigned to the alpha scan
71 (for [specular](/ref/sim/class/specular) and [off-specular](/ref/sim/class/offspec) simulations).
72
73 ```python
74 scan.setFootprint(footprint) # for specular & off-specular
75 ```
76
77 ### Lambda scans
78
79 To specify a scan with `n` equidistant points in the neutron/X-ray wavelength $\lambda$, use
80 ```python
81 scan = ba.LambdaScan(n, lambda_start, lambda_stop)
82 ```
83
84 To specify a scan with any other sequence of $\lambda$ values, use
85 ```python
86 lambda_list = ba.ListScan("lambda (nm)", [0.6*nm, 0.61*nm, ... 0.7*nm]) # all points
87 scan = ba.LambdaScan(lambda_list)
88 ```
89
90 After constructing a scan, set the grazing angle and optionally the azimuthal angle using
91 ```python
92 scan.setGrazingAngle(alpha)
93 scan.setAzimuthalAngle(phi)
94 ```
95
96 `alpha`, `lambda`, `phi` may also have [distributions](/ref/other/distributions), then create them and assign to the scan:
97
98 ```python
99 scan.setWavelengthDistribution(lambda_distr)
100 scan.setGrazingAngleDistribution(alpha_distr)
101 scan.setAzimuthalAngleDistribution(phi_distr)
102 ```
103
104 [Footprint](/ref/instr/beam/footprint) can be assigned to the lambda scan
105 (for [specular](/ref/sim/class/specular) and [off-specular](/ref/sim/class/offspec) simulations).
106
107 ```python
108 scan.setFootprint(footprint) # for specular & off-specular
109 ```
110
111 Usage in off-specular scattering is demonstrated by
112 {{% ref-ex "offspec/OffspecLambda.py" %}}.
113
114 See also the example page [off-specular simulation](/ref/sim/class/offspec/ex).
115
116 ### Qz scans
117
118 To specify a scan with `n` equidistant steps in the vertical wavenumber $q_z$, use
119 ```python
120 scan = ba.QzScan(n, qz_start, qz_stop)
121 ```
122
123 For other sequences of $q_z$ values, use the more generic
124 ```python
125 qz_list = ba.ListScan("q_z (1/nm)", [0.01/nm, 0.02/nm, ... 1.2/nm]) # all points
126 scan = ba.QzScan(qz_list)
127 ```
128
129 A third alternative consists in passing a NumPy array,
130 ```python
131 import numpy as np
132 qz_vector = np.linspace(0.01, 1, n)
133 scan = ba.QzScan(qz_vector)
134 ```
135
136 After constructing a scan, a constant offset $\delta q_z$ can be set using
137
138 ```python
139 scan.setOffset(dqz)
140 ```
141
142 To specify q-resolution one needs at first create corresponding [distribution](/ref/other/distributions) `distr`
143 but then there are three ways to specify a q-resolution.
144
145 1. Set absolute value of resolution, given in units of `1/nm`:
146 ```python
147 scan.setAbsoluteQResolution(distr, dq)
148 ```
149
150 2. Set relative value of resolution, given as fraction of $q_z$ value at each point of scan:
151 ```python
152 scan.setRelativeQResolution(distr, dq_rel)
153 ```
154
155 3. Set individual absolute value of resolution, given as vector of the same length `n`:
156 ```python
157 dq_vector = 0.03*np.linspace(0.01, 1, n) # dq-values in "1/nm"
158 scan.setVectorResolution(distr, dq_vector)
159 ```
160
161 As Qz scan does not contain full information about simulation geometry, it is _incompatible_ with footprint.
162
163 `alpha`, `lambda`, `phi` and thair distributions cannot be set.
164
165 Usage is demonstrated in page [time-of-flight reflectometry](tof).
166
167 Handling of resolution will change soon.
168 The current API is demonstrated in page
169 [time-of-flight reflectometry with resolution](tof-resolution).