Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"id": "0",
"metadata": {},
"source": [
"# Create a time-of-flight lookup table for DREAM"
"# Create a time-of-flight lookup table for DREAM\n",
"\n",
"This notebook shows how to create a time-of-flight lookup table for the DREAM instrument."
]
},
{
Expand All @@ -16,7 +18,6 @@
"outputs": [],
"source": [
"import scipp as sc\n",
"import sciline as sl\n",
"from ess.reduce import time_of_flight\n",
"from ess.dream.beamline import InstrumentConfiguration, choppers"
]
Expand All @@ -26,7 +27,9 @@
"id": "2",
"metadata": {},
"source": [
"## Select the choppers"
"## Select the choppers\n",
"\n",
"We select the choppers for the 'high-flux' configuration."
]
},
{
Expand Down Expand Up @@ -54,15 +57,12 @@
"metadata": {},
"outputs": [],
"source": [
"wf = sl.Pipeline(\n",
" time_of_flight.providers(), params=time_of_flight.default_parameters()\n",
")\n",
"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.SimulationResults] = time_of_flight.simulate_beamline(\n",
" choppers=disk_choppers, neutrons=5_000_000, source_position=sc.vector([0, 0, 0], unit='m'),\n",
")\n",
"\n",
"wf[time_of_flight.NumberOfSimulatedNeutrons] = 200_000 # Increase this number for more reliable results\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add to the docs (here or in data.py) the number used for the table? Or is it encoded in the hdf5 file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't. We should probably make it a coordinate, like the other metadata?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but it should be unaligned.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm that said, it's something specific to Tof. It's actually the neutrons that were in the source, not the neutrons that make it to the detectors.

If the simulation is done with mcstas, with parameter should not be there.
The other parameters (distamce and time resolution, etc.) belong with the table.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. But it can still be good to encode this kind of metadata in the file. But that is a longer discussion as we know...

For now, just add it to the docs so we can reproduce it later.

"wf[time_of_flight.SourcePosition] = sc.vector([0, 0, 0], unit='m')\n",
"wf[time_of_flight.DiskChoppers] = 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",
Expand Down
1 change: 1 addition & 0 deletions docs/user-guide/dream/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ dream-instrument-view
workflow-widget-dream
dream-detector-diagnostics
dream-visualize-absorption
dream-make-tof-lookup-table
```
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ requires-python = ">=3.10"
# Make sure to list one dependency per line.
dependencies = [
"dask",
"essreduce>=25.05.3",
"essreduce>=25.07.0",
"graphviz",
"numpy",
"plopp>=25.03.0",
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# --- END OF CUSTOM SECTION ---
# The following was generated by 'tox -e deps', DO NOT EDIT MANUALLY!
dask
essreduce>=25.05.3
essreduce>=25.07.0
graphviz
numpy
plopp>=25.03.0
Expand Down
16 changes: 8 additions & 8 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# SHA1:81114073dd5e4b765405b54b3976f92d6a96439b
# SHA1:8f044677d4db96fd48743befd036bb0b7410e72f
#
# This file was generated by pip-compile-multi.
# This file is autogenerated by pip-compile-multi
# To update, run:
#
# requirements upgrade
# pip-compile-multi
#
annotated-types==0.7.0
# via pydantic
Expand All @@ -21,21 +21,21 @@ cyclebane==24.10.0
# via sciline
cycler==0.12.1
# via matplotlib
dask==2025.5.1
dask==2025.7.0
# via -r base.in
decorator==5.2.1
# via ipython
dnspython==2.7.0
# via email-validator
email-validator==2.2.0
# via scippneutron
essreduce==25.5.3
essreduce==25.7.0
# via -r base.in
exceptiongroup==1.3.0
# via ipython
executing==2.2.0
# via stack-data
fonttools==4.58.4
fonttools==4.58.5
# via matplotlib
fsspec==2025.5.1
# via dask
Expand Down Expand Up @@ -143,7 +143,7 @@ scipp==25.5.1
# scippneutron
# scippnexus
# tof
scippneutron==25.6.0
scippneutron==25.7.0
# via
# -r base.in
# essreduce
Expand Down Expand Up @@ -177,7 +177,7 @@ traitlets==5.14.3
# traittypes
traittypes==0.2.1
# via ipydatawidgets
typing-extensions==4.14.0
typing-extensions==4.14.1
# via
# exceptiongroup
# ipython
Expand Down
10 changes: 5 additions & 5 deletions requirements/basetest.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# SHA1:c4f3e9aaa3abd10fcdf497bea14415857f62cc89
#
# This file was generated by pip-compile-multi.
# This file is autogenerated by pip-compile-multi
# To update, run:
#
# requirements upgrade
# pip-compile-multi
#
certifi==2025.6.15
certifi==2025.7.14
# via requests
charset-normalizer==3.4.2
# via requests
Expand All @@ -21,7 +21,7 @@ packaging==25.0
# via
# pooch
# pytest
pandas==2.3.0
pandas==2.3.1
# via -r basetest.in
platformdirs==4.3.8
# via pooch
Expand All @@ -43,7 +43,7 @@ six==1.17.0
# via python-dateutil
tomli==2.2.1
# via pytest
typing-extensions==4.14.0
typing-extensions==4.14.1
# via exceptiongroup
tzdata==2025.2
# via pandas
Expand Down
8 changes: 4 additions & 4 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# SHA1:6344d52635ea11dca331a3bc6eb1833c4c64d585
#
# This file was generated by pip-compile-multi.
# This file is autogenerated by pip-compile-multi
# To update, run:
#
# requirements upgrade
# pip-compile-multi
#
cachetools==6.1.0
# via tox
certifi==2025.6.15
certifi==2025.7.14
# via requests
chardet==5.2.0
# via tox
Expand Down Expand Up @@ -50,7 +50,7 @@ tomli==2.2.1
# tox
tox==4.27.0
# via -r ci.in
typing-extensions==4.14.0
typing-extensions==4.14.1
# via tox
urllib3==2.5.0
# via requests
Expand Down
10 changes: 5 additions & 5 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# SHA1:efd19a3a98c69fc3d6d6233ed855de7e4a208f74
#
# This file was generated by pip-compile-multi.
# This file is autogenerated by pip-compile-multi
# To update, run:
#
# requirements upgrade
# pip-compile-multi
#
-r base.txt
-r ci.txt
Expand All @@ -26,9 +26,9 @@ async-lru==2.0.5
# via jupyterlab
cffi==1.17.1
# via argon2-cffi-bindings
copier==9.7.1
copier==9.8.0
# via -r dev.in
dunamai==1.24.1
dunamai==1.25.0
# via copier
fqdn==1.5.1
# via jsonschema
Expand Down Expand Up @@ -105,7 +105,7 @@ terminado==0.18.1
# jupyter-server-terminals
toposort==1.10
# via pip-compile-multi
types-python-dateutil==2.9.0.20250516
types-python-dateutil==2.9.0.20250708
# via arrow
uri-template==1.3.0
# via jsonschema
Expand Down
8 changes: 4 additions & 4 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# SHA1:f584be06df2929a863ef5490377cbfe43c8e99a0
#
# This file was generated by pip-compile-multi.
# This file is autogenerated by pip-compile-multi
# To update, run:
#
# requirements upgrade
# pip-compile-multi
#
-r base.txt
accessible-pygments==0.0.5
Expand All @@ -26,7 +26,7 @@ beautifulsoup4==4.13.4
# pydata-sphinx-theme
bleach[css]==6.2.0
# via nbconvert
certifi==2025.6.15
certifi==2025.7.14
# via requests
charset-normalizer==3.4.2
# via requests
Expand Down Expand Up @@ -104,7 +104,7 @@ nbsphinx==0.9.7
# via -r docs.in
nest-asyncio==1.6.0
# via ipykernel
pandas==2.3.0
pandas==2.3.1
# via -r docs.in
pandocfilters==1.5.1
# via nbconvert
Expand Down
6 changes: 3 additions & 3 deletions requirements/mypy.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# SHA1:859ef9c15e5e57c6c91510133c01f5751feee941
#
# This file was generated by pip-compile-multi.
# This file is autogenerated by pip-compile-multi
# To update, run:
#
# requirements upgrade
# pip-compile-multi
#
-r test.txt
mypy==1.16.1
mypy==1.17.0
# via -r mypy.in
mypy-extensions==1.1.0
# via mypy
Expand Down
14 changes: 7 additions & 7 deletions requirements/nightly.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# SHA1:366263fa92dc0eb9f81d46f056e0c80a931f671e
#
# This file was generated by pip-compile-multi.
# This file is autogenerated by pip-compile-multi
# To update, run:
#
# requirements upgrade
# pip-compile-multi
#
--index-url https://pypi.anaconda.org/scipp-nightly-wheels/simple/
--extra-index-url https://pypi.org/simple
Expand All @@ -12,7 +12,7 @@ annotated-types==0.7.0
# via pydantic
asttokens==3.0.0
# via stack-data
certifi==2025.6.15
certifi==2025.7.14
# via requests
charset-normalizer==3.4.2
# via requests
Expand All @@ -28,7 +28,7 @@ cyclebane==24.10.0
# via sciline
cycler==0.12.1
# via matplotlib
dask==2025.5.1
dask==2025.7.0
# via -r nightly.in
decorator==5.2.1
# via ipython
Expand All @@ -44,7 +44,7 @@ exceptiongroup==1.3.0
# pytest
executing==2.2.0
# via stack-data
fonttools==4.58.4
fonttools==4.58.5
# via matplotlib
fsspec==2025.5.1
# via dask
Expand Down Expand Up @@ -112,7 +112,7 @@ packaging==25.0
# matplotlib
# pooch
# pytest
pandas==2.3.0
pandas==2.3.1
# via -r nightly.in
parso==0.8.4
# via jedi
Expand Down Expand Up @@ -212,7 +212,7 @@ traitlets==5.14.3
# traittypes
traittypes==0.2.1
# via ipydatawidgets
typing-extensions==4.14.0
typing-extensions==4.14.1
# via
# exceptiongroup
# ipython
Expand Down
4 changes: 2 additions & 2 deletions requirements/static.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# SHA1:5a0b1bb22ae805d8aebba0f3bf05ab91aceae0d8
#
# This file was generated by pip-compile-multi.
# This file is autogenerated by pip-compile-multi
# To update, run:
#
# requirements upgrade
# pip-compile-multi
#
cfgv==3.4.0
# via pre-commit
Expand Down
4 changes: 2 additions & 2 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# SHA1:ef2ee9576d8a9e65b44e2865a26887eed3fc49d1
#
# This file was generated by pip-compile-multi.
# This file is autogenerated by pip-compile-multi
# To update, run:
#
# requirements upgrade
# pip-compile-multi
#
-r base.txt
-r basetest.txt
4 changes: 2 additions & 2 deletions requirements/wheels.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# SHA1:80754af91bfb6d1073585b046fe0a474ce868509
#
# This file was generated by pip-compile-multi.
# This file is autogenerated by pip-compile-multi
# To update, run:
#
# requirements upgrade
# pip-compile-multi
#
build==1.2.2.post1
# via -r wheels.in
Expand Down
5 changes: 3 additions & 2 deletions src/ess/dream/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,9 @@ def tof_lookup_table_high_flux(bc: Literal[215, 240] = 215) -> str:
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).

The notebook that was used to create the table can be found at
https://github.com/scipp/essdiffraction/blob/main/tools/dream-make-tof-lookup-table.ipynb
This table was computed using `Create a time-of-flight lookup table for DREAM
<../../user-guide/dream/dream-make-tof-lookup-table.rst>`_
with ``NumberOfSimulatedNeutrons = 5_000_000``.

Parameters
----------
Expand Down
7 changes: 0 additions & 7 deletions src/ess/powder/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,9 @@

DetectorTofData = tof_t.DetectorTofData
MonitorTofData = tof_t.MonitorTofData
PulsePeriod = tof_t.PulsePeriod
PulseStride = tof_t.PulseStride
PulseStrideOffset = tof_t.PulseStrideOffset
DistanceResolution = tof_t.DistanceResolution
TimeResolution = tof_t.TimeResolution
LtotalRange = tof_t.LtotalRange
LookupTableRelativeErrorThreshold = tof_t.LookupTableRelativeErrorThreshold
TimeOfFlightLookupTable = tof_t.TimeOfFlightLookupTable
TimeOfFlightLookupTableFilename = tof_t.TimeOfFlightLookupTableFilename
SimulationResults = tof_t.SimulationResults

SampleRun = reduce_t.SampleRun
VanadiumRun = reduce_t.VanadiumRun
Expand Down
Loading
Loading