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..309f459e 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,13 @@ "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.LookupTableRelativeErrorThreshold] = 1.0\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 +90,7 @@ "outputs": [], "source": [ "table = wf.compute(time_of_flight.TimeOfFlightLookupTable)\n", - "table" + "table.array" ] }, { @@ -116,7 +118,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 +137,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 477e2609..0de1b54d 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.0", "graphviz", "numpy>=2", "plopp>=25.07.0", diff --git a/requirements/base.in b/requirements/base.in index 29b2fedd..40b1d537 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -3,9 +3,9 @@ # --- 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.0 graphviz -numpy>=1.25 +numpy>=2 plopp>=25.07.0 pythreejs>=2.4.1 sciline>=25.04.1 diff --git a/requirements/base.txt b/requirements/base.txt index 92395650..774bd314 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,4 +1,4 @@ -# SHA1:40cd03cd4a9e9632db0eebb7d094cb1a55638372 +# SHA1:951a9b0eb3b03cee1aa0600155d26e49ef83cfc2 # # This file was generated by pip-compile-multi. # To update, run: @@ -27,7 +27,7 @@ cyclebane==24.10.0 # via sciline cycler==0.12.1 # via matplotlib -dask==2026.1.1 +dask==2026.1.2 # via -r base.in decorator==5.2.1 # via ipython @@ -35,7 +35,7 @@ dnspython==2.8.0 # via email-validator email-validator==2.3.0 # via scippneutron -essreduce==26.1.1 +essreduce==26.2.0 # via -r base.in executing==2.2.1 # via stack-data @@ -59,7 +59,7 @@ importlib-metadata==8.7.1 # via dask ipydatawidgets==4.3.5 # via pythreejs -ipython==9.9.0 +ipython==9.10.0 # via ipywidgets ipython-pygments-lexers==1.1.1 # via ipython @@ -97,7 +97,7 @@ ncrystal-python==4.2.12 # via ncrystal networkx==3.6.1 # via cyclebane -numpy==2.4.1 +numpy==2.4.2 # via # -r base.in # ase @@ -132,7 +132,7 @@ plopp==25.11.0 # -r base.in # scippneutron # tof -pooch==1.8.2 +pooch==1.9.0 # via tof prompt-toolkit==3.0.52 # via ipython @@ -219,7 +219,7 @@ typing-inspection==0.4.2 # via pydantic urllib3==2.6.3 # via requests -wcwidth==0.3.0 +wcwidth==0.5.3 # via prompt-toolkit widgetsnbextension==4.0.15 # via ipywidgets diff --git a/requirements/basetest.txt b/requirements/basetest.txt index ae57aaaf..131f3b2d 100644 --- a/requirements/basetest.txt +++ b/requirements/basetest.txt @@ -21,7 +21,7 @@ idna==3.11 # via requests iniconfig==2.3.0 # via pytest -ipython==9.9.0 +ipython==9.10.0 # via ipywidgets ipython-pygments-lexers==1.1.1 # via ipython @@ -33,7 +33,7 @@ jupyterlab-widgets==3.0.16 # via ipywidgets matplotlib-inline==0.2.1 # via ipython -numpy==2.4.1 +numpy==2.4.2 # via pandas packaging==26.0 # via @@ -49,7 +49,7 @@ platformdirs==4.5.1 # via pooch pluggy==1.6.0 # via pytest -pooch==1.8.2 +pooch==1.9.0 # via -r basetest.in prompt-toolkit==3.0.52 # via ipython @@ -81,7 +81,7 @@ typing-extensions==4.15.0 # via ipython urllib3==2.6.3 # via requests -wcwidth==0.3.0 +wcwidth==0.5.3 # via prompt-toolkit widgetsnbextension==4.0.15 # via ipywidgets diff --git a/requirements/ci.txt b/requirements/ci.txt index f90a93aa..20ed8164 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -5,7 +5,7 @@ # # requirements upgrade # -cachetools==6.2.4 +cachetools==7.0.0 # via tox certifi==2026.1.4 # via requests diff --git a/requirements/dev.txt b/requirements/dev.txt index fbd2ac32..ab0b7715 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -26,7 +26,7 @@ async-lru==2.1.0 # via jupyterlab cffi==2.0.0 # via argon2-cffi-bindings -copier==9.11.2 +copier==9.11.3 # via -r dev.in dunamai==1.25.0 # via copier @@ -65,7 +65,7 @@ jupyter-server==2.17.0 # notebook-shim jupyter-server-terminals==0.5.4 # via jupyter-server -jupyterlab==4.5.2 +jupyterlab==4.5.3 # via -r dev.in jupyterlab-server==2.28.0 # via jupyterlab @@ -115,7 +115,7 @@ webcolors==25.10.0 # via jsonschema websocket-client==1.9.0 # via jupyter-server -wheel==0.46.2 +wheel==0.46.3 # via pip-tools # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/docs.txt b/requirements/docs.txt index 0a9d2b36..5e177870 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -16,7 +16,7 @@ attrs==25.4.0 # referencing autodoc-pydantic==2.2.0 # via -r docs.in -babel==2.17.0 +babel==2.18.0 # via # pydata-sphinx-theme # sphinx @@ -26,7 +26,7 @@ beautifulsoup4==4.14.3 # pydata-sphinx-theme bleach[css]==6.3.0 # via nbconvert -debugpy==1.8.19 +debugpy==1.8.20 # via ipykernel defusedxml==0.7.1 # via nbconvert @@ -89,7 +89,7 @@ myst-parser==5.0.0 # via -r docs.in nbclient==0.10.4 # via nbconvert -nbconvert==7.16.6 +nbconvert==7.17.0 # via nbsphinx nbformat==5.10.4 # via @@ -104,7 +104,7 @@ pandas==3.0.0 # via -r docs.in pandocfilters==1.5.1 # via nbconvert -psutil==7.2.1 +psutil==7.2.2 # via ipykernel pyarrow==23.0.0 # via -r docs.in diff --git a/requirements/mypy.txt b/requirements/mypy.txt index 2ee61c57..0f22723e 100644 --- a/requirements/mypy.txt +++ b/requirements/mypy.txt @@ -12,5 +12,5 @@ mypy==1.19.1 # via -r mypy.in mypy-extensions==1.1.0 # via mypy -pathspec==1.0.3 +pathspec==1.0.4 # via mypy diff --git a/requirements/nightly.in b/requirements/nightly.in index e22fd4d3..d709f8aa 100644 --- a/requirements/nightly.in +++ b/requirements/nightly.in @@ -3,7 +3,7 @@ # The following was generated by 'tox -e deps', DO NOT EDIT MANUALLY! dask>=2022.1.0 graphviz -numpy>=1.25 +numpy>=2 pythreejs>=2.4.1 ncrystal[cif]>=4.1.0 spglib!=2.7 diff --git a/requirements/nightly.txt b/requirements/nightly.txt index f69bb181..f5e1b18a 100644 --- a/requirements/nightly.txt +++ b/requirements/nightly.txt @@ -1,4 +1,4 @@ -# SHA1:c7ea57c5e953bfa839536ce478aea6b0964cf25a +# SHA1:02c4ca6025e8a899b9987d08704c722ee69e177a # # This file was generated by pip-compile-multi. # To update, run: @@ -30,7 +30,7 @@ cyclebane==24.10.0 # via sciline cycler==0.12.1 # via matplotlib -dask==2026.1.1 +dask==2026.1.2 # via -r nightly.in decorator==5.2.1 # via ipython @@ -64,7 +64,7 @@ iniconfig==2.3.0 # via pytest ipydatawidgets==4.3.5 # via pythreejs -ipython==9.9.0 +ipython==9.10.0 # via ipywidgets ipython-pygments-lexers==1.1.1 # via ipython @@ -103,12 +103,11 @@ ncrystal-python==4.2.12 # via ncrystal networkx==3.6.1 # via cyclebane -numpy==2.3.5 +numpy==2.4.2 # via # -r nightly.in # ase # contourpy - # essreduce # h5py # ipydatawidgets # matplotlib @@ -145,7 +144,7 @@ plopp @ git+https://github.com/scipp/plopp@main # tof pluggy==1.6.0 # via pytest -pooch==1.8.2 +pooch==1.9.0 # via # -r nightly.in # tof @@ -238,7 +237,7 @@ typing-inspection==0.4.2 # via pydantic urllib3==2.6.3 # via requests -wcwidth==0.3.0 +wcwidth==0.5.3 # 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..9a077654 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:29027043c422213acbc4a0acdcfaadd7", + "DREAM-high-flux-tof-lut-5m-80m-bc240.h5": "md5:e97ffd491bd11bdceec28036802a00ad", # 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 @@ -260,14 +262,21 @@ def simulated_monitor_empty_can() -> Path: return get_path("DREAM_simple_pwd_workflow/Cave_TOF_Monitor_van_can.dat") -def tof_lookup_table_high_flux(bc: Literal[215, 240] = 215) -> Path: +def tof_lookup_table_high_flux( + bc: Literal[215, 240] = 215, full_beamline: bool = False +) -> Path: """Path to a HDF5 file containing a lookup table for high-flux ToF. 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>`_ @@ -278,11 +287,20 @@ def tof_lookup_table_high_flux(bc: Literal[215, 240] = 215) -> Path: bc: Band-control chopper (BC) setting. The default is 215, which corresponds to the settings of the choppers in the tutorial data. + full_beamline: + If True, return a lookup table for the full beamline (5 m to 80 m). + If False, return a lookup table for the range 60 m to 80 m. """ match bc: case 215: - return get_path("DREAM-high-flux-tof-lookup-table.h5") + if full_beamline: + return get_path("DREAM-high-flux-tof-lut-5m-80m.h5") + else: + return get_path("DREAM-high-flux-tof-lookup-table.h5") case 240: - return get_path("DREAM-high-flux-tof-lookup-table-BC240-new0.h5") + if full_beamline: + return get_path("DREAM-high-flux-tof-lut-5m-80m-bc240.h5") + else: + return get_path("DREAM-high-flux-tof-lookup-table-BC240-new0.h5") case _: raise ValueError(f"Unsupported band-control chopper (BC) value: {bc}")