Skip to content

Commit 25ec18e

Browse files
committed
Use parametrized types
1 parent 06276fa commit 25ec18e

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

docs/user-guide/dream/dream-make-tof-lookup-table.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"source": [
2020
"import scipp as sc\n",
2121
"from ess.reduce import time_of_flight\n",
22+
"from ess.reduce.nexus.types import AnyRun\n",
2223
"from ess.dream.beamline import InstrumentConfiguration, choppers"
2324
]
2425
},
@@ -62,7 +63,7 @@
6263
"wf[time_of_flight.LtotalRange] = sc.scalar(60.0, unit=\"m\"), sc.scalar(80.0, unit=\"m\")\n",
6364
"wf[time_of_flight.NumberOfSimulatedNeutrons] = 200_000 # Increase this number for more reliable results\n",
6465
"wf[time_of_flight.SourcePosition] = sc.vector([0, 0, 0], unit='m')\n",
65-
"wf[time_of_flight.DiskChoppers] = disk_choppers\n",
66+
"wf[time_of_flight.DiskChoppers[AnyRun]] = disk_choppers\n",
6667
"wf[time_of_flight.DistanceResolution] = sc.scalar(0.1, unit=\"m\")\n",
6768
"wf[time_of_flight.TimeResolution] = sc.scalar(250.0, unit='us')\n",
6869
"wf[time_of_flight.LookupTableRelativeErrorThreshold] = 0.02\n",

src/ess/dream/io/cif.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
ReducedEmptyCanSubtractedTofCIF,
1616
ReducedTofCIF,
1717
ReducerSoftware,
18+
SampleRun,
1819
Source,
1920
)
2021

@@ -23,8 +24,8 @@ def prepare_reduced_tof_cif(
2324
da: IntensityTof,
2425
*,
2526
authors: CIFAuthors,
26-
beamline: Beamline,
27-
source: Source,
27+
beamline: Beamline[SampleRun],
28+
source: Source[SampleRun],
2829
reducers: ReducerSoftware,
2930
calibration: OutputCalibrationData,
3031
) -> ReducedTofCIF:
@@ -69,8 +70,8 @@ def prepare_reduced_empty_can_subtracted_tof_cif(
6970
da: EmptyCanSubtractedIntensityTof,
7071
*,
7172
authors: CIFAuthors,
72-
beamline: Beamline,
73-
source: Source,
73+
beamline: Beamline[SampleRun],
74+
source: Source[SampleRun],
7475
reducers: ReducerSoftware,
7576
calibration: OutputCalibrationData,
7677
) -> ReducedEmptyCanSubtractedTofCIF:
@@ -115,8 +116,8 @@ def _prepare_reduced_tof_cif_impl(
115116
da: IntensityTof,
116117
*,
117118
authors: CIFAuthors,
118-
beamline: Beamline,
119-
source: Source,
119+
beamline: Beamline[SampleRun],
120+
source: Source[SampleRun],
120121
reducers: ReducerSoftware,
121122
calibration: OutputCalibrationData,
122123
) -> ReducedTofCIF:

tests/dream/geant4_reduction_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
)
5151
from ess.reduce import time_of_flight
5252
from ess.reduce import workflow as reduce_workflow
53+
from ess.reduce.nexus.types import AnyRun
5354

5455
sample_position = sc.vector([0.0, 0.0, 0.0], unit='mm')
5556
source_position = sc.vector([-3.478, 0.0, -76550], unit='mm')
@@ -136,7 +137,7 @@ def test_pipeline_can_compute_dspacing_result_using_lookup_table_filename(workfl
136137
@pytest.fixture(scope="module")
137138
def dream_tof_lookup_table():
138139
lut_wf = time_of_flight.TofLookupTableWorkflow()
139-
lut_wf[time_of_flight.DiskChoppers] = dream.beamline.choppers(
140+
lut_wf[time_of_flight.DiskChoppers[AnyRun]] = dream.beamline.choppers(
140141
dream.beamline.InstrumentConfiguration.high_flux
141142
)
142143
lut_wf[time_of_flight.SourcePosition] = dream_source_position

tests/snspowder/powgen/powgen_reduction_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
DspacingBins,
1616
DspacingDetector,
1717
Filename,
18+
GravityVector,
1819
IntensityDspacing,
1920
IntensityDspacingTwoTheta,
2021
KeepEvents,
@@ -52,6 +53,7 @@ def params():
5253
| (x > sc.scalar(16666.67, unit="us").to(unit=elem_unit(x))),
5354
TwoThetaMask: None,
5455
WavelengthMask: None,
56+
GravityVector: sc.vector(value=[0, -1, 0]) * sc.constants.g,
5557
# Use bank sizes for small files
5658
DetectorBankSizes: {"bank": 23, "column": 7, "row": 7},
5759
}

0 commit comments

Comments
 (0)