diff --git a/docs/user-guide/offspec/offspec_reduction.ipynb b/docs/user-guide/offspec/offspec_reduction.ipynb index e444e369..90cbf727 100644 --- a/docs/user-guide/offspec/offspec_reduction.ipynb +++ b/docs/user-guide/offspec/offspec_reduction.ipynb @@ -120,8 +120,8 @@ " polarization=\"unpolarized\",\n", " ),\n", " data_files=[\n", - " offspec.data.offspec_sample_run().rsplit(\"/\", 1)[-1],\n", - " offspec.data.offspec_direct_beam_run().rsplit(\"/\", 1)[-1],\n", + " wf.compute(Filename[SampleRun]).name,\n", + " wf.compute(Filename[ReferenceRun]).name,\n", " ],\n", " scheme=\"energy-dispersive\",\n", ")" @@ -439,7 +439,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.14" + "version": "3.11.10" } }, "nbformat": 4, diff --git a/pyproject.toml b/pyproject.toml index 63600d7e..0e99f0ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ dependencies = [ "scipp>=24.09.1", # Fixed new hist/bin API "scippneutron>=24.10.0", "scippnexus>=24.9.1", - "essreduce>=25.4.0", + "essreduce>=25.10.0", "pandas>=2.1.2", ] diff --git a/requirements/base.in b/requirements/base.in index 69e30a36..d7137607 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -11,5 +11,5 @@ sciline>=24.6.0 scipp>=24.09.1 scippneutron>=24.10.0 scippnexus>=24.9.1 -essreduce>=25.4.0 +essreduce>=25.10.0 pandas>=2.1.2 diff --git a/requirements/base.txt b/requirements/base.txt index f03ac928..2c3014a5 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,4 +1,4 @@ -# SHA1:130d28f27af16c0c6e122d19bb76f37750334d26 +# SHA1:ea4eb0862041433c90c4b8ac1b1cf7f7cd7f70eb # # This file was generated by pip-compile-multi. # To update, run: @@ -7,7 +7,7 @@ # annotated-types==0.7.0 # via pydantic -click==8.2.1 +click==8.3.0 # via dask cloudpickle==3.1.1 # via dask @@ -17,29 +17,29 @@ cyclebane==24.10.0 # via sciline cycler==0.12.1 # via matplotlib -dask==2025.7.0 +dask==2025.9.1 # via -r base.in -dnspython==2.7.0 +dnspython==2.8.0 # via email-validator -email-validator==2.2.0 +email-validator==2.3.0 # via scippneutron -essreduce==25.7.1 +essreduce==25.10.0 # via -r base.in -fonttools==4.59.0 +fonttools==4.60.1 # via matplotlib -fsspec==2025.7.0 +fsspec==2025.9.0 # via dask graphviz==0.21 # via -r base.in -h5py==3.14.0 +h5py==3.15.0 # via # scippneutron # scippnexus -idna==3.10 +idna==3.11 # via email-validator importlib-metadata==8.7.0 # via dask -kiwisolver==1.4.8 +kiwisolver==1.4.9 # via matplotlib lazy-loader==0.4 # via @@ -47,15 +47,15 @@ lazy-loader==0.4 # scippneutron locket==1.0.0 # via partd -matplotlib==3.10.5 +matplotlib==3.10.7 # via # mpltoolbox # plopp -mpltoolbox==25.5.0 +mpltoolbox==25.10.0 # via scippneutron networkx==3.5 # via cyclebane -numpy==2.3.2 +numpy==2.3.3 # via # contourpy # h5py @@ -71,21 +71,21 @@ packaging==25.0 # dask # lazy-loader # matplotlib -pandas==2.3.1 +pandas==2.3.3 # via -r base.in partd==1.4.2 # via dask pillow==11.3.0 # via matplotlib -plopp==25.7.1 +plopp==25.10.0 # via # -r base.in # scippneutron -pydantic==2.11.7 +pydantic==2.12.0 # via scippneutron -pydantic-core==2.33.2 +pydantic-core==2.41.1 # via pydantic -pyparsing==3.2.3 +pyparsing==3.2.5 # via matplotlib python-dateutil==2.9.0.post0 # via @@ -96,15 +96,15 @@ python-dateutil==2.9.0.post0 # scippnexus pytz==2025.2 # via pandas -pyyaml==6.0.2 +pyyaml==6.0.3 # via # dask # orsopy -sciline==25.5.2 +sciline==25.8.0 # via # -r base.in # essreduce -scipp==25.5.1 +scipp==25.8.0 # via # -r base.in # essreduce @@ -119,7 +119,7 @@ scippnexus==25.6.0 # -r base.in # essreduce # scippneutron -scipy==1.16.1 +scipy==1.16.2 # via # scippneutron # scippnexus @@ -129,13 +129,13 @@ toolz==1.0.0 # via # dask # partd -typing-extensions==4.14.1 +typing-extensions==4.15.0 # via # pydantic # pydantic-core # sciline # typing-inspection -typing-inspection==0.4.1 +typing-inspection==0.4.2 # via pydantic tzdata==2025.2 # via pandas diff --git a/requirements/basetest.txt b/requirements/basetest.txt index 411b708c..8576a05f 100644 --- a/requirements/basetest.txt +++ b/requirements/basetest.txt @@ -5,11 +5,11 @@ # # requirements upgrade # -certifi==2025.8.3 +certifi==2025.10.5 # via requests -charset-normalizer==3.4.2 +charset-normalizer==3.4.3 # via requests -idna==3.10 +idna==3.11 # via requests iniconfig==2.1.0 # via pytest @@ -17,7 +17,7 @@ packaging==25.0 # via # pooch # pytest -platformdirs==4.3.8 +platformdirs==4.5.0 # via pooch pluggy==1.6.0 # via pytest @@ -25,9 +25,9 @@ pooch==1.8.2 # via -r basetest.in pygments==2.19.2 # via pytest -pytest==8.4.1 +pytest==8.4.2 # via -r basetest.in -requests==2.32.4 +requests==2.32.5 # via pooch urllib3==2.5.0 # via requests diff --git a/requirements/ci.txt b/requirements/ci.txt index cf385f77..fbddba98 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -5,19 +5,19 @@ # # requirements upgrade # -cachetools==6.1.0 +cachetools==6.2.1 # via tox -certifi==2025.8.3 +certifi==2025.10.5 # via requests chardet==5.2.0 # via tox -charset-normalizer==3.4.2 +charset-normalizer==3.4.3 # via requests colorama==0.4.6 # via tox distlib==0.4.0 # via virtualenv -filelock==3.18.0 +filelock==3.20.0 # via # tox # virtualenv @@ -25,28 +25,28 @@ gitdb==4.0.12 # via gitpython gitpython==3.1.45 # via -r ci.in -idna==3.10 +idna==3.11 # via requests packaging==25.0 # via # -r ci.in # pyproject-api # tox -platformdirs==4.3.8 +platformdirs==4.5.0 # via # tox # virtualenv pluggy==1.6.0 # via tox -pyproject-api==1.9.1 +pyproject-api==1.10.0 # via tox -requests==2.32.4 +requests==2.32.5 # via -r ci.in smmap==5.0.2 # via gitdb -tox==4.28.4 +tox==4.31.0 # via -r ci.in urllib3==2.5.0 # via requests -virtualenv==20.33.1 +virtualenv==20.35.3 # via tox diff --git a/requirements/dev.txt b/requirements/dev.txt index 94aff0a8..9b850845 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -12,7 +12,7 @@ -r static.txt -r test.txt -r wheels.txt -anyio==4.10.0 +anyio==4.11.0 # via # httpx # jupyter-server @@ -24,9 +24,9 @@ arrow==1.3.0 # via isoduration async-lru==2.0.5 # via jupyterlab -cffi==1.17.1 +cffi==2.0.0 # via argon2-cffi-bindings -copier==9.9.0 +copier==9.10.2 # via -r dev.in dunamai==1.25.0 # via copier @@ -44,20 +44,20 @@ isoduration==20.11.0 # via jsonschema jinja2-ansible-filters==1.3.2 # via copier -json5==0.12.0 +json5==0.12.1 # via jupyterlab-server jsonpointer==3.0.0 # via jsonschema -jsonschema[format-nongpl]==4.25.0 +jsonschema[format-nongpl]==4.25.1 # via # jupyter-events # jupyterlab-server # nbformat jupyter-events==0.12.0 # via jupyter-server -jupyter-lsp==2.2.6 +jupyter-lsp==2.3.0 # via jupyterlab -jupyter-server==2.16.0 +jupyter-server==2.17.0 # via # jupyter-lsp # jupyterlab @@ -65,29 +65,29 @@ jupyter-server==2.16.0 # notebook-shim jupyter-server-terminals==0.5.3 # via jupyter-server -jupyterlab==4.4.5 +jupyterlab==4.4.9 # via -r dev.in jupyterlab-server==2.27.3 # via jupyterlab -lark==1.2.2 +lark==1.3.0 # via rfc3987-syntax notebook-shim==0.2.4 # via jupyterlab overrides==7.7.0 # via jupyter-server -pip-compile-multi==3.2.1 +pip-compile-multi==3.2.2 # via -r dev.in -pip-tools==7.5.0 +pip-tools==7.5.1 # via pip-compile-multi plumbum==1.9.0 # via copier -prometheus-client==0.22.1 +prometheus-client==0.23.1 # via jupyter-server -pycparser==2.22 +pycparser==2.23 # via cffi -python-json-logger==3.3.0 +python-json-logger==4.0.0 # via jupyter-events -questionary==2.1.0 +questionary==2.1.1 # via copier rfc3339-validator==0.1.4 # via @@ -109,13 +109,13 @@ terminado==0.18.1 # jupyter-server-terminals toposort==1.10 # via pip-compile-multi -types-python-dateutil==2.9.0.20250708 +types-python-dateutil==2.9.0.20251008 # via arrow uri-template==1.3.0 # via jsonschema webcolors==24.11.1 # via jsonschema -websocket-client==1.8.0 +websocket-client==1.9.0 # via jupyter-server wheel==0.45.1 # via pip-tools diff --git a/requirements/docs.txt b/requirements/docs.txt index dccc773d..29766fad 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -10,11 +10,9 @@ accessible-pygments==0.0.5 # via pydata-sphinx-theme alabaster==1.0.0 # via sphinx -appnope==0.1.4 - # via ipykernel asttokens==3.0.0 # via stack-data -attrs==25.3.0 +attrs==25.4.0 # via # jsonschema # referencing @@ -24,7 +22,7 @@ babel==2.17.0 # via # pydata-sphinx-theme # sphinx -beautifulsoup4==4.13.4 +beautifulsoup4==4.14.2 # via # nbconvert # pydata-sphinx-theme @@ -32,15 +30,15 @@ bleach[css]==6.2.0 # via nbconvert bqplot==0.12.45 # via ipydatagrid -certifi==2025.8.3 +certifi==2025.10.5 # via requests -charset-normalizer==3.4.2 +charset-normalizer==3.4.3 # via requests comm==0.2.3 # via # ipykernel # ipywidgets -debugpy==1.8.15 +debugpy==1.8.17 # via ipykernel decorator==5.2.1 # via ipython @@ -54,9 +52,9 @@ docutils==0.21.2 # pydata-sphinx-theme # sphinx # sphinxcontrib-bibtex -executing==2.2.0 +executing==2.2.1 # via stack-data -fastjsonschema==2.21.1 +fastjsonschema==2.21.2 # via nbformat gast==0.4.0 # via py2vega @@ -64,11 +62,11 @@ imagesize==1.4.1 # via sphinx ipydatagrid==1.4.0 # via -r docs.in -ipykernel==6.30.1 +ipykernel==7.0.0 # via -r docs.in -ipympl==0.9.7 +ipympl==0.9.8 # via -r docs.in -ipython==9.4.0 +ipython==9.6.0 # via # -r docs.in # ipykernel @@ -93,9 +91,9 @@ jinja2==3.1.6 # nbconvert # nbsphinx # sphinx -jsonschema==4.25.0 +jsonschema==4.25.1 # via nbformat -jsonschema-specifications==2025.4.1 +jsonschema-specifications==2025.9.1 # via jsonschema jupyter-client==8.6.3 # via @@ -118,7 +116,7 @@ markdown-it-py==3.0.0 # via # mdit-py-plugins # myst-parser -markupsafe==3.0.2 +markupsafe==3.0.3 # via # jinja2 # nbconvert @@ -126,11 +124,11 @@ matplotlib-inline==0.1.7 # via # ipykernel # ipython -mdit-py-plugins==0.4.2 +mdit-py-plugins==0.5.0 # via myst-parser mdurl==0.1.2 # via markdown-it-py -mistune==3.1.3 +mistune==3.1.4 # via nbconvert myst-parser==4.0.1 # via -r docs.in @@ -149,19 +147,19 @@ nest-asyncio==1.6.0 # via ipykernel pandocfilters==1.5.1 # via nbconvert -parso==0.8.4 +parso==0.8.5 # via jedi pexpect==4.9.0 # via ipython -platformdirs==4.3.8 +platformdirs==4.5.0 # via # jupyter-core # pooch pooch==1.8.2 # via -r docs.in -prompt-toolkit==3.0.51 +prompt-toolkit==3.0.52 # via ipython -psutil==7.0.0 +psutil==7.1.0 # via ipykernel ptyprocess==0.7.0 # via pexpect @@ -175,7 +173,7 @@ pybtex==0.25.1 # sphinxcontrib-bibtex pybtex-docutils==1.0.3 # via sphinxcontrib-bibtex -pydantic-settings==2.10.1 +pydantic-settings==2.11.0 # via autodoc-pydantic pydata-sphinx-theme==0.16.1 # via -r docs.in @@ -189,7 +187,7 @@ pygments==2.19.2 # sphinx python-dotenv==1.1.1 # via pydantic-settings -pyzmq==27.0.1 +pyzmq==27.1.0 # via # ipykernel # jupyter-client @@ -197,17 +195,17 @@ referencing==0.36.2 # via # jsonschema # jsonschema-specifications -requests==2.32.4 +requests==2.32.5 # via # pooch # sphinx -rpds-py==0.26.0 +rpds-py==0.27.1 # via # jsonschema # referencing snowballstemmer==3.0.1 # via sphinx -soupsieve==2.7 +soupsieve==2.8 # via beautifulsoup4 sphinx==8.1.3 # via @@ -244,7 +242,7 @@ stack-data==0.6.3 # via ipython tinycss2==1.4.0 # via bleach -tornado==6.5.1 +tornado==6.5.2 # via # ipykernel # jupyter-client @@ -267,7 +265,7 @@ traittypes==0.2.1 # via bqplot urllib3==2.5.0 # via requests -wcwidth==0.2.13 +wcwidth==0.2.14 # via prompt-toolkit webencodings==0.5.1 # via diff --git a/requirements/mypy.txt b/requirements/mypy.txt index a2b4de29..088d0c28 100644 --- a/requirements/mypy.txt +++ b/requirements/mypy.txt @@ -6,7 +6,7 @@ # requirements upgrade # -r test.txt -mypy==1.17.1 +mypy==1.18.2 # via -r mypy.in mypy-extensions==1.1.0 # via mypy diff --git a/requirements/nightly.in b/requirements/nightly.in index f56746af..c059abc1 100644 --- a/requirements/nightly.in +++ b/requirements/nightly.in @@ -5,7 +5,7 @@ dask>=2022.1.0 python-dateutil graphviz orsopy>=1.2 -essreduce>=25.4.0 +essreduce>=25.10.0 pandas>=2.1.2 pytest>=7.0 pooch>=1.5 diff --git a/requirements/nightly.txt b/requirements/nightly.txt index a3c0c5a7..da2dd4a0 100644 --- a/requirements/nightly.txt +++ b/requirements/nightly.txt @@ -1,4 +1,4 @@ -# SHA1:a521e061e365845bc9f865de42e02ae8ce9489b1 +# SHA1:1a580a27b9ea4e80594dfbb949f1ec2ba987e779 # # This file was generated by pip-compile-multi. # To update, run: @@ -10,11 +10,11 @@ annotated-types==0.7.0 # via pydantic -certifi==2025.8.3 +certifi==2025.10.5 # via requests -charset-normalizer==3.4.2 +charset-normalizer==3.4.3 # via requests -click==8.2.1 +click==8.3.0 # via dask cloudpickle==3.1.1 # via dask @@ -24,25 +24,25 @@ cyclebane==24.10.0 # via sciline cycler==0.12.1 # via matplotlib -dask==2025.7.0 +dask==2025.9.1 # via -r nightly.in -dnspython==2.7.0 +dnspython==2.8.0 # via email-validator -email-validator==2.2.0 +email-validator==2.3.0 # via scippneutron -essreduce==25.7.1 +essreduce==25.10.0 # via -r nightly.in -fonttools==4.59.0 +fonttools==4.60.1 # via matplotlib -fsspec==2025.7.0 +fsspec==2025.9.0 # via dask graphviz==0.21 # via -r nightly.in -h5py==3.14.0 +h5py==3.15.0 # via # scippneutron # scippnexus -idna==3.10 +idna==3.11 # via # email-validator # requests @@ -50,7 +50,7 @@ importlib-metadata==8.7.0 # via dask iniconfig==2.1.0 # via pytest -kiwisolver==1.4.8 +kiwisolver==1.4.10rc0 # via matplotlib lazy-loader==0.4 # via @@ -58,15 +58,15 @@ lazy-loader==0.4 # scippneutron locket==1.0.0 # via partd -matplotlib==3.10.5 +matplotlib==3.10.7 # via # mpltoolbox # plopp -mpltoolbox==25.5.0 +mpltoolbox==25.10.0 # via scippneutron networkx==3.5 # via cyclebane -numpy==2.3.2 +numpy==2.3.3 # via # contourpy # h5py @@ -84,13 +84,13 @@ packaging==25.0 # matplotlib # pooch # pytest -pandas==2.3.1 +pandas==2.3.3 # via -r nightly.in partd==1.4.2 # via dask pillow==11.3.0 # via matplotlib -platformdirs==4.3.8 +platformdirs==4.5.0 # via pooch plopp @ git+https://github.com/scipp/plopp@main # via @@ -100,15 +100,15 @@ pluggy==1.6.0 # via pytest pooch==1.8.2 # via -r nightly.in -pydantic==2.12.0a1 +pydantic==2.12.0 # via scippneutron -pydantic-core==2.37.2 +pydantic-core==2.41.1 # via pydantic pygments==2.19.2 # via pytest -pyparsing==3.2.3 +pyparsing==3.3.0a1 # via matplotlib -pytest==8.4.1 +pytest==8.4.2 # via -r nightly.in python-dateutil==2.9.0.post0 # via @@ -118,11 +118,11 @@ python-dateutil==2.9.0.post0 # scippneutron pytz==2025.2 # via pandas -pyyaml==6.0.2 +pyyaml==6.0.3 # via # dask # orsopy -requests==2.32.4 +requests==2.32.5 # via pooch sciline @ git+https://github.com/scipp/sciline@main # via @@ -143,7 +143,7 @@ scippnexus @ git+https://github.com/scipp/scippnexus@main # -r nightly.in # essreduce # scippneutron -scipy==1.16.1 +scipy==1.16.2 # via # scippneutron # scippnexus @@ -153,13 +153,13 @@ toolz==1.0.0 # via # dask # partd -typing-extensions==4.14.1 +typing-extensions==4.15.0 # via # pydantic # pydantic-core # sciline # typing-inspection -typing-inspection==0.4.1 +typing-inspection==0.4.2 # via pydantic tzdata==2025.2 # via pandas diff --git a/requirements/static.txt b/requirements/static.txt index 3e288557..aec8f4c8 100644 --- a/requirements/static.txt +++ b/requirements/static.txt @@ -9,17 +9,17 @@ cfgv==3.4.0 # via pre-commit distlib==0.4.0 # via virtualenv -filelock==3.18.0 +filelock==3.20.0 # via virtualenv -identify==2.6.12 +identify==2.6.15 # via pre-commit nodeenv==1.9.1 # via pre-commit -platformdirs==4.3.8 +platformdirs==4.5.0 # via virtualenv -pre-commit==4.2.0 +pre-commit==4.3.0 # via -r static.in -pyyaml==6.0.2 +pyyaml==6.0.3 # via pre-commit -virtualenv==20.33.1 +virtualenv==20.35.3 # via pre-commit diff --git a/src/ess/amor/data.py b/src/ess/amor/data.py index 0c21e715..ad5a3e84 100644 --- a/src/ess/amor/data.py +++ b/src/ess/amor/data.py @@ -1,101 +1,93 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2025 Scipp contributors (https://github.com/scipp) import re - -_version = "2" - - -def _make_pooch(): - import pooch - - return pooch.create( - path=pooch.os_cache("ess/amor"), - env="ESS_AMOR_DATA_DIR", - base_url="https://public.esss.dk/groups/scipp/ess/amor/{version}/", - version=_version, - retry_if_failed=3, - registry={ - "reference.nxs": "md5:56d493c8051e1c5c86fb7a95f8ec643b", - "sample.nxs": "md5:4e07ccc87b5c6549e190bc372c298e83", - # Amor NeXus files - # 608 to 611 are measurements on the same sample at different - # sample rotations. - # 612 and 613 are unknown to me. - # 614 is a reference measurement on a super mirror. - # The sample rotation values written in the files are wrong, - # the real values are the following (all expressed in deg): - # 608: 0.85, - # 609: 2.25, - # 610: 3.65, - # 611: 5.05, - # 612: 0.65, - # 613: 0.65, - # 614: 0.65, - # The chopper phase offset value written in the files is wrong - # the real value is -7.5 deg - "amor2023n000608.hdf": "md5:e3a8b5b8495bb9ab2173848096df49d6", - "amor2023n000609.hdf": "md5:d899d65f684cade2905f203f7d0fb326", - "amor2023n000610.hdf": "md5:c9367d49079edcd17fa0b98e33326b05", - "amor2023n000611.hdf": "md5:9da41177269faac0d936806393427837", - "amor2023n000612.hdf": "md5:602f1bfcdbc1f618133c93a117d05f12", - "amor2023n000613.hdf": "md5:ba0fbcbf0b45756a269eb3e943371ced", - "amor2023n000614.hdf": "md5:18e8a755d6fd671758fe726de058e707", - # Reflectivity curves obtained by applying Jochens Amor - # software @ https://github.com/jochenstahn/amor.git - # (repo commit hash 05e35ca4e05436d7c69ff6e19f32bc1915cbb5d0). - # to the above files. - "608.Rqz.ort": "md5:e7e7d63a1ac1e727e9b2f12dc78a77ce", - "609.Rqz.ort": "md5:3cb3fd11a743594f52a10f71b122b71a", - "610.Rqz.ort": "md5:66d43993e76801655a1d629cb976abde", - "611.Rqz.ort": "md5:0c51e8ac5c00041434417673be186151", - "612.Rqz.ort": "md5:d785d27151e7f1edc05e86d35bef6a63", - "613.Rqz.ort": "md5:e999c85f7a47665c4ddd1538b19d402d", - "amor2024n001632.hdf": "md5:2253f0ec6d2e96a986a6aa35d43a7480", - "amor2024n001634.hdf": "md5:7cdd87bbd96fb3fb1e046800a9b1d77e", - "amor2024n001635.hdf": "md5:fb9eb0e7b803c13f1804d085b3b0058f", - "amor2024n001636.hdf": "md5:f7deb51d22652d1f5d0e4b51927af5a3", - "amor2024n001637.hdf": "md5:06e5957d34d82035cfece40cbbf47d7a", - "amor2024n001638.hdf": "md5:1193fe808af2afeb0f48d3b0022fe40b", - "amor2024n001639.hdf": "md5:ff24e31a07c4020927aaa6df9f2ee05f", - "amor2024n001640.hdf": "md5:051335fea1c369322a2328d530dedb77", - "amor2024n001641.hdf": "md5:d543b5890b63707cf8d7f6666e8830a4", - "amor2024n001642.hdf": "md5:b1474e32cc64371e1005f44f2c5b6ae7", - "amor2024n004079.hdf": "md5:5bf1dabc2ff902a57ed7593903c8e1a5", - "amor2024n004080.hdf": "md5:7dcaa5da00b7eedc178b9e55209bfbce", - "amor2024n004081.hdf": "md5:2f4f46f0e56ab75aad0c2933060df504", - "amor2024n004083.hdf": "md5:ffd13420e44cbf966b94bd532e293c1c", - "amor2024n004084.hdf": "md5:5041a9486b3cd6407a9b9f44104c9b54", - "amor2024n004085.hdf": "md5:152ac63bad6f3b2b5cf1c4e4c7df5e30", - "amor2024n004152.hdf": "md5:244459be7a3caeac523c289815c5b7dc", - "amor2024n004154.hdf": "md5:6184553f795fd2b230baab9a421da9e4", - }, - ) - - -_pooch = _make_pooch() - - -def amor_old_sample_run() -> str: - return _pooch.fetch("sample.nxs") - - -def amor_old_reference_run() -> str: - return _pooch.fetch("reference.nxs") - - -def amor_run(number: int | str) -> str: +from pathlib import Path + +from ess.reduce.data import make_registry + +_files = { + "reference.nxs": "md5:56d493c8051e1c5c86fb7a95f8ec643b", + "sample.nxs": "md5:4e07ccc87b5c6549e190bc372c298e83", + # Amor NeXus files + # 608 to 611 are measurements on the same sample at different + # sample rotations. + # 612 and 613 are unknown to me. + # 614 is a reference measurement on a super mirror. + # The sample rotation values written in the files are wrong, + # the real values are the following (all expressed in deg): + # 608: 0.85, + # 609: 2.25, + # 610: 3.65, + # 611: 5.05, + # 612: 0.65, + # 613: 0.65, + # 614: 0.65, + # The chopper phase offset value written in the files is wrong + # the real value is -7.5 deg + "amor2023n000608.hdf": "md5:e3a8b5b8495bb9ab2173848096df49d6", + "amor2023n000609.hdf": "md5:d899d65f684cade2905f203f7d0fb326", + "amor2023n000610.hdf": "md5:c9367d49079edcd17fa0b98e33326b05", + "amor2023n000611.hdf": "md5:9da41177269faac0d936806393427837", + "amor2023n000612.hdf": "md5:602f1bfcdbc1f618133c93a117d05f12", + "amor2023n000613.hdf": "md5:ba0fbcbf0b45756a269eb3e943371ced", + "amor2023n000614.hdf": "md5:18e8a755d6fd671758fe726de058e707", + # Reflectivity curves obtained by applying Jochens Amor + # software @ https://github.com/jochenstahn/amor.git + # (repo commit hash 05e35ca4e05436d7c69ff6e19f32bc1915cbb5d0). + # to the above files. + "608.Rqz.ort": "md5:e7e7d63a1ac1e727e9b2f12dc78a77ce", + "609.Rqz.ort": "md5:3cb3fd11a743594f52a10f71b122b71a", + "610.Rqz.ort": "md5:66d43993e76801655a1d629cb976abde", + "611.Rqz.ort": "md5:0c51e8ac5c00041434417673be186151", + "612.Rqz.ort": "md5:d785d27151e7f1edc05e86d35bef6a63", + "613.Rqz.ort": "md5:e999c85f7a47665c4ddd1538b19d402d", + "amor2024n001632.hdf": "md5:2253f0ec6d2e96a986a6aa35d43a7480", + "amor2024n001634.hdf": "md5:7cdd87bbd96fb3fb1e046800a9b1d77e", + "amor2024n001635.hdf": "md5:fb9eb0e7b803c13f1804d085b3b0058f", + "amor2024n001636.hdf": "md5:f7deb51d22652d1f5d0e4b51927af5a3", + "amor2024n001637.hdf": "md5:06e5957d34d82035cfece40cbbf47d7a", + "amor2024n001638.hdf": "md5:1193fe808af2afeb0f48d3b0022fe40b", + "amor2024n001639.hdf": "md5:ff24e31a07c4020927aaa6df9f2ee05f", + "amor2024n001640.hdf": "md5:051335fea1c369322a2328d530dedb77", + "amor2024n001641.hdf": "md5:d543b5890b63707cf8d7f6666e8830a4", + "amor2024n001642.hdf": "md5:b1474e32cc64371e1005f44f2c5b6ae7", + "amor2024n004079.hdf": "md5:5bf1dabc2ff902a57ed7593903c8e1a5", + "amor2024n004080.hdf": "md5:7dcaa5da00b7eedc178b9e55209bfbce", + "amor2024n004081.hdf": "md5:2f4f46f0e56ab75aad0c2933060df504", + "amor2024n004083.hdf": "md5:ffd13420e44cbf966b94bd532e293c1c", + "amor2024n004084.hdf": "md5:5041a9486b3cd6407a9b9f44104c9b54", + "amor2024n004085.hdf": "md5:152ac63bad6f3b2b5cf1c4e4c7df5e30", + "amor2024n004152.hdf": "md5:244459be7a3caeac523c289815c5b7dc", + "amor2024n004154.hdf": "md5:6184553f795fd2b230baab9a421da9e4", +} +_registry = make_registry( + "ess/amor", + version="2", + files=_files, +) + + +def amor_old_sample_run() -> Path: + return _registry.get_path("sample.nxs") + + +def amor_old_reference_run() -> Path: + return _registry.get_path("reference.nxs") + + +def amor_run(number: int | str) -> Path: fnames = [ name - for name in _pooch.registry.keys() + for name in _files.keys() if re.match(f'amor\\d{{4}}n{int(number):06d}.hdf', name) ] if len(fnames) != 1: raise ValueError(f'Expected exactly one matching file, found {len(fnames)}') - return _pooch.fetch(fnames[0]) + return _registry.get_path(fnames[0]) -def amor_psi_software_result(number: int | str) -> str: - return _pooch.fetch(f"{int(number):03d}.Rqz.ort") +def amor_psi_software_result(number: int | str) -> Path: + return _registry.get_path(f"{int(number):03d}.Rqz.ort") __all__ = [ diff --git a/src/ess/estia/data.py b/src/ess/estia/data.py index b9e5a575..16ae9846 100644 --- a/src/ess/estia/data.py +++ b/src/ess/estia/data.py @@ -1,79 +1,79 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2025 Scipp contributors (https://github.com/scipp) + import scipp as sc -from ..reflectometry.types import Filename, ReferenceRun, SampleRun - -_version = "1" - - -def _make_pooch(): - import pooch - - return pooch.create( - path=pooch.os_cache("ess/estia"), - env="ESS_ESTIA_DATA_DIR", - base_url="https://public.esss.dk/groups/scipp/ess/estia/{version}/", - version=_version, - retry_if_failed=3, - registry={ - "218610_tof_detector_list.p.x.y.t.L.sx.sy": "md5:65145a26c36d12954a97d27d6e7f4ed9", # noqa: E501 - "218611_tof_detector_list.p.x.y.t.L.sx.sy": "md5:4599e938568f3b73a72d6d48fe5160e7", # noqa: E501 - "218612_tof_detector_list.p.x.y.t.L.sx.sy": "md5:6bacd1e4d922007c7f574f20378b28f2", # noqa: E501 - "218613_tof_detector_list.p.x.y.t.L.sx.sy": "md5:7c17cb8a2fe38f4f0976de1254295636", # noqa: E501 - "218614_tof_detector_list.p.x.y.t.L.sx.sy": "md5:78cf399dcedea2a2d4178e11b95c53f2", # noqa: E501 - # McStas runs for the samples in the Estia McStas model at various angles - "examples/220573/mccode.h5": "md5:2f1ba298bd8a1a67082a41d2c3957fc7", - "examples/220574/mccode.h5": "md5:ecfcf72e936dd5345c1aededa7e9388b", - "examples/220575/mccode.h5": "md5:efb206cf7cf87bf587bca31dca5da39d", - "examples/220576/mccode.h5": "md5:f63664809a15331d055ab9746f7f7259", - "examples/220577/mccode.h5": "md5:e0915c1271ae1800deba7e8c4b7cbf3e", - "examples/220578/mccode.h5": "md5:c456c1bf7e30c09d3ab36f0a87721d49", - "examples/220579/mccode.h5": "md5:3fd9ce4eab6c54346ce7086055695552", - "examples/220580/mccode.h5": "md5:36ff5b178fef6eb5f3be97089c493574", - "examples/220581/mccode.h5": "md5:736aa90d3570a104ab1ca0f4090ea94e", - "examples/220582/mccode.h5": "md5:d01a1fa2e98f0086b3bc0e5dbc323bde", - "examples/220583/mccode.h5": "md5:4f243df1b2dac2cf6da408ee6afb9a37", - "examples/220584/mccode.h5": "md5:5d82b18156c3675a986ec2c02d96a45c", - "examples/220585/mccode.h5": "md5:09540bd8ccea696232b1fdaac978cb29", - # Ground truth reflectivity curves - "examples/NiTiML.ref": "md5:9769b884dfa09d34b6ae449b640463a1", - "examples/Si-SiO2.ref": "md5:436e2312e137b63bf31cc39064d28864", - "examples/Si-Ni.ref": "md5:76fcfc655635086060387163c9175ab4", - }, - ) +from ess.reduce.data import make_registry +from ..reflectometry.types import Filename, ReferenceRun, SampleRun -_pooch = _make_pooch() +_registry = make_registry( + "ess/estia", + version="1", + files={ + "218610_tof_detector_list.p.x.y.t.L.sx.sy": "md5:65145a26c36d12954a97d27d6e7f4ed9", # noqa: E501 + "218611_tof_detector_list.p.x.y.t.L.sx.sy": "md5:4599e938568f3b73a72d6d48fe5160e7", # noqa: E501 + "218612_tof_detector_list.p.x.y.t.L.sx.sy": "md5:6bacd1e4d922007c7f574f20378b28f2", # noqa: E501 + "218613_tof_detector_list.p.x.y.t.L.sx.sy": "md5:7c17cb8a2fe38f4f0976de1254295636", # noqa: E501 + "218614_tof_detector_list.p.x.y.t.L.sx.sy": "md5:78cf399dcedea2a2d4178e11b95c53f2", # noqa: E501 + # McStas runs for the samples in the Estia McStas model at various angles + "examples/220573/mccode.h5": "md5:2f1ba298bd8a1a67082a41d2c3957fc7", + "examples/220574/mccode.h5": "md5:ecfcf72e936dd5345c1aededa7e9388b", + "examples/220575/mccode.h5": "md5:efb206cf7cf87bf587bca31dca5da39d", + "examples/220576/mccode.h5": "md5:f63664809a15331d055ab9746f7f7259", + "examples/220577/mccode.h5": "md5:e0915c1271ae1800deba7e8c4b7cbf3e", + "examples/220578/mccode.h5": "md5:c456c1bf7e30c09d3ab36f0a87721d49", + "examples/220579/mccode.h5": "md5:3fd9ce4eab6c54346ce7086055695552", + "examples/220580/mccode.h5": "md5:36ff5b178fef6eb5f3be97089c493574", + "examples/220581/mccode.h5": "md5:736aa90d3570a104ab1ca0f4090ea94e", + "examples/220582/mccode.h5": "md5:d01a1fa2e98f0086b3bc0e5dbc323bde", + "examples/220583/mccode.h5": "md5:4f243df1b2dac2cf6da408ee6afb9a37", + "examples/220584/mccode.h5": "md5:5d82b18156c3675a986ec2c02d96a45c", + "examples/220585/mccode.h5": "md5:09540bd8ccea696232b1fdaac978cb29", + # Ground truth reflectivity curves + "examples/NiTiML.ref": "md5:9769b884dfa09d34b6ae449b640463a1", + "examples/Si-SiO2.ref": "md5:436e2312e137b63bf31cc39064d28864", + "examples/Si-Ni.ref": "md5:76fcfc655635086060387163c9175ab4", + }, +) def estia_mcstas_reference_run() -> Filename[ReferenceRun]: return Filename[ReferenceRun]( - _pooch.fetch("218610_tof_detector_list.p.x.y.t.L.sx.sy") + _registry.get_path("218610_tof_detector_list.p.x.y.t.L.sx.sy") ) def estia_mcstas_sample_run(number: int | str) -> Filename[SampleRun]: return Filename[SampleRun]( - _pooch.fetch(f"2186{int(number):02d}_tof_detector_list.p.x.y.t.L.sx.sy") + _registry.get_path(f"2186{int(number):02d}_tof_detector_list.p.x.y.t.L.sx.sy") ) def estia_mcstas_example(name): """Returns a list of McStas files associated with the sample.""" if name == 'reference': - return _pooch.fetch("examples/220573/mccode.h5") + return _registry.get_path("examples/220573/mccode.h5") elif name == 'Ni/Ti-multilayer': return list( - map(_pooch.fetch, [f"examples/2205{i}/mccode.h5" for i in range(74, 78)]) + map( + _registry.get_path, + [f"examples/2205{i}/mccode.h5" for i in range(74, 78)], + ) ) elif name == 'Ni-film on silicon': return list( - map(_pooch.fetch, [f"examples/2205{i}/mccode.h5" for i in range(78, 82)]) + map( + _registry.get_path, + [f"examples/2205{i}/mccode.h5" for i in range(78, 82)], + ) ) elif name == 'Natural SiO2 on silicon': return list( - map(_pooch.fetch, [f"examples/2205{i}/mccode.h5" for i in range(82, 86)]) + map( + _registry.get_path, + [f"examples/2205{i}/mccode.h5" for i in range(82, 86)], + ) ) raise ValueError(f'"{name}" is not a valid sample name') @@ -95,11 +95,11 @@ def parse(fname): ) if name == 'Ni/Ti-multilayer': - return parse(_pooch.fetch("examples/NiTiML.ref")) + return parse(_registry.get_path("examples/NiTiML.ref")) elif name == 'Ni-film on silicon': - return parse(_pooch.fetch("examples/Si-Ni.ref")) + return parse(_registry.get_path("examples/Si-Ni.ref")) elif name == 'Natural SiO2 on silicon': - return parse(_pooch.fetch("examples/Si-SiO2.ref")) + return parse(_registry.get_path("examples/Si-SiO2.ref")) raise ValueError(f'"{name}" is not a valid sample name') diff --git a/src/ess/offspec/data.py b/src/ess/offspec/data.py index b90aa368..f3c15cf2 100644 --- a/src/ess/offspec/data.py +++ b/src/ess/offspec/data.py @@ -1,34 +1,25 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2025 Scipp contributors (https://github.com/scipp) -from ..reflectometry.types import Filename, ReferenceRun, SampleRun - -_version = "1" - - -def _make_pooch(): - import pooch - - return pooch.create( - path=pooch.os_cache("ess/offspec"), - env="ESS_AMOR_DATA_DIR", - base_url="https://public.esss.dk/groups/scipp/ess/offspec/{version}/", - version=_version, - registry={ - "sample.h5": "md5:02b8703230b6b1e6282c0d39eb94523c", - "direct_beam.h5": "md5:1c4e56afbd35edd96c7607e357981ccf", - }, - ) +from ess.reduce.data import make_registry +from ..reflectometry.types import Filename, ReferenceRun, SampleRun -_pooch = _make_pooch() +_registry = make_registry( + "ess/offspec", + version="1", + files={ + "sample.h5": "md5:02b8703230b6b1e6282c0d39eb94523c", + "direct_beam.h5": "md5:1c4e56afbd35edd96c7607e357981ccf", + }, +) def offspec_sample_run() -> Filename[SampleRun]: - return Filename[SampleRun](_pooch.fetch("sample.h5")) + return Filename[SampleRun](_registry.get_path("sample.h5")) def offspec_direct_beam_run() -> Filename[ReferenceRun]: - return Filename[ReferenceRun](_pooch.fetch("direct_beam.h5")) + return Filename[ReferenceRun](_registry.get_path("direct_beam.h5")) __all__ = [ diff --git a/src/ess/reflectometry/load.py b/src/ess/reflectometry/load.py index 9c5d17f9..fd0d8829 100644 --- a/src/ess/reflectometry/load.py +++ b/src/ess/reflectometry/load.py @@ -1,27 +1,28 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2024 Scipp contributors (https://github.com/scipp) +from pathlib import Path + import h5py import sciline import scipp as sc import scippnexus as snx +# This should be made public in ESSreduce: +from ess.reduce.nexus._nexus_loader import open_nexus_file + from .types import ReducedReference, ReferenceFilePath -def load_nx(group: snx.Group | str, *paths: str): - if isinstance(group, str): - with snx.File(group) as group: - yield from load_nx(group, *paths) - return - for path in paths: - g = group - for p in path.strip('/').split('/'): - g = ( - _unique_child_group(g, getattr(snx, p)) - if p.startswith('NX') - else g.get(p) - ) - yield g[...] if g is not None else None +def load_nx(group: snx.Group | str | Path, *paths: str): + with open_nexus_file(group) as g: + for path in paths: + for p in path.strip('/').split('/'): + g = ( + _unique_child_group(g, getattr(snx, p)) + if p.startswith('NX') + else g.get(p) + ) + yield g[...] if g is not None else None # Remove when this function is exposed in essreduce