Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/ess/nmx/configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ class WorkflowConfig(BaseModel):
"If None, the lookup table will be computed on-the-fly.",
default=None,
)
tof_simulation_num_neutrons: int = Field(
title="Number of Neutrons for TOF Simulation",
description="Number of neutrons to simulate for TOF lookup table calculation.",
default=1_000_000,
)
tof_simulation_min_wavelength: float = Field(
title="TOF Simulation Minimum Wavelength",
description="Minimum wavelength for TOF simulation in Angstrom.",
Expand Down
8 changes: 7 additions & 1 deletion src/ess/nmx/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ def _simulate_fixed_wavelength_tof(
----------
"""
source = tof.Source(
facility="ess", neutrons=neutrons, pulses=2, seed=seed, wmax=wmax, wmin=wmin
facility="ess",
neutrons=neutrons,
pulses=2,
seed=seed,
wmax=wmax,
wmin=wmin,
)
nmx_det = tof.Detector(distance=max(ltotal_range), name="detector")
model = tof.Model(source=source, choppers=[], detectors=[nmx_det])
Expand Down Expand Up @@ -288,6 +293,7 @@ def compute_lookup_table(
wf[TimeOfFlightLookupTableFilename] = workflow_config.tof_lookup_table_file_path
else:
wf = patch_workflow_lookup_table_steps(wf=wf)
wf[NumberOfSimulatedNeutrons] = workflow_config.tof_simulation_num_neutrons
wmax = sc.scalar(workflow_config.tof_simulation_max_wavelength, unit='angstrom')
wmin = sc.scalar(workflow_config.tof_simulation_min_wavelength, unit='angstrom')
wf[TofSimulationMaxWavelength] = wmax
Expand Down
1 change: 1 addition & 0 deletions tests/executable_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def test_reduction_config() -> None:
max_time_bin=100_000,
time_bin_coordinate=TimeBinCoordinate.time_of_flight,
time_bin_unit=TimeBinUnit.us,
tof_simulation_num_neutrons=700_000,
tof_simulation_max_wavelength=5.0,
tof_simulation_min_wavelength=1.0,
tof_simulation_seed=12345,
Expand Down