Skip to content

Commit 70a5a14

Browse files
authored
Merge pull request #271 from scipp/standard-domain-type-names
Change domain names to standard scheme
2 parents 44f551d + 8ac1b53 commit 70a5a14

File tree

13 files changed

+164
-239
lines changed

13 files changed

+164
-239
lines changed

docs/user-guide/tof/dream.ipynb

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"import plopp as pp\n",
2525
"import scipp as sc\n",
2626
"from scippneutron.chopper import DiskChopper\n",
27-
"from ess.reduce.nexus.types import AnyRun, DetectorData, SampleRun\n",
27+
"from ess.reduce.nexus.types import AnyRun, RawDetector, SampleRun\n",
2828
"from ess.reduce.time_of_flight import *"
2929
]
3030
},
@@ -300,10 +300,10 @@
300300
"source": [
301301
"wf = GenericTofWorkflow(run_types=[SampleRun], monitor_types=[])\n",
302302
"\n",
303-
"wf[DetectorData[SampleRun]] = raw_data\n",
303+
"wf[RawDetector[SampleRun]] = raw_data\n",
304304
"wf[DetectorLtotal[SampleRun]] = Ltotal\n",
305305
"\n",
306-
"wf.visualize(DetectorTofData[SampleRun])"
306+
"wf.visualize(TofDetector[SampleRun])"
307307
]
308308
},
309309
{
@@ -436,7 +436,6 @@
436436
]
437437
},
438438
{
439-
"attachments": {},
440439
"cell_type": "markdown",
441440
"id": "30",
442441
"metadata": {},
@@ -457,7 +456,7 @@
457456
"wf[TimeOfFlightLookupTable] = table\n",
458457
"\n",
459458
"# Compute time-of-flight of neutron events\n",
460-
"tofs = wf.compute(DetectorTofData[SampleRun])\n",
459+
"tofs = wf.compute(TofDetector[SampleRun])\n",
461460
"tofs"
462461
]
463462
},
@@ -616,11 +615,11 @@
616615
"outputs": [],
617616
"source": [
618617
"# Update workflow\n",
619-
"wf[DetectorData[SampleRun]] = raw_data\n",
618+
"wf[RawDetector[SampleRun]] = raw_data\n",
620619
"wf[DetectorLtotal[SampleRun]] = Ltotal\n",
621620
"\n",
622621
"# Compute tofs and wavelengths\n",
623-
"tofs = wf.compute(DetectorTofData[SampleRun])\n",
622+
"tofs = wf.compute(TofDetector[SampleRun])\n",
624623
"wav_wfm = tofs.transform_coords(\"wavelength\", graph=graph)\n",
625624
"\n",
626625
"# Compare in plot\n",
@@ -795,13 +794,13 @@
795794
"metadata": {},
796795
"outputs": [],
797796
"source": [
798-
"wf[DetectorData[SampleRun]] = ess_beamline.get_monitor(\"detector\")[0]\n",
797+
"wf[RawDetector[SampleRun]] = ess_beamline.get_monitor(\"detector\")[0]\n",
799798
"wf[DetectorLtotal[SampleRun]] = Ltotal\n",
800799
"\n",
801800
"wf[TimeOfFlightLookupTable] = table\n",
802801
"\n",
803802
"# Compute time-of-flight\n",
804-
"tofs = wf.compute(DetectorTofData[SampleRun])\n",
803+
"tofs = wf.compute(TofDetector[SampleRun])\n",
805804
"# Compute wavelength\n",
806805
"wav_wfm = tofs.transform_coords(\"wavelength\", graph=graph)\n",
807806
"\n",
@@ -823,17 +822,6 @@
823822
"display_name": "Python 3 (ipykernel)",
824823
"language": "python",
825824
"name": "python3"
826-
},
827-
"language_info": {
828-
"codemirror_mode": {
829-
"name": "ipython",
830-
"version": 3
831-
},
832-
"file_extension": ".py",
833-
"mimetype": "text/x-python",
834-
"name": "python",
835-
"nbconvert_exporter": "python",
836-
"pygments_lexer": "ipython3"
837825
}
838826
},
839827
"nbformat": 4,

docs/user-guide/tof/frame-unwrapping.ipynb

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"cells": [
33
{
4-
"attachments": {},
54
"cell_type": "markdown",
65
"id": "0",
76
"metadata": {},
@@ -32,7 +31,7 @@
3231
"import plopp as pp\n",
3332
"import scipp as sc\n",
3433
"from scippneutron.chopper import DiskChopper\n",
35-
"from ess.reduce.nexus.types import AnyRun, DetectorData, SampleRun\n",
34+
"from ess.reduce.nexus.types import AnyRun, RawDetector, SampleRun\n",
3635
"from ess.reduce.time_of_flight import *\n",
3736
"import tof\n",
3837
"\n",
@@ -161,10 +160,10 @@
161160
"source": [
162161
"wf = GenericTofWorkflow(run_types=[SampleRun], monitor_types=[])\n",
163162
"\n",
164-
"wf[DetectorData[SampleRun]] = nxevent_data\n",
163+
"wf[RawDetector[SampleRun]] = nxevent_data\n",
165164
"wf[DetectorLtotal[SampleRun]] = nxevent_data.coords[\"Ltotal\"]\n",
166165
"\n",
167-
"wf.visualize(DetectorTofData[SampleRun])"
166+
"wf.visualize(TofDetector[SampleRun])"
168167
]
169168
},
170169
{
@@ -271,7 +270,7 @@
271270
"wf[TimeOfFlightLookupTable] = table\n",
272271
"\n",
273272
"# Compute neutron tofs\n",
274-
"tofs = wf.compute(DetectorTofData[SampleRun])\n",
273+
"tofs = wf.compute(TofDetector[SampleRun])\n",
275274
"\n",
276275
"tof_hist = tofs.hist(tof=sc.scalar(500.0, unit=\"us\"))\n",
277276
"pp.plot({det.name: tof_hist[\"detector_number\", i] for i, det in enumerate(detectors)})"
@@ -456,11 +455,11 @@
456455
"# Reduction workflow\n",
457456
"wf = GenericTofWorkflow(run_types=[SampleRun], monitor_types=[])\n",
458457
"nxevent_data = results.to_nxevent_data()\n",
459-
"wf[DetectorData[SampleRun]] = nxevent_data\n",
458+
"wf[RawDetector[SampleRun]] = nxevent_data\n",
460459
"wf[DetectorLtotal[SampleRun]] = nxevent_data.coords[\"Ltotal\"]\n",
461460
"wf[TimeOfFlightLookupTable] = table\n",
462461
"\n",
463-
"tofs = wf.compute(DetectorTofData[SampleRun])\n",
462+
"tofs = wf.compute(TofDetector[SampleRun])\n",
464463
"\n",
465464
"tof_hist = tofs.hist(tof=sc.scalar(500.0, unit=\"us\"))\n",
466465
"pp.plot({det.name: tof_hist[\"detector_number\", i] for i, det in enumerate(detectors)})"
@@ -500,24 +499,7 @@
500499
]
501500
}
502501
],
503-
"metadata": {
504-
"kernelspec": {
505-
"display_name": "Python 3 (ipykernel)",
506-
"language": "python",
507-
"name": "python3"
508-
},
509-
"language_info": {
510-
"codemirror_mode": {
511-
"name": "ipython",
512-
"version": 3
513-
},
514-
"file_extension": ".py",
515-
"mimetype": "text/x-python",
516-
"name": "python",
517-
"nbconvert_exporter": "python",
518-
"pygments_lexer": "ipython3"
519-
}
520-
},
502+
"metadata": {},
521503
"nbformat": 4,
522504
"nbformat_minor": 5
523505
}

docs/user-guide/tof/wfm.ipynb

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"import plopp as pp\n",
2626
"import scipp as sc\n",
2727
"from scippneutron.chopper import DiskChopper\n",
28-
"from ess.reduce.nexus.types import AnyRun, DetectorData, SampleRun\n",
28+
"from ess.reduce.nexus.types import AnyRun, RawDetector, SampleRun\n",
2929
"from ess.reduce.time_of_flight import *"
3030
]
3131
},
@@ -321,10 +321,10 @@
321321
"source": [
322322
"wf = GenericTofWorkflow(run_types=[SampleRun], monitor_types=[])\n",
323323
"\n",
324-
"wf[DetectorData[SampleRun]] = raw_data\n",
324+
"wf[RawDetector[SampleRun]] = raw_data\n",
325325
"wf[DetectorLtotal[SampleRun]] = Ltotal\n",
326326
"\n",
327-
"wf.visualize(DetectorTofData[SampleRun])"
327+
"wf.visualize(TofDetector[SampleRun])"
328328
]
329329
},
330330
{
@@ -442,7 +442,6 @@
442442
]
443443
},
444444
{
445-
"attachments": {},
446445
"cell_type": "markdown",
447446
"id": "27",
448447
"metadata": {},
@@ -466,7 +465,7 @@
466465
"source": [
467466
"wf[TimeOfFlightLookupTable] = table\n",
468467
"\n",
469-
"tofs = wf.compute(DetectorTofData[SampleRun])\n",
468+
"tofs = wf.compute(TofDetector[SampleRun])\n",
470469
"tofs"
471470
]
472471
},
@@ -549,24 +548,7 @@
549548
]
550549
}
551550
],
552-
"metadata": {
553-
"kernelspec": {
554-
"display_name": "Python 3 (ipykernel)",
555-
"language": "python",
556-
"name": "python3"
557-
},
558-
"language_info": {
559-
"codemirror_mode": {
560-
"name": "ipython",
561-
"version": 3
562-
},
563-
"file_extension": ".py",
564-
"mimetype": "text/x-python",
565-
"name": "python",
566-
"nbconvert_exporter": "python",
567-
"pygments_lexer": "ipython3"
568-
}
569-
},
551+
"metadata": {},
570552
"nbformat": 4,
571553
"nbformat_minor": 5
572554
}

src/ess/reduce/live/raw.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import scippnexus as snx
3030

3131
from ess.reduce.nexus.types import (
32-
CalibratedDetector,
32+
EmptyDetector,
3333
Filename,
3434
NeXusComponent,
3535
NeXusDetectorName,
@@ -305,7 +305,7 @@ def transform_weights(
305305

306306
@staticmethod
307307
def from_detector_and_histogrammer(
308-
detector: CalibratedDetector[SampleRun],
308+
detector: EmptyDetector[SampleRun],
309309
window: RollingDetectorViewWindow,
310310
projection: Histogrammer,
311311
) -> RollingDetectorView:
@@ -320,10 +320,10 @@ def from_detector_and_histogrammer(
320320
def from_detector_with_projection(
321321
projection: Callable[[sc.DataArray], sc.DataArray] | None,
322322
) -> Callable[
323-
[CalibratedDetector[SampleRun], RollingDetectorViewWindow], RollingDetectorView
323+
[EmptyDetector[SampleRun], RollingDetectorViewWindow], RollingDetectorView
324324
]:
325325
def factory(
326-
detector: CalibratedDetector[SampleRun],
326+
detector: EmptyDetector[SampleRun],
327327
window: RollingDetectorViewWindow,
328328
) -> RollingDetectorView:
329329
"""Helper for constructing via a Sciline workflow."""
@@ -591,7 +591,7 @@ def gaussian_position_noise(sigma: PositionNoiseSigma) -> PositionNoise:
591591

592592
def position_with_noisy_replicas(
593593
*,
594-
detector: CalibratedDetector[SampleRun],
594+
detector: EmptyDetector[SampleRun],
595595
position_noise: PositionNoise,
596596
replicas: PositionNoiseReplicaCount,
597597
) -> CalibratedPositionWithNoisyReplicas:

src/ess/reduce/nexus/types.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -199,25 +199,19 @@ class MonitorPositionOffset(
199199
"""Offset for the monitor position, added to base position."""
200200

201201

202-
class CalibratedDetector(sciline.Scope[RunType, sc.DataArray], sc.DataArray):
203-
"""Calibrated data from a detector."""
202+
class EmptyDetector(sciline.Scope[RunType, sc.DataArray], sc.DataArray):
203+
"""Detector without neutron data."""
204204

205205

206-
class CalibratedBeamline(sciline.Scope[RunType, sc.DataArray], sc.DataArray):
207-
"""Calibrated beamline with detector and other components."""
206+
class EmptyMonitor(sciline.Scope[RunType, MonitorType, sc.DataArray], sc.DataArray):
207+
"""Monitor without neutron data."""
208208

209209

210-
class CalibratedMonitor(
211-
sciline.Scope[RunType, MonitorType, sc.DataArray], sc.DataArray
212-
):
213-
"""Calibrated data from a monitor."""
214-
215-
216-
class DetectorData(sciline.Scope[RunType, sc.DataArray], sc.DataArray):
210+
class RawDetector(sciline.Scope[RunType, sc.DataArray], sc.DataArray):
217211
"""Calibrated detector merged with neutron event or histogram data."""
218212

219213

220-
class MonitorData(sciline.Scope[RunType, MonitorType, sc.DataArray], sc.DataArray):
214+
class RawMonitor(sciline.Scope[RunType, MonitorType, sc.DataArray], sc.DataArray):
221215
"""Calibrated monitor merged with neutron event or histogram data."""
222216

223217

0 commit comments

Comments
 (0)