|
8 | 8 | import sciline |
9 | 9 | import scipp as sc |
10 | 10 | import scipp.testing |
11 | | -import scippnexus as snx |
12 | 11 | from scippneutron import metadata |
13 | 12 | from scippneutron._utils import elem_unit |
14 | 13 |
|
|
20 | 19 | DreamGeant4ProtonChargeWorkflow, |
21 | 20 | ) |
22 | 21 | from ess.powder.types import ( |
23 | | - AccumulatedProtonCharge, |
24 | 22 | CalibrationFilename, |
25 | | - CaveMonitorPosition, |
26 | 23 | CIFAuthors, |
27 | 24 | CorrectedDetector, |
28 | 25 | DspacingBins, |
|
36 | 33 | KeepEvents, |
37 | 34 | MonitorFilename, |
38 | 35 | NeXusDetectorName, |
39 | | - Position, |
40 | 36 | ReducedTofCIF, |
41 | 37 | SampleRun, |
42 | 38 | TimeOfFlightLookupTable, |
|
52 | 48 | from ess.reduce import workflow as reduce_workflow |
53 | 49 | from ess.reduce.nexus.types import AnyRun |
54 | 50 |
|
55 | | -sample_position = sc.vector([0.0, 0.0, 0.0], unit='mm') |
56 | | -source_position = sc.vector([-3.478, 0.0, -76550], unit='mm') |
57 | | -proton_charge = sc.scalar(1.0, unit='µAh') |
58 | | -dream_source_position = sc.vector(value=[0, 0, -76.55], unit="m") |
59 | | - |
60 | 51 | params = { |
61 | 52 | Filename[SampleRun]: dream.data.simulated_diamond_sample(small=True), |
62 | 53 | Filename[VanadiumRun]: dream.data.simulated_vanadium_sample(small=True), |
|
70 | 61 | DspacingBins: sc.linspace('dspacing', 0.0, 2.3434, 201, unit='angstrom'), |
71 | 62 | TofMask: lambda x: (x < sc.scalar(0.0, unit='us').to(unit=elem_unit(x))) |
72 | 63 | | (x > sc.scalar(86e3, unit='us').to(unit=elem_unit(x))), |
73 | | - Position[snx.NXsample, SampleRun]: sample_position, |
74 | | - Position[snx.NXsample, VanadiumRun]: sample_position, |
75 | | - Position[snx.NXsource, SampleRun]: source_position, |
76 | | - Position[snx.NXsource, VanadiumRun]: source_position, |
77 | | - AccumulatedProtonCharge[SampleRun]: proton_charge, |
78 | | - AccumulatedProtonCharge[VanadiumRun]: proton_charge, |
79 | 64 | TwoThetaMask: None, |
80 | 65 | WavelengthMask: None, |
81 | | - CaveMonitorPosition: sc.vector([0.0, 0.0, -4220.0], unit='mm'), |
82 | 66 | CIFAuthors: CIFAuthors( |
83 | 67 | [ |
84 | 68 | metadata.Person( |
@@ -140,7 +124,7 @@ def dream_tof_lookup_table(): |
140 | 124 | lut_wf[time_of_flight.DiskChoppers[AnyRun]] = dream.beamline.choppers( |
141 | 125 | dream.beamline.InstrumentConfiguration.high_flux |
142 | 126 | ) |
143 | | - lut_wf[time_of_flight.SourcePosition] = dream_source_position |
| 127 | + lut_wf[time_of_flight.SourcePosition] = sc.vector(value=[0, 0, -76.55], unit="m") |
144 | 128 | lut_wf[time_of_flight.NumberOfSimulatedNeutrons] = 500_000 |
145 | 129 | lut_wf[time_of_flight.SimulationSeed] = 555 |
146 | 130 | lut_wf[time_of_flight.PulseStride] = 1 |
@@ -304,9 +288,26 @@ def test_pipeline_can_save_data(workflow): |
304 | 288 | _assert_contains_tof_data(content) |
305 | 289 |
|
306 | 290 |
|
307 | | -def test_pipeline_save_data_to_disk(workflow, output_folder: Path): |
308 | | - workflow = powder.with_pixel_mask_filenames(workflow, []) |
309 | | - result = workflow.compute(ReducedTofCIF) |
| 291 | +def test_pipeline_save_data_to_disk(output_folder: Path): |
| 292 | + """ |
| 293 | + This test saves a reduced CIF file to disk using the DREAM workflow. |
| 294 | + The reduced results are uploaded as an artifact in GH actions, and is subsequently |
| 295 | + used by analysis software as part of the integration tests. Therefore, we need |
| 296 | + to have enough signal: we thus use the large files instead of small, and use the |
| 297 | + mantle detector bank. |
| 298 | + """ |
| 299 | + wf = make_workflow( |
| 300 | + {**params, NeXusDetectorName: "mantle"}, |
| 301 | + run_norm=powder.RunNormalization.proton_charge, |
| 302 | + ) |
| 303 | + |
| 304 | + wf[Filename[SampleRun]] = dream.data.simulated_diamond_sample(small=False) |
| 305 | + wf[Filename[VanadiumRun]] = dream.data.simulated_vanadium_sample(small=False) |
| 306 | + wf[Filename[EmptyCanRun]] = dream.data.simulated_empty_can(small=False) |
| 307 | + wf[DspacingBins] = sc.linspace('dspacing', 0.3, 2.3434, 2001, unit='angstrom') |
| 308 | + wf = powder.with_pixel_mask_filenames(wf, []) |
| 309 | + |
| 310 | + result = wf.compute(ReducedTofCIF) |
310 | 311 | result.comment = """This file was generated with the DREAM data reduction user guide |
311 | 312 | in the documentation of ESSdiffraction. |
312 | 313 | See https://scipp.github.io/essdiffraction/ |
|
0 commit comments