diff --git a/docs/user-guide/dream/dream-make-tof-lookup-table.ipynb b/docs/user-guide/dream/dream-make-tof-lookup-table.ipynb index c9ade0c6..a90790b1 100644 --- a/docs/user-guide/dream/dream-make-tof-lookup-table.ipynb +++ b/docs/user-guide/dream/dream-make-tof-lookup-table.ipynb @@ -48,6 +48,8 @@ "id": "4", "metadata": {}, "source": [ + "Note that possible configurations are `high_flux`, `high_flux_BC215`, `high_flux_BC240`, and `high_resolution`.\n", + "\n", "## Setting up the workflow" ] }, @@ -60,13 +62,12 @@ "source": [ "wf = time_of_flight.TofLookupTableWorkflow()\n", "\n", - "wf[time_of_flight.LtotalRange] = sc.scalar(60.0, unit=\"m\"), sc.scalar(80.0, unit=\"m\")\n", + "wf[time_of_flight.LtotalRange] = sc.scalar(5.0, unit=\"m\"), sc.scalar(80.0, unit=\"m\")\n", "wf[time_of_flight.NumberOfSimulatedNeutrons] = 200_000 # Increase this number for more reliable results\n", "wf[time_of_flight.SourcePosition] = sc.vector([0, 0, 0], unit='m')\n", "wf[time_of_flight.DiskChoppers[AnyRun]] = disk_choppers\n", "wf[time_of_flight.DistanceResolution] = sc.scalar(0.1, unit=\"m\")\n", "wf[time_of_flight.TimeResolution] = sc.scalar(250.0, unit='us')\n", - "wf[time_of_flight.LookupTableRelativeErrorThreshold] = 0.02\n", "wf[time_of_flight.PulsePeriod] = 1.0 / sc.scalar(14.0, unit=\"Hz\")\n", "wf[time_of_flight.PulseStride] = 1\n", "wf[time_of_flight.PulseStrideOffset] = None" @@ -88,7 +89,7 @@ "outputs": [], "source": [ "table = wf.compute(time_of_flight.TimeOfFlightLookupTable)\n", - "table" + "table.array" ] }, { @@ -116,7 +117,7 @@ "metadata": {}, "outputs": [], "source": [ - "table.save_hdf5('DREAM-high-flux-tof-lookup-table.h5')" + "table.save_hdf5('DREAM-high-flux-tof-lut-5m-80m.h5')" ] } ], @@ -135,7 +136,8 @@ "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython3" + "pygments_lexer": "ipython3", + "version": "3.12.12" } }, "nbformat": 4, diff --git a/pyproject.toml b/pyproject.toml index 27e7da38..d6b91d6c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ requires-python = ">=3.11" # Make sure to list one dependency per line. dependencies = [ "dask>=2022.1.0", - "essreduce>=25.12.1", + "essreduce>=26.2.1", "graphviz", "numpy>=2", "plopp>=26.2.0", diff --git a/requirements/base.in b/requirements/base.in index 98ed6dca..e6b4f5f0 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -3,7 +3,7 @@ # --- END OF CUSTOM SECTION --- # The following was generated by 'tox -e deps', DO NOT EDIT MANUALLY! dask>=2022.1.0 -essreduce>=25.12.1 +essreduce>=26.2.1 graphviz numpy>=2 plopp>=26.2.0 diff --git a/requirements/base.txt b/requirements/base.txt index 0c0cca58..37d1b9d8 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,4 +1,4 @@ -# SHA1:303c70637d6536773db66ff40b4306cd86aee2c0 +# SHA1:e8dc8a7c4338f6f02931f7cf0dd2408d0d0351db # # This file was generated by pip-compile-multi. # To update, run: @@ -35,13 +35,13 @@ dnspython==2.8.0 # via email-validator email-validator==2.3.0 # via scippneutron -essreduce==26.2.0 +essreduce==26.2.1 # via -r base.in executing==2.2.1 # via stack-data fonttools==4.61.1 # via matplotlib -fsspec==2026.1.0 +fsspec==2026.2.0 # via dask gemmi==0.7.4 # via ncrystal @@ -117,13 +117,13 @@ packaging==26.0 # lazy-loader # matplotlib # pooch -parso==0.8.5 +parso==0.8.6 # via jedi partd==1.4.2 # via dask pexpect==4.9.0 # via ipython -pillow==12.1.0 +pillow==12.1.1 # via matplotlib platformdirs==4.5.1 # via pooch @@ -219,7 +219,7 @@ typing-inspection==0.4.2 # via pydantic urllib3==2.6.3 # via requests -wcwidth==0.5.3 +wcwidth==0.6.0 # via prompt-toolkit widgetsnbextension==4.0.15 # via ipywidgets diff --git a/requirements/basetest.txt b/requirements/basetest.txt index 131f3b2d..32695a75 100644 --- a/requirements/basetest.txt +++ b/requirements/basetest.txt @@ -41,7 +41,7 @@ packaging==26.0 # pytest pandas==3.0.0 # via -r basetest.in -parso==0.8.5 +parso==0.8.6 # via jedi pexpect==4.9.0 # via ipython @@ -81,7 +81,7 @@ typing-extensions==4.15.0 # via ipython urllib3==2.6.3 # via requests -wcwidth==0.5.3 +wcwidth==0.6.0 # via prompt-toolkit widgetsnbextension==4.0.15 # via ipywidgets diff --git a/requirements/ci.txt b/requirements/ci.txt index 20ed8164..fd69cd42 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -5,7 +5,7 @@ # # requirements upgrade # -cachetools==7.0.0 +cachetools==7.0.1 # via tox certifi==2026.1.4 # via requests diff --git a/requirements/dev.txt b/requirements/dev.txt index ab0b7715..1b6bda4c 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -65,7 +65,7 @@ jupyter-server==2.17.0 # notebook-shim jupyter-server-terminals==0.5.4 # via jupyter-server -jupyterlab==4.5.3 +jupyterlab==4.5.4 # via -r dev.in jupyterlab-server==2.28.0 # via jupyterlab @@ -77,7 +77,7 @@ overrides==7.7.0 # via jupyter-server pip-compile-multi==3.2.2 # via -r dev.in -pip-tools==7.5.2 +pip-tools==7.5.3 # via pip-compile-multi plumbum==1.10.0 # via copier diff --git a/requirements/docs.txt b/requirements/docs.txt index 5e177870..e1456dcc 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -42,7 +42,7 @@ fastjsonschema==2.21.2 # via nbformat imagesize==1.4.1 # via sphinx -ipykernel==7.1.0 +ipykernel==7.2.0 # via -r docs.in ipympl==0.10.0 # via -r docs.in diff --git a/requirements/nightly.txt b/requirements/nightly.txt index f5e1b18a..c2a68ede 100644 --- a/requirements/nightly.txt +++ b/requirements/nightly.txt @@ -44,7 +44,7 @@ executing==2.2.1 # via stack-data fonttools==4.61.1 # via matplotlib -fsspec==2026.1.0 +fsspec==2026.2.0 # via dask gemmi==0.7.4 # via ncrystal @@ -127,13 +127,13 @@ packaging==26.0 # pytest pandas==3.0.0 # via -r nightly.in -parso==0.8.5 +parso==0.8.6 # via jedi partd==1.4.2 # via dask pexpect==4.9.0 # via ipython -pillow==12.1.0 +pillow==12.1.1 # via matplotlib platformdirs==4.5.1 # via pooch @@ -237,7 +237,7 @@ typing-inspection==0.4.2 # via pydantic urllib3==2.6.3 # via requests -wcwidth==0.5.3 +wcwidth==0.6.0 # via prompt-toolkit widgetsnbextension==4.0.15 # via ipywidgets diff --git a/src/ess/dream/beamline.py b/src/ess/dream/beamline.py index 2bb17f92..8451cf6e 100644 --- a/src/ess/dream/beamline.py +++ b/src/ess/dream/beamline.py @@ -26,7 +26,11 @@ def choppers(configuration: InstrumentConfiguration) -> dict[str, DiskChopper]: """Return the chopper configuration for the given instrument configuration.""" match configuration: - case InstrumentConfiguration.high_flux: + case ( + InstrumentConfiguration.high_flux + | InstrumentConfiguration.high_flux_BC215 + | InstrumentConfiguration.high_flux_BC240 + ): return { "psc1": DiskChopper( frequency=sc.scalar(14.0, unit="Hz"), @@ -115,9 +119,15 @@ def choppers(configuration: InstrumentConfiguration) -> dict[str, DiskChopper]: "bcc": DiskChopper( frequency=sc.scalar(112.0, unit="Hz"), beam_position=sc.scalar(0.0, unit="deg"), - phase=sc.scalar(215 - 180, unit="deg"), - # Use 240 to reduce overlap between frames - # phase=sc.scalar(240 - 180, unit="deg"), + phase=sc.scalar( + ( + 240 + if configuration == InstrumentConfiguration.high_flux_BC240 + else 215 + ) + - 180, + unit="deg", + ), axle_position=sc.vector(value=[0, 0, 9.78], unit="m"), slit_begin=sc.array( dims=["cutout"], values=[-36.875, 143.125], unit="deg" diff --git a/src/ess/dream/data.py b/src/ess/dream/data.py index 6a3e8426..1e8136eb 100644 --- a/src/ess/dream/data.py +++ b/src/ess/dream/data.py @@ -24,9 +24,11 @@ "DREAM_simple_pwd_workflow/Cave_TOF_Monitor_diam_in_can.dat": "md5:ef24f4a4186c628574046e6629e31611", # noqa: E501 "DREAM_simple_pwd_workflow/Cave_TOF_Monitor_van_can.dat": "md5:2cdef7ad9912652149b7e687381d2e99", # noqa: E501 "DREAM_simple_pwd_workflow/Cave_TOF_Monitor_vana_inc_coh.dat": "md5:701d66792f20eb283a4ce76bae0c8f8f", # noqa: E501 - # BC215 + # Time-of-flight lookup tables "DREAM-high-flux-tof-lookup-table.h5": "md5:1b95a359fa7b0d8b4277806ece9bf279", "DREAM-high-flux-tof-lookup-table-BC240-new0.h5": "md5:2cc9dc802082101933429a2ea3624126", # noqa: E501 + "DREAM-high-flux-tof-lut-5m-80m.h5": "md5:0db099795027e283f70cb48f738a1c44", + "DREAM-high-flux-tof-lut-5m-80m-bc240.h5": "md5:85c0a8acd7ed7f9793ef29f47776f63f", # noqa: E501 # Smaller files for unit tests "DREAM_simple_pwd_workflow/TEST_data_dream_diamond_vana_container_sample_union.csv.zip": "md5:405df9b5ade9d61ab71fe8d8c19bb51b", # noqa: E501 "DREAM_simple_pwd_workflow/TEST_data_dream_vana_container_sample_union.csv.zip": "md5:20186119d1debfb0c2352f9db384cd0a", # noqa: E501 @@ -265,9 +267,14 @@ def tof_lookup_table_high_flux(bc: Literal[215, 240] = 215) -> Path: The table was created using the ``tof`` package and the chopper settings for the DREAM instrument in high-resolution mode. - Note that the phase of the band-control chopper (BCC) was set to 240 degrees to - match that of the simulated data (this has since been found to be non-optimal as it - leads to time overlap between the two frames). + Can return tables for two different band-control chopper (BC) settings: + - ``bc=215``: corresponds to the settings of the choppers in the tutorial data. + - ``bc=240``: a setting with less time overlap between frames. + + Note that the phase of the band-control chopper (BCC) was set to 215 degrees in the + Geant4 simulation which generated the data used in the documentation notebooks. + This has since been found to be non-optimal as it leads to time overlap between the + two frames, and a value of 240 degrees is now recommended. This table was computed using `Create a time-of-flight lookup table for DREAM <../../user-guide/dream/dream-make-tof-lookup-table.rst>`_ @@ -281,8 +288,8 @@ def tof_lookup_table_high_flux(bc: Literal[215, 240] = 215) -> Path: """ match bc: case 215: - return get_path("DREAM-high-flux-tof-lookup-table.h5") + return get_path("DREAM-high-flux-tof-lut-5m-80m.h5") case 240: - return get_path("DREAM-high-flux-tof-lookup-table-BC240-new0.h5") + return get_path("DREAM-high-flux-tof-lut-5m-80m-bc240.h5") case _: raise ValueError(f"Unsupported band-control chopper (BC) value: {bc}") diff --git a/src/ess/dream/workflows.py b/src/ess/dream/workflows.py index 90d61b30..b8742f05 100644 --- a/src/ess/dream/workflows.py +++ b/src/ess/dream/workflows.py @@ -18,6 +18,7 @@ CaveMonitorPosition, # Should this be a DREAM-only parameter? EmptyCanRun, KeepEvents, + LookupTableRelativeErrorThreshold, PixelMaskFilename, Position, ReducerSoftware, @@ -209,6 +210,7 @@ def DreamGeant4Workflow(*, run_norm: RunNormalization, **kwargs) -> sciline.Pipe AccumulatedProtonCharge[VanadiumRun]: charge, AccumulatedProtonCharge[EmptyCanRun]: charge, CaveMonitorPosition: sc.vector([0.0, 0.0, -4220.0], unit='mm'), + LookupTableRelativeErrorThreshold: 0.02, } for key, value in additional_parameters.items(): wf[key] = value diff --git a/src/ess/powder/types.py b/src/ess/powder/types.py index 228b0015..db5b8065 100644 --- a/src/ess/powder/types.py +++ b/src/ess/powder/types.py @@ -41,6 +41,7 @@ PulseStrideOffset = tof_t.PulseStrideOffset TimeOfFlightLookupTable = tof_t.TimeOfFlightLookupTable TimeOfFlightLookupTableFilename = tof_t.TimeOfFlightLookupTableFilename +LookupTableRelativeErrorThreshold = tof_t.LookupTableRelativeErrorThreshold SampleRun = reduce_t.SampleRun VanadiumRun = reduce_t.VanadiumRun