Skip to content

Commit 7ded7c9

Browse files
committed
fixup
1 parent 065467b commit 7ded7c9

File tree

1 file changed

+32
-27
lines changed

1 file changed

+32
-27
lines changed

docs/user-guide/data-reduction.md

+32-27
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ To avoid overcomplicating the description it is assumed that the sample- and ref
1818
The sample reflectivity is related to the intensity of neutron counts in the detector by the model
1919

2020
$$
21-
I_{sam}(\lambda, j) = F(\theta(\lambda, j, \mu_{sam}), w_{sam}) \cdot R(Q(\lambda, \theta(\lambda, j, \mu_{sam}))) \cdot I_{ideal}(\lambda, j)
21+
I_{\text{sam}}(\lambda, j) = F(\theta(\lambda, j, \mu_{\text{sam}}), w_{\text{sam}}) \cdot R(Q(\lambda, \theta(\lambda, j, \mu_{\text{sam}}))) \cdot I_{\text{ideal}}(\lambda, j)
2222
$$ (model)
23-
where $I_{sam}(\lambda, j)$ represents the number of neutrons detected in the $j$ pixel of the detector having a wavelength in the interval $[\lambda, \lambda + d\lambda]$. $I_{ideal}$ represents the number of neutrons that would have been detected if the sample was a perfect reflector and large enough so that the footprint of the focused beam on the sample was small compared to the sample. $F(\theta, w)$ is the fraction of the focused beam that hits the sample. It depends on the incidence angle $\theta$ and on the size of the sample represented by $w$. $\mu_{sam}$ is the sample rotation.
23+
where $I_{\text{sam}}(\lambda, j)$ represents the number of neutrons detected in the $j$ pixel of the detector per unit of wavelength at the wavelength value $\lambda$. $I_{\text{ideal}}$ represents the number of neutrons that would have been detected if the sample was a perfect reflector and large enough so that the footprint of the focused beam on the sample was small compared to the sample. $F(\theta, w)$ is the fraction of the focused beam that hits the sample. It depends on the incidence angle $\theta$ and on the size of the sample represented by $w$. $\mu_{\text{sam}}$ is the sample rotation.
2424
2525
The ideal intensity is estimated from a reference measurement on a neutron supermirror.
2626
How it is computed will be described later, for now assume it exists.
@@ -29,31 +29,31 @@ How it is computed will be described later, for now assume it exists.
2929
Move $F$ to the left-hand-side of equation {eq}`model` and integrate over all $\lambda$ and $j$ contributing to one particular $Q$-bin $[q_{i}, q_{i+1}]$
3030
3131
$$
32-
\int_{Q(\lambda, \theta(\lambda, j, \mu_{sam})) \in [q_{i}, q_{i+1}]} \frac{I_{sam}(\lambda, j)}{F(\theta(\lambda, j, \mu_{sam}), w_{sam})} d\lambda \ dj = \\
33-
\int_{Q(\lambda, \theta(\lambda, j, \mu_{sam})) \in [q_{i}, q_{i+1}]} I_{ideal}(\lambda, j) R(Q(\lambda, \theta(\lambda, j, \mu_{sam}))) d\lambda \ dj.
32+
\int_{Q(\lambda, \theta(\lambda, j, \mu_{\text{sam}})) \in [q_{i}, q_{i+1}]} \frac{I_{\text{sam}}(\lambda, j)}{F(\theta(\lambda, j, \mu_{\text{sam}}), w_{\text{sam}})} d\lambda \ dj = \\
33+
\int_{Q(\lambda, \theta(\lambda, j, \mu_{\text{sam}})) \in [q_{i}, q_{i+1}]} I_{\text{ideal}}(\lambda, j) R(Q(\lambda, \theta(\lambda, j, \mu_{\text{sam}}))) d\lambda \ dj.
3434
$$
3535
Notice that if the $Q$ binning is sufficiently fine then $R(Q)$ is approximately constant in the integration region.
3636
Assuming the binning is fine enough $R(Q)$ can be moved outside the integral and isolated so that
3737
3838
$$
39-
R(Q_{i+\frac{1}{2}}) \approx \frac{\int_{Q(\lambda, j, \mu_{sam}) \in [q_{i}, q_{i+1}]} \frac{I_{sam}(\lambda, j)}{F(\theta(\lambda, j, \mu_{sam}), w_{sam})} d\lambda \ dj }{\int_{Q(\lambda, \theta(\lambda, j, \mu_{sam})) \in [q_{i}, q_{i+1}]} I_{ideal}(\lambda, j) d\lambda \ dj} := \frac{I_{measured}(Q_{i+\frac{1}{2}})}{I_{ideal}(Q_{i+\frac{1}{2}})}
39+
R(Q_{i+\frac{1}{2}}) \approx \frac{\int_{Q(\lambda, j, \mu_{\text{sam}}) \in [q_{i}, q_{i+1}]} \frac{I_{\text{sam}}(\lambda, j)}{F(\theta(\lambda, j, \mu_{\text{sam}}), w_{\text{sam}})} d\lambda \ dj }{\int_{Q(\lambda, \theta(\lambda, j, \mu_{\text{sam}})) \in [q_{i}, q_{i+1}]} I_{\text{ideal}}(\lambda, j) d\lambda \ dj} =: \frac{I_{measured}(Q_{i+\frac{1}{2}})}{I_{\text{ideal}}(Q_{i+\frac{1}{2}})}
4040
$$
4141
for $Q_{i+\frac{1}{2}} \in [q_{i}, q_{i+1}]$.
4242
4343
44-
## The reference intensity $I_{ideal}$
45-
$I_{ideal}$ is estimated from a reference measurement on a neutron supermirror with known reflectivity curve.
44+
## The reference intensity $I_{\text{ideal}}$
45+
$I_{\text{ideal}}$ is estimated from a reference measurement on a neutron supermirror with known reflectivity curve.
4646
The reference measurement intensity is modeled the same way the sample measurement was
4747
4848
$$
49-
I_{ref}(\lambda, j) = F(\theta(\lambda, j, \mu_{ref}), w_{ref}) \cdot R_{supermirror}(Q(\lambda, \theta(\lambda, j, \mu_{ref}))) \cdot I_{ideal}(\lambda, j)
49+
I_{\text{ref}}(\lambda, j) = F(\theta(\lambda, j, \mu_{\text{ref}}), w_{\text{ref}}) \cdot R_{\text{supermirror}}(Q(\lambda, \theta(\lambda, j, \mu_{\text{ref}}))) \cdot I_{\text{ideal}}(\lambda, j)
5050
$$
51-
but in this case $R_{supermirror}(Q)$ is known.
51+
but in this case $R_{\text{supermirror}}(Q)$ is known.
5252
53-
This leads to
53+
Using the definition in the previous section, this leads to
5454
5555
$$
56-
I_{ideal}(Q_{i+\frac{1}{2}}) = \int_{Q(\lambda, \theta(\lambda, j, \mu_{sam})) \in [q_{i}, q_{i+1}]} \frac{I_{ref}(\lambda, j)}{F(\theta(\lambda, j, \mu_{ref}), w_{ref}) R_{supermirror}(Q(\lambda, \theta(\lambda, j, \mu_{ref})))}
56+
I_{\text{ideal}}(Q_{i+\frac{1}{2}}) = \int_{Q(\lambda, \theta(\lambda, j, \mu_{\text{sam}})) \in [q_{i}, q_{i+1}]} \frac{I_{\text{ref}}(\lambda, j)}{F(\theta(\lambda, j, \mu_{\text{ref}}), w_{\text{ref}}) R_{\text{supermirror}}(Q(\lambda, \theta(\lambda, j, \mu_{\text{ref}})))}
5757
d\lambda \ dj.
5858
$$
5959
@@ -63,23 +63,23 @@ This implies that the intensity integrals are equal to the expected number of ne
6363
The expected number of counts can be estimated by the empirically observed count:
6464
6565
$$
66-
I_{measured}(Q_{i+\frac{1}{2}}) = \int_{Q(\lambda, \theta(\lambda, j, \mu_{sam})) \in [q_{i}, q_{i+1}]} \frac{I_{sam}(\lambda, j)}{F(\theta(\lambda, j, \mu_{sam}), w_{sam})} d\lambda \ dj = \\
67-
E\bigg[ \sum_{\substack{k \in EV_{sam} \\ Q(\lambda_{k}, \theta(\lambda_{k}, j_{k}, \mu_{sam})) \in [q_{i}, q_{i+1}]}} \frac{1}{F(\theta(\lambda_{k}, j_{k}, \mu_{sam}), w_{sam})} \bigg] \approx
68-
\sum_{\substack{k \in EV_{sam} \\ Q(\lambda_{k}, \theta(\lambda_{k}, j_{k}, \mu_{sam})) \in [q_{i}, q_{i+1}]}} \frac{1}{F(\theta(\lambda_{k}, j_{k}, \mu_{sam}), w_{sam})}
66+
I_{measured}(Q_{i+\frac{1}{2}}) = \int_{Q(\lambda, \theta(\lambda, j, \mu_{\text{sam}})) \in [q_{i}, q_{i+1}]} \frac{I_{\text{sam}}(\lambda, j)}{F(\theta(\lambda, j, \mu_{\text{sam}}), w_{\text{sam}})} d\lambda \ dj = \\
67+
E\bigg[ \sum_{\substack{k \in EV_{\text{sam}} \\ Q(\lambda_{k}, \theta(\lambda_{k}, j_{k}, \mu_{\text{sam}})) \in [q_{i}, q_{i+1}]}} \frac{1}{F(\theta(\lambda_{k}, j_{k}, \mu_{\text{sam}}), w_{\text{sam}})} \bigg] \approx
68+
\sum_{\substack{k \in EV_{\text{sam}} \\ Q(\lambda_{k}, \theta(\lambda_{k}, j_{k}, \mu_{\text{sam}})) \in [q_{i}, q_{i+1}]}} \frac{1}{F(\theta(\lambda_{k}, j_{k}, \mu_{\text{sam}}), w_{\text{sam}})}
6969
$$
70-
where $EV_{sam}$ refers to the event list from the sample experiment.
70+
where $EV_{\text{sam}}$ refers to the event list from the sample experiment.
7171
7272
We also know that the variance of the counts is the same as the expected count, so it can also be estimated as the empirically observed count:
7373
7474
$$
75-
V\bigg[ \sum_{\substack{k \in EV_{sam} \\ Q(\lambda_{k}, \theta(\lambda_{k}, j_{k}, \mu_{sam})) \in [q_{i}, q_{i+1}]}} \frac{1}{F(\theta(\lambda_{k}, j_{k}, \mu_{sam}), w_{sam})} \bigg] \approx
76-
\sum_{\substack{k \in EV_{sam} \\ Q(\lambda_{k}, \theta(\lambda_{k}, j_{k}, \mu_{sam})) \in [q_{i}, q_{i+1}]}} \frac{1}{F(\theta(\lambda_{k}, j_{k}, \mu_{sam}), w_{sam})}.
75+
V\bigg[ \sum_{\substack{k \in EV_{\text{sam}} \\ Q(\lambda_{k}, \theta(\lambda_{k}, j_{k}, \mu_{\text{sam}})) \in [q_{i}, q_{i+1}]}} \frac{1}{F(\theta(\lambda_{k}, j_{k}, \mu_{\text{sam}}), w_{\text{sam}})} \bigg] \approx
76+
\sum_{\substack{k \in EV_{\text{sam}} \\ Q(\lambda_{k}, \theta(\lambda_{k}, j_{k}, \mu_{\text{sam}})) \in [q_{i}, q_{i+1}]}} \frac{1}{F(\theta(\lambda_{k}, j_{k}, \mu_{\text{sam}}), w_{\text{sam}})}.
7777
$$
7878
7979
The same estimates are used to approximate the ideal intensity:
8080
8181
$$
82-
I_{ideal}(Q_{i+\frac{1}{2}}) \approx \sum_{\substack{k \in EV_{ref} \\ Q(\lambda_{k}, \theta(\lambda_{k}, j_{k}, \mu_{sam})) \in [q_{i}, q_{i+1}]}} \frac{1}{F(\theta(\lambda_{k}, j_{k}, \mu_{ref}), w_{ref}) R_{supermirror}(Q(\lambda_{k}, \theta(\lambda_{k}, j_{k}, \mu_{ref})))}
82+
I_{\text{ideal}}(Q_{i+\frac{1}{2}}) \approx \sum_{\substack{k \in EV_{\text{ref}} \\ Q(\lambda_{k}, \theta(\lambda_{k}, j_{k}, \mu_{\text{sam}})) \in [q_{i}, q_{i+1}]}} \frac{1}{F(\theta(\lambda_{k}, j_{k}, \mu_{\text{ref}}), w_{\text{ref}}) R_{\text{supermirror}}(Q(\lambda_{k}, \theta(\lambda_{k}, j_{k}, \mu_{\text{ref}})))}
8383
$$
8484
8585
### More efficient evaluation of the reference intensity
@@ -88,16 +88,16 @@ The above expression for the reference intensity is cumbersome to compute becaus
8888
Therefore we back up a bit. Consider the expression for the reference intensity, replacing the integrand with a generic $I(\lambda, j)$ it looks something like:
8989
9090
$$
91-
I_{ideal}(Q_{i+\frac{1}{2}}) = \int_{Q(\lambda, \theta(\lambda, j, \mu_{sam})) \in [q_{i}, q_{i+1}]} I(\lambda, j) \ d\lambda \ dj.
91+
I_{\text{ideal}}(Q_{i+\frac{1}{2}}) = \int_{Q(\lambda, \theta(\lambda, j, \mu_{\text{sam}})) \in [q_{i}, q_{i+1}]} I(\lambda, j) \ d\lambda \ dj.
9292
$$
9393
9494
In the previous section we approximated the integral by summing over all events in the reference measurement.
9595
9696
Alternatively, we could define a $\lambda$ grid with edges $\lambda_{k}$ for $k=1\ldots N$ and approximate the integration region as the union of a subset of the grid cells:
9797
9898
$$
99-
\int_{Q(\lambda, \theta(\lambda, j, \mu_{sam})) \in [q_{i}, q_{i+1}]} I(\lambda, j) \ d\lambda \ dj
100-
\approx \sum_{Q(\bar{\lambda}_{k+\frac{1}{2}},\ \theta(\bar{\lambda}_{k+\frac{1}{2}}, j, \mu_{sam})) \in [q_{i}, q_{i+1}]} I_{k+\frac{1}{2},j}
99+
\int_{Q(\lambda, \theta(\lambda, j, \mu_{\text{sam}})) \in [q_{i}, q_{i+1}]} I(\lambda, j) \ d\lambda \ dj
100+
\approx \sum_{Q(\bar{\lambda}_{k+\frac{1}{2}},\ \theta(\bar{\lambda}_{k+\frac{1}{2}}, j, \mu_{\text{sam}})) \in [q_{i}, q_{i+1}]} I_{k+\frac{1}{2},j}
101101
$$
102102
where
103103
@@ -106,25 +106,30 @@ I_{k+\frac{1}{2},j} = \int_{\lambda \in [\lambda_{k}, \lambda_{k+1}]} I(\lambda,
106106
$$
107107
and $\bar{\lambda}_{k+\frac{1}{2}} = (\lambda_{k} + \lambda_{k+1}) / 2$.
108108
109-
Why would this be more efficient than the original approach? Note that $I_{k+\frac{1}{2}, j}$ does not depend on $\mu_{sam}$, and that it can be computed once and reused for all sample measurements.
110-
This allows us to save computing time for each new sample measurement, as long as $|EV_{ref}| >> NM$ where $M$ is the number of detector pixels and $N$ is the size of the $\lambda$ grid.
109+
Why would this be more efficient than the original approach? Note that $I_{k+\frac{1}{2}, j}$ does not depend on $\mu_{\text{sam}}$, and that it can be computed once and reused for all sample measurements.
110+
This allows us to save computing time for each new sample measurement, as long as $|EV_{\text{ref}}| >> NM$ where $M$ is the number of detector pixels and $N$ is the size of the $\lambda$ grid.
111111
112112
However, ideally computing the reference intensity should be quick compared to reducing the sample measurement. And since a reasonable value for $N$ is approximately $500$, and $M\approx 30000$, and a sample measurement is likely less than $10$ million events, the cost of computing the reference measurement is still considerable compared to reducing the sample measurement.
113113
114114
Therefore there's one more approximation that is used to further reduce the cost of computing the reference intensity.
115+
The description of the final approximation is instrument specific.
116+
In the next section it is described specifically for the Amor instrument.
117+
118+
119+
### Evaluating the reference intensity for the Amor instrument
115120
116121
The Amor detector has three logical dimensions, `blade`, `wire` and `stripe`. It happens to be the case that $\theta(\lambda, j)$ is almost the same for all $j$ belonging to the same `stripe` of the detector.
117122
We can express this as
118123
119124
$$
120-
\theta(\lambda, j, \mu_{sam}) \approx \bar{\theta}(\lambda, \mathrm{bladewire}(j), \mu_{sam})
125+
\theta(\lambda, j, \mu_{\text{sam}}) \approx \bar{\theta}(\lambda, \mathrm{bladewire}(j), \mu_{\text{sam}})
121126
$$
122127
where $\bar{\theta}$ is an approximation for $\theta$ that only depends on the blade and the wire of the pixel where the neutron was detected.
123128
Then the above expression for the reference intensity can be rewritten as
124129
125130
$$
126-
\int_{Q(\lambda, \bar{\theta}(\lambda, z, \mu_{sam})) \in [q_{i}, q_{i+1}]} \int_{\mathrm{bladewire}(j) = z} I(\lambda, j) \ dj \ d\lambda \ dz
127-
\approx \sum_{Q(\bar{\lambda}_{k+\frac{1}{2}}, \bar{\theta}(\bar{\lambda}_{k+\frac{1}{2}}, z, \mu_{sam})) \in [q_{i}, q_{i+1}]} I_{k+\frac{1}{2},z}
131+
\int_{Q(\lambda, \bar{\theta}(\lambda, z, \mu_{\text{sam}})) \in [q_{i}, q_{i+1}]} \int_{\mathrm{bladewire}(j) = z} I(\lambda, j) \ dj \ d\lambda \ dz
132+
\approx \sum_{Q(\bar{\lambda}_{k+\frac{1}{2}}, \bar{\theta}(\bar{\lambda}_{k+\frac{1}{2}}, z, \mu_{\text{sam}})) \in [q_{i}, q_{i+1}]} I_{k+\frac{1}{2},z}
128133
$$
129134
where
130135
@@ -136,6 +141,6 @@ Like before, the benefit of doing this is that
136141
$$
137142
\int_{\lambda \in [\lambda_{k}, \lambda_{k+1}]} \int_{\mathrm{bladewire}(j) = z} I(\lambda, j) \ dj \ d\lambda
138143
$$
139-
can be pre-computed because it doesn't depend on $\mu_{sam}$.
144+
can be pre-computed because it doesn't depend on $\mu_{\text{sam}}$.
140145
But unlike before $I_{k+\frac{1}{2},z}$ now has a much more manageable size, about 64x smaller than the first attempt.
141146
This makes it comfortably smaller than the sample measurement.

0 commit comments

Comments
 (0)