Skip to content

Commit 44f551d

Browse files
Merge pull request #272 from scipp/domain-type-rename
Add C.6 guideline for domain type naming convention
2 parents af78c8e + 839aea0 commit 44f551d

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

docs/user-guide/reduction-workflow-guidelines.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,69 @@ workflow.visualize(Result)
146146
workflow.compute(Result)
147147
```
148148

149+
### C.6: Domain types for data products
150+
151+
Data types that flow through the reduction workflow should follow a systematic naming convention that reflects their processing stage and coordinate space. This ensures consistency across instruments and techniques, making workflows more transferable and easier to understand.
152+
153+
**Type structure**
154+
155+
Domain types use a **prefix-suffix** pattern:
156+
- **Prefix**: Describes the processing stage (e.g., `Raw`, `Tof`, `Corrected`, `Normalized`)
157+
- **Suffix**: Describes the coordinate space or component (e.g., `Monitor`, `Detector`, `Q`, `Dspacing`, `Energy`)
158+
159+
**Monitor types**
160+
161+
Monitors follow a linear progression through processing stages:
162+
163+
```
164+
EmptyMonitor # Geometry only, calibrated
165+
RawMonitor # With counts
166+
TofMonitor # Time-of-flight domain
167+
WavelengthMonitor # Wavelength domain (end of monitor chain)
168+
```
169+
170+
**Detector types**
171+
172+
Detectors progress through both processing stages and move from "detector space" (pixel space) to, e.g., Q-space:
173+
174+
```
175+
EmptyDetector # Geometry only, calibrated, pixel-masked
176+
RawDetector # With counts
177+
TofDetector # With added time-of-flight coord
178+
WavelengthDetector # With added wavelength coord
179+
CorrectedDetector # Corrections applied (masking, filtering, efficiency, Lorentz, absorption)
180+
CorrectedQ # Transformed to Q-space, pixels reduced
181+
NormalizedQ # Normalized (to monitor, proton charge)
182+
IntensityQ # Absolute intensity, e.g., normalized to vanadium
183+
```
184+
185+
Alternative domain-specific names to, e.g., `IntensityQ` such as `ReflectivityQ` are also valid.
186+
187+
**Coordinate space variants**
188+
189+
The final coordinate space (`Q` in the example above) should be replaced with the appropriate space for the technique:
190+
- `Dspacing` for d-spacing coordinates
191+
- `EnergyTransfer` for energy transfer
192+
- `TwoTheta` for scattering angle
193+
- Multiple dimensions can be combined: `DspacingTwoTheta`
194+
195+
For example, a powder diffraction workflow might use:
196+
```
197+
CorrectedDetector → CorrectedDspacing → NormalizedDspacing → IntensityDspacing
198+
```
199+
200+
**Guidelines**
201+
202+
1. **Maintain the standard progression**: Keep processing stages separate unless there's a scientific reason to combine them (e.g., computational efficiency for a specific technique).
203+
204+
2. **Prefix carries forward**: When transforming coordinate spaces without additional processing, the prefix carries forward (e.g., `CorrectedDetector``CorrectedQ`).
205+
206+
3. **Skip only when appropriate**: Stages can be skipped if they don't exist for a particular technique, but avoid skipping for convenience alone.
207+
208+
4. **Be explicit about the space**: Always include the coordinate space or component in the suffix to make the data's nature clear.
209+
210+
5. **Consistency across instruments**: Use the same type names for equivalent processing stages across different instruments and techniques to facilitate knowledge transfer.
211+
149212
## D: Documentation
150213

151214
### D.1: Document math and references in docstrings

0 commit comments

Comments
 (0)