|
| 1 | +# SPDX-License-Identifier: BSD-3-Clause |
| 2 | +# Copyright (c) 2025 Scipp contributors (https://github.com/scipp) |
| 3 | + |
| 4 | + |
| 5 | +import pytest |
| 6 | + |
| 7 | +import tof |
| 8 | + |
| 9 | + |
| 10 | +@pytest.mark.parametrize("mode", ['high_flux', 'high_resolution']) |
| 11 | +def test_run_dream_model(mode): |
| 12 | + source = tof.Source(facility='ess', neutrons=100_000, pulses=2) |
| 13 | + |
| 14 | + match mode: |
| 15 | + case 'high_flux': |
| 16 | + params = {"high_flux": True} |
| 17 | + case 'high_resolution': |
| 18 | + params = {"high_resolution": True} |
| 19 | + |
| 20 | + dream_params = tof.facilities.ess.dream(**params) |
| 21 | + model = tof.Model(source=source, **dream_params) |
| 22 | + results = model.run() |
| 23 | + assert len(results.choppers) > 0 |
| 24 | + assert len(results.detectors) > 0 |
| 25 | + |
| 26 | + |
| 27 | +@pytest.mark.parametrize("pulse_skipping", [True, False]) |
| 28 | +@pytest.mark.parametrize("facility", ['ess', 'ess-odin']) |
| 29 | +def test_run_odin_model(pulse_skipping, facility): |
| 30 | + source = tof.Source(facility=facility, neutrons=100_000, pulses=2) |
| 31 | + odin_params = tof.facilities.ess.odin(pulse_skipping=pulse_skipping) |
| 32 | + model = tof.Model(source=source, **odin_params) |
| 33 | + results = model.run() |
| 34 | + assert len(results.choppers) > 0 |
| 35 | + assert len(results.detectors) > 0 |
0 commit comments