Skip to content

Commit 8c1bafb

Browse files
committed
format
1 parent f7cae4e commit 8c1bafb

File tree

1 file changed

+31
-11
lines changed

1 file changed

+31
-11
lines changed

doc/architectural_decisions/005-variance-addition.md

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,37 @@ Current
66

77
## Context
88

9-
For counts data, the uncertainty on counts is typically defined by poisson counting statistics, i.e. the standard deviation on `N` counts is `sqrt(N)`.
9+
For counts data, the uncertainty on counts is typically defined by poisson counting statistics, i.e. the standard
10+
deviation on `N` counts is `sqrt(N)`.
1011

11-
This can be problematic in cases where zero counts have been collected, as the standard deviation will then be zero, which will subsequently lead to "infinite" point weightings in downstream fitting routines for example.
12+
This can be problematic in cases where zero counts have been collected, as the standard deviation will then be zero,
13+
which will subsequently lead to "infinite" point weightings in downstream fitting routines for example.
1214

1315
A number of possible approaches were considered:
1416

15-
| Option | Description |
16-
| --- | --- |
17-
| A | Reject data with zero counts, i.e. explicitly throw an exception if any data with zero counts is seen as part of a scan. |
18-
| B | Use a standard deviation of `NaN` for points with zero counts. |
19-
| C | Define the standard deviation of `N` counts as `1` if counts are zero, otherwise `sqrt(N)`. This is one of the approaches available in mantid for example. |
20-
| D | Define the standard deviation of `N` counts as `sqrt(N+0.5)` unconditionally - on the basis that "half a count" is smaller than the smallest possible actual measurement which can be taken. |
21-
| E | No special handling, calculate std. dev. as `sqrt(N)`. |
17+
### Option A
18+
19+
Reject data with zero counts, i.e. explicitly throw an exception if any data with zero counts is seen as part of a scan.
20+
21+
### Option B
22+
23+
Use a standard deviation of `NaN` for points with zero counts.
24+
25+
### Option C
26+
27+
Define the standard deviation of `N` counts as `1` if counts are zero, otherwise `sqrt(N)`. This is one of the
28+
approaches [available in mantid](https://github.com/mantidproject/mantid/blob/bbbb86edc2c3fa554499770463aa25c2b46984e5/docs/source/algorithms/SetUncertainties-v1.rst#L16) for example.
29+
30+
### Option D
31+
32+
Define the standard deviation of `N` counts as `sqrt(N+0.5)` unconditionally - on the basis that "half a count" is
33+
smaller than the smallest possible actual measurement which can be taken.
34+
35+
### Option E
36+
37+
No special handling, calculate std. dev. as `sqrt(N)`.
38+
39+
---
2240

2341
For clarity, the following table shows the value and associated uncertainty for each option:
2442

@@ -53,6 +71,8 @@ The consensus was to go with Option D.
5371
## Justification
5472

5573
- Option A will cause real-life scans to crash in low counts regions.
56-
- Option B involves `NaN`s, which have many surprising floating-point characteristics and are highly likely to be a source of future bugs.
74+
- Option B involves `NaN`s, which have many surprising floating-point characteristics and are highly likely to be a
75+
source of future bugs.
5776
- Option D was preferred to option C by scientists present, because it is continuous.
58-
- Option E causes surprising results and/or crashes downstream, for example fitting may consider points with zero uncertainty to have "infinite" weight, therefore effectively disregarding all other data.
77+
- Option E causes surprising results and/or crashes downstream, for example fitting may consider points with zero
78+
uncertainty to have "infinite" weight, therefore effectively disregarding all other data.

0 commit comments

Comments
 (0)