diff --git a/.copier-answers.yml b/.copier-answers.yml index de550ae1..1799bcae 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY -_commit: 86a1e5c +_commit: 75b9a8f _src_path: gh:scipp/copier_template description: Diffraction data reduction for the European Spallation Source max_python: '3.12' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8234bc9f..356700a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: - uses: pre-commit/action@v3.0.1 with: extra_args: --all-files - - uses: pre-commit-ci/lite-action@v1.0.2 + - uses: pre-commit-ci/lite-action@v1.0.3 if: always() with: msg: Apply automatic formatting diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a5ea2b05..c6a413ea 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -69,7 +69,7 @@ jobs: name: docs_html path: html/ - - uses: JamesIves/github-pages-deploy-action@v4.6.3 + - uses: JamesIves/github-pages-deploy-action@v4.6.4 if: ${{ inputs.publish }} with: branch: gh-pages diff --git a/.gitignore b/.gitignore index 46c5ae85..cc2a0f8d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,11 +4,13 @@ dist html .tox *.egg-info +uv.lock # we lock dependencies with pip-compile, not uv *.sw? # Environments venv +.venv # Caches .clangd/ @@ -39,3 +41,4 @@ docs/generated/ *.cif *.rcif *.ort +*.zip diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4442b1b9..e0c499ee 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: check-added-large-files - id: check-json @@ -14,14 +14,14 @@ repos: args: [ --markdown-linebreak-ext=md ] exclude: '\.svg' - repo: https://github.com/kynan/nbstripout - rev: 0.6.0 + rev: 0.7.1 hooks: - id: nbstripout types: [ "jupyter" ] args: [ "--drop-empty-cells", "--extra-keys 'metadata.language_info.version cell.metadata.jp-MarkdownHeadingCollapsed cell.metadata.pycharm'" ] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.3 + rev: v0.6.2 hooks: - id: ruff args: [ --fix ] @@ -29,7 +29,7 @@ repos: - id: ruff-format types_or: [ python, pyi ] - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.3.0 hooks: - id: codespell additional_dependencies: diff --git a/.python-version b/.python-version new file mode 100644 index 00000000..c8cfe395 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.10 diff --git a/conda/meta.yaml b/conda/meta.yaml index 39a7a305..e9c2551a 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -9,6 +9,7 @@ source: {% set pyproject = load_file_data('pyproject.toml') %} {% set dependencies = pyproject.get('project', {}).get('dependencies', {}) %} +{% set test_dependencies = pyproject.get('project', {}).get('optional-dependencies', {}).get('test', {}) %} requirements: @@ -28,7 +29,13 @@ test: imports: - ess.diffraction requires: - - pytest + + {# Conda does not allow spaces between package name and version, so remove them #} + {% for package in test_dependencies %} + - {% if package == "graphviz" %}python-graphviz{% else %}{{ package|replace(" ", "") }}{% endif %} + {% endfor %} + + source_files: - pyproject.toml - tests/ diff --git a/docs/api-reference/index.md b/docs/api-reference/index.md index ccf9f5e1..9aa4cbde 100644 --- a/docs/api-reference/index.md +++ b/docs/api-reference/index.md @@ -27,7 +27,6 @@ grouping smoothing types - uncertainty ``` ## ESSdream diff --git a/docs/conf.py b/docs/conf.py index e444fb4e..1f1ee3ef 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2024 Scipp contributors (https://github.com/scipp) + import doctest import os import sys diff --git a/docs/user-guide/dream/dream-data-reduction.ipynb b/docs/user-guide/dream/dream-data-reduction.ipynb index 00a6e3d4..9e4aada3 100644 --- a/docs/user-guide/dream/dream-data-reduction.ipynb +++ b/docs/user-guide/dream/dream-data-reduction.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "f47beab6-47c9-4cfb-a70e-c00bc8daebef", + "id": "0", "metadata": {}, "source": [ "# DREAM data reduction\n", @@ -15,7 +15,7 @@ { "cell_type": "code", "execution_count": null, - "id": "74b2df0c-6957-40c2-a48e-a4351547e87a", + "id": "1", "metadata": {}, "outputs": [], "source": [ @@ -30,7 +30,7 @@ }, { "cell_type": "markdown", - "id": "dcaf1d53-2a81-4a31-8379-1fb3791aaeab", + "id": "2", "metadata": {}, "source": [ "## Create and configure the workflow\n", @@ -41,7 +41,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b2d15f12-69d7-4c5d-9d4d-f1c13fc29103", + "id": "3", "metadata": {}, "outputs": [], "source": [ @@ -50,7 +50,7 @@ }, { "cell_type": "markdown", - "id": "1252feab-12d2-46ac-bf74-70b32344473d", + "id": "4", "metadata": {}, "source": [ "We then need to set the missing parameters which are specific to each experiment\n", @@ -60,7 +60,7 @@ { "cell_type": "code", "execution_count": null, - "id": "502e77cc-0253-4e71-9d97-81ff560ef99d", + "id": "5", "metadata": {}, "outputs": [], "source": [ @@ -85,7 +85,7 @@ }, { "cell_type": "markdown", - "id": "21fb4492-e836-41d3-a2d4-9678df43b9f9", + "id": "6", "metadata": {}, "source": [ "## Use the workflow\n", @@ -96,7 +96,7 @@ { "cell_type": "code", "execution_count": null, - "id": "93f2ba0d-f256-4b64-b8fa-42cd1081cc41", + "id": "7", "metadata": {}, "outputs": [], "source": [ @@ -105,7 +105,7 @@ }, { "cell_type": "markdown", - "id": "478f580e-273c-4a46-8dfc-9a2ed31b0cd3", + "id": "8", "metadata": {}, "source": [ "We then call `compute()` to compute the result:" @@ -114,7 +114,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6a17cf1d-0407-41dd-8a84-0975371ac70a", + "id": "9", "metadata": {}, "outputs": [], "source": [ @@ -125,7 +125,7 @@ { "cell_type": "code", "execution_count": null, - "id": "527623d2-0eee-456d-a4dd-764df8618ee4", + "id": "10", "metadata": {}, "outputs": [], "source": [ @@ -135,7 +135,7 @@ }, { "cell_type": "markdown", - "id": "39dc0ea3-b30d-4a88-878c-86cf0e8e76e9", + "id": "11", "metadata": {}, "source": [ "We can now save the result to disk:" @@ -144,7 +144,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f37eba41-6178-4bcb-bf3c-fa177e6112b0", + "id": "12", "metadata": {}, "outputs": [], "source": [ @@ -156,7 +156,7 @@ }, { "cell_type": "markdown", - "id": "0898265e-7edd-4093-9dfb-6e6b2f05c766", + "id": "13", "metadata": {}, "source": [ "## Compute intermediate results\n", @@ -169,7 +169,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4bd5a7d5-581f-4d04-bf11-955e55646199", + "id": "14", "metadata": {}, "outputs": [], "source": [ @@ -186,7 +186,7 @@ { "cell_type": "code", "execution_count": null, - "id": "185cb6ee-8e55-43d0-9505-ebe2761785ed", + "id": "15", "metadata": {}, "outputs": [], "source": [ @@ -198,7 +198,7 @@ }, { "cell_type": "markdown", - "id": "7f866ad4-5a0d-4c98-b5ab-a2436f97074d", + "id": "16", "metadata": {}, "source": [ "## Grouping by scattering angle\n", @@ -210,7 +210,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bc516311-1ab4-4eb7-9a0b-d83ff61e036b", + "id": "17", "metadata": {}, "outputs": [], "source": [ @@ -222,7 +222,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b19ab368-e0c4-4a03-ac20-61a442e8826e", + "id": "18", "metadata": {}, "outputs": [], "source": [ @@ -233,7 +233,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fc25ee9c-9395-481f-bd31-3ad139859686", + "id": "19", "metadata": {}, "outputs": [], "source": [ @@ -251,7 +251,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6e414419-ccf4-420b-899d-a1fa4a6ce4ca", + "id": "20", "metadata": {}, "outputs": [], "source": [ diff --git a/docs/user-guide/dream/dream-instrument-view.ipynb b/docs/user-guide/dream/dream-instrument-view.ipynb index eb792111..0241d6db 100644 --- a/docs/user-guide/dream/dream-instrument-view.ipynb +++ b/docs/user-guide/dream/dream-instrument-view.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "4852fe41-3f9a-4cdb-8aba-ff7c7f198e6c", + "id": "0", "metadata": {}, "source": [ "# DREAM instrument view\n", @@ -20,7 +20,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3f416595-83b4-44d1-b506-9ba73bf0786e", + "id": "1", "metadata": {}, "outputs": [], "source": [ @@ -31,7 +31,7 @@ }, { "cell_type": "markdown", - "id": "228a23dc-17f2-4273-a4c9-3e3276db8c54", + "id": "2", "metadata": {}, "source": [ "## Load the data\n", @@ -44,7 +44,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1ef8f35b-815f-436a-80e5-cbe4b3172b58", + "id": "3", "metadata": {}, "outputs": [], "source": [ @@ -59,7 +59,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e8325797-5651-43c1-b601-3db6d4348758", + "id": "4", "metadata": { "editable": true, "nbsphinx": "hidden", @@ -76,7 +76,7 @@ }, { "cell_type": "markdown", - "id": "49595486-ab4e-4662-86f7-d301aedcf974", + "id": "5", "metadata": { "editable": true, "slideshow": { @@ -94,7 +94,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e85a8364-e0a1-4c10-8cae-c873f297e651", + "id": "6", "metadata": { "editable": true, "slideshow": { @@ -110,7 +110,7 @@ }, { "cell_type": "markdown", - "id": "d08ca911-b1a4-4f17-ba1e-355971531ffe", + "id": "7", "metadata": { "editable": true, "slideshow": { @@ -126,7 +126,7 @@ { "cell_type": "code", "execution_count": null, - "id": "43f9ffbc-6bf5-4407-b3ad-5d1626efc43d", + "id": "8", "metadata": { "editable": true, "slideshow": { @@ -143,7 +143,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a7030d56-a375-47b5-898c-28fd06c2f361", + "id": "9", "metadata": { "editable": true, "nbsphinx": "hidden", @@ -159,7 +159,7 @@ }, { "cell_type": "markdown", - "id": "c0b29ebf-21ff-4385-bf8b-0e4fa14dfaf9", + "id": "10", "metadata": { "editable": true, "slideshow": { @@ -178,7 +178,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b417011e-0d12-4287-91d5-c1fb6ecc7cac", + "id": "11", "metadata": { "editable": true, "slideshow": { @@ -195,7 +195,7 @@ { "cell_type": "code", "execution_count": null, - "id": "299ec404-fb18-4533-ad96-e23bf8ba24d6", + "id": "12", "metadata": { "editable": true, "nbsphinx": "hidden", @@ -211,7 +211,7 @@ }, { "cell_type": "markdown", - "id": "1df1aa56-5251-4555-a4f4-283145747198", + "id": "13", "metadata": {}, "source": [ "The instrument view is designed to be flexible in terms of what it accepts as input.\n", @@ -223,7 +223,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0c86e491-3564-498d-9232-39485f5b95d7", + "id": "14", "metadata": {}, "outputs": [], "source": [ diff --git a/docs/user-guide/sns-instruments/POWGEN_data_reduction.ipynb b/docs/user-guide/sns-instruments/POWGEN_data_reduction.ipynb index 7864fe09..4a7e8aff 100644 --- a/docs/user-guide/sns-instruments/POWGEN_data_reduction.ipynb +++ b/docs/user-guide/sns-instruments/POWGEN_data_reduction.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "936a13e1-c9ea-4351-b29d-7dae9ad1e073", + "id": "0", "metadata": {}, "source": [ "# POWGEN data reduction\n", @@ -20,7 +20,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b160f394-de0b-4b73-9aa5-c13ac3a1d707", + "id": "1", "metadata": {}, "outputs": [], "source": [ @@ -36,7 +36,7 @@ }, { "cell_type": "markdown", - "id": "aa6d0805-0c8b-43a6-a7ba-d4d4941def62", + "id": "2", "metadata": {}, "source": [ "## Create and configure the workflow\n", @@ -47,7 +47,7 @@ { "cell_type": "code", "execution_count": null, - "id": "82926a06-ce84-4cba-9487-b248489d7799", + "id": "3", "metadata": {}, "outputs": [], "source": [ @@ -56,7 +56,7 @@ }, { "cell_type": "markdown", - "id": "96ab84f4-cab5-44c4-ad50-44c457abdb87", + "id": "4", "metadata": {}, "source": [ "We then need to set the missing parameters which are specific to each experiment\n", @@ -66,7 +66,7 @@ { "cell_type": "code", "execution_count": null, - "id": "67e8d584-016d-422e-add9-a61e5b1fe8bd", + "id": "5", "metadata": {}, "outputs": [], "source": [ @@ -89,7 +89,7 @@ }, { "cell_type": "markdown", - "id": "b4af9055-385d-41a4-9f1c-35fd1e232565", + "id": "6", "metadata": {}, "source": [ "## Use the workflow\n", @@ -102,7 +102,7 @@ { "cell_type": "code", "execution_count": null, - "id": "abbe5682-372a-4a95-9da6-8cb91894c709", + "id": "7", "metadata": {}, "outputs": [], "source": [ @@ -112,7 +112,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d3069da8-de3c-4cc3-bd14-ff8fcbf58e91", + "id": "8", "metadata": {}, "outputs": [], "source": [ @@ -121,7 +121,7 @@ }, { "cell_type": "markdown", - "id": "a3177aeb-51ae-4166-907b-1caa9cf751aa", + "id": "9", "metadata": {}, "source": [ "Now we compute the result:" @@ -130,7 +130,7 @@ { "cell_type": "code", "execution_count": null, - "id": "14663b68-c9b8-444a-bf06-7454b67f8d82", + "id": "10", "metadata": {}, "outputs": [], "source": [ @@ -141,7 +141,7 @@ { "cell_type": "code", "execution_count": null, - "id": "94792ed7-cfba-4467-9b5e-91211c5f2d89", + "id": "11", "metadata": {}, "outputs": [], "source": [ @@ -151,7 +151,7 @@ }, { "cell_type": "markdown", - "id": "6335d026-d526-4ad4-bcda-7270e955d2c1", + "id": "12", "metadata": {}, "source": [ "### Save reduced data to file\n", @@ -167,7 +167,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2ad43ee3-5fe2-4891-b439-4ef1b2204d59", + "id": "13", "metadata": {}, "outputs": [], "source": [ @@ -182,7 +182,7 @@ }, { "cell_type": "markdown", - "id": "c7f3b9c9-8d6c-4c22-bf56-10f042414d55", + "id": "14", "metadata": {}, "source": [ "Insert a new parameter to set the file name.\n", @@ -192,7 +192,7 @@ { "cell_type": "code", "execution_count": null, - "id": "afdee1fc-abe9-40e8-bae9-cc56e7896fc8", + "id": "15", "metadata": {}, "outputs": [], "source": [ @@ -201,7 +201,7 @@ }, { "cell_type": "markdown", - "id": "1eb08353-2bbd-4692-9f8d-7349ddc5d400", + "id": "16", "metadata": {}, "source": [ "And use the workflow to write the file.\n", @@ -211,7 +211,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d35257da-b7a8-47e3-bd90-3bdf98ee539b", + "id": "17", "metadata": {}, "outputs": [], "source": [ @@ -220,7 +220,7 @@ }, { "cell_type": "markdown", - "id": "0420ed62-aa60-466f-a823-f608ddc3abc5", + "id": "18", "metadata": {}, "source": [ "### Compute intermediate results\n", @@ -233,7 +233,7 @@ { "cell_type": "code", "execution_count": null, - "id": "300d11ce-203b-4c65-a7f6-9df5132f9830", + "id": "19", "metadata": {}, "outputs": [], "source": [ @@ -250,7 +250,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b57d17b6-926a-4b75-8221-5ed27f59997d", + "id": "20", "metadata": {}, "outputs": [], "source": [ @@ -260,7 +260,7 @@ { "cell_type": "code", "execution_count": null, - "id": "57d72dd9-7f21-4691-b478-109194cc9c13", + "id": "21", "metadata": {}, "outputs": [], "source": [ @@ -270,7 +270,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e5547f3e-908c-4dcb-a700-c4aa5098073c", + "id": "22", "metadata": {}, "outputs": [], "source": [ @@ -283,7 +283,7 @@ }, { "cell_type": "markdown", - "id": "4048b5ad-acfa-4584-8cf6-8ebe2cba6801", + "id": "23", "metadata": {}, "source": [ "## Group by scattering angle\n", @@ -295,7 +295,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a4b68853-a70b-42d6-a8cc-58c77e83eaec", + "id": "24", "metadata": {}, "outputs": [], "source": [ @@ -306,7 +306,7 @@ }, { "cell_type": "markdown", - "id": "c8377091-43b5-467a-8f86-b58a96a3dc89", + "id": "25", "metadata": {}, "source": [ "We then have to request a final result that depends on both d-spacing and $2\\theta$:" @@ -315,7 +315,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e88eb36e-9377-4415-8123-a8916fd14793", + "id": "26", "metadata": {}, "outputs": [], "source": [ @@ -324,7 +324,7 @@ }, { "cell_type": "markdown", - "id": "2a8a0853-2829-49ab-b343-31deca3de31c", + "id": "27", "metadata": {}, "source": [ "Compute and plot the result:" @@ -333,7 +333,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a63e037d-3cfc-4ac9-963c-1e2d0881d482", + "id": "28", "metadata": {}, "outputs": [], "source": [ @@ -344,7 +344,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7ca04947-b019-4814-9467-4d0519d8d384", + "id": "29", "metadata": {}, "outputs": [], "source": [ @@ -361,7 +361,7 @@ }, { "cell_type": "markdown", - "id": "3de8061a-7c28-48e2-b569-a08fa09f1295", + "id": "30", "metadata": {}, "source": [ "Or we can view it as a 2D plot, which should display powder peaks as vertical bright lines:" @@ -370,7 +370,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4c9ee765-0699-4ca2-9bd8-f8dea27a261c", + "id": "31", "metadata": {}, "outputs": [], "source": [ diff --git a/docs/user-guide/sns-instruments/preprocess_files.ipynb b/docs/user-guide/sns-instruments/preprocess_files.ipynb index e1a8971c..4f281878 100644 --- a/docs/user-guide/sns-instruments/preprocess_files.ipynb +++ b/docs/user-guide/sns-instruments/preprocess_files.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "ffbf4d7c-6eec-4be3-aa60-9235e226304c", + "id": "0", "metadata": {}, "source": [ "# Preprocess POWGEN files\n", @@ -13,7 +13,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b58104c6-a196-4576-b3f0-9fb6fb1216e9", + "id": "1", "metadata": { "tags": [] }, @@ -27,7 +27,7 @@ }, { "cell_type": "markdown", - "id": "136323fc-b86c-46b3-a4f8-632151d4fb9a", + "id": "2", "metadata": {}, "source": [ "## Sample" @@ -36,7 +36,7 @@ { "cell_type": "code", "execution_count": null, - "id": "122e026b-09ce-45d0-bbb6-f839faa534b6", + "id": "3", "metadata": {}, "outputs": [], "source": [ @@ -51,7 +51,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d11a14a8-0fb7-4857-a234-e055d61d06ff", + "id": "4", "metadata": {}, "outputs": [], "source": [ @@ -61,7 +61,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ab654cbe-44e4-4925-8e51-3695bc6fc193", + "id": "5", "metadata": {}, "outputs": [], "source": [ @@ -79,7 +79,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2d878953-7056-48c5-8f2c-870f8f980046", + "id": "6", "metadata": {}, "outputs": [], "source": [ @@ -89,7 +89,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f63e67ec-3199-426b-8e0e-e5ac835f3548", + "id": "7", "metadata": {}, "outputs": [], "source": [ @@ -99,7 +99,7 @@ { "cell_type": "code", "execution_count": null, - "id": "2b3863ed-ee5e-4cc0-a8fb-6ed8cdc66687", + "id": "8", "metadata": {}, "outputs": [], "source": [ @@ -108,7 +108,7 @@ }, { "cell_type": "markdown", - "id": "6ba80e9c-9e09-4f8d-8c8b-0fab13a65483", + "id": "9", "metadata": {}, "source": [ "## Vana" @@ -117,7 +117,7 @@ { "cell_type": "code", "execution_count": null, - "id": "be8ed197-1b2d-442f-9f0e-ca64aa128c7d", + "id": "10", "metadata": {}, "outputs": [], "source": [ @@ -132,7 +132,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5dde24e6-57ca-4d23-b7b2-b3937c6f61be", + "id": "11", "metadata": {}, "outputs": [], "source": [ @@ -150,7 +150,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4e35b7d7-7f65-4551-bf9a-99c4fd1118e6", + "id": "12", "metadata": {}, "outputs": [], "source": [ @@ -160,7 +160,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0065ddd4-4d7e-4b06-b133-f56b43b9aa18", + "id": "13", "metadata": {}, "outputs": [], "source": [ @@ -170,7 +170,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dd961cbf-ba31-499f-9d8b-f28764f7314f", + "id": "14", "metadata": {}, "outputs": [], "source": [ @@ -180,7 +180,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a85a87e6-0cd8-4b9d-9a70-b9046da32973", + "id": "15", "metadata": {}, "outputs": [], "source": [ @@ -189,7 +189,7 @@ }, { "cell_type": "markdown", - "id": "237910ef-43c0-4de1-b020-780cf99239de", + "id": "16", "metadata": {}, "source": [ "## Calibration" @@ -198,7 +198,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6a667f13-667a-4674-b6ab-b64ebd6b2ee5", + "id": "17", "metadata": {}, "outputs": [], "source": [ @@ -211,7 +211,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b8039daf-c52e-4e6e-9fa1-212807de45ec", + "id": "18", "metadata": {}, "outputs": [], "source": [ @@ -221,7 +221,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e0a850c2-56ec-4aa9-b8fa-9b59223dfcc3", + "id": "19", "metadata": {}, "outputs": [], "source": [ @@ -231,7 +231,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6ba4e3e4-da92-40d9-92cb-e38afc8a339c", + "id": "20", "metadata": {}, "outputs": [], "source": [ diff --git a/docs/user-guide/sns-instruments/vanadium_processing.ipynb b/docs/user-guide/sns-instruments/vanadium_processing.ipynb index e4019d4e..49c4818a 100644 --- a/docs/user-guide/sns-instruments/vanadium_processing.ipynb +++ b/docs/user-guide/sns-instruments/vanadium_processing.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "fb973780-910e-48c0-9055-672182f300f9", + "id": "0", "metadata": {}, "source": [ "# Vanadium processing\n", @@ -21,10 +21,11 @@ { "cell_type": "code", "execution_count": null, - "id": "b38ce909-c9ec-4d75-8060-3b9e3094ef78", + "id": "1", "metadata": {}, "outputs": [], "source": [ + "import plopp as pp\n", "import scipp as sc\n", "import scippneutron as scn\n", "import scippneutron.peaks\n", @@ -36,7 +37,7 @@ }, { "cell_type": "markdown", - "id": "bf03dd14-a096-4cf0-8f0b-c318eb507391", + "id": "2", "metadata": {}, "source": [ "Use the same parameters as in the main workflow except with more d-spacing bins.\n", @@ -46,7 +47,7 @@ { "cell_type": "code", "execution_count": null, - "id": "01153a77-1710-41fc-a78c-20a8bae40831", + "id": "3", "metadata": {}, "outputs": [], "source": [ @@ -70,7 +71,7 @@ }, { "cell_type": "markdown", - "id": "12ac6517-a73c-493b-b2ce-f7ffe13a2060", + "id": "4", "metadata": {}, "source": [ "Compute a single vanadium spectrum in d-spacing:" @@ -79,7 +80,7 @@ { "cell_type": "code", "execution_count": null, - "id": "646a1117-3a71-4893-b2a2-13675cf749c7", + "id": "5", "metadata": {}, "outputs": [], "source": [ @@ -89,7 +90,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8de3d6e0-b8ec-4a25-bcb0-b0d2b19b8a61", + "id": "6", "metadata": {}, "outputs": [], "source": [ @@ -99,7 +100,7 @@ { "cell_type": "code", "execution_count": null, - "id": "04f7f83c-8608-458d-b4a9-2f9853c09cd7", + "id": "7", "metadata": {}, "outputs": [], "source": [ @@ -108,7 +109,7 @@ }, { "cell_type": "markdown", - "id": "84f8b41c-e3f3-4282-83c6-e0e424bc5632", + "id": "8", "metadata": {}, "source": [ "## Removing coherent scattering peaks\n", @@ -126,7 +127,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7140935e-8b32-403f-a0d8-e66293819b40", + "id": "9", "metadata": {}, "outputs": [], "source": [ @@ -137,7 +138,7 @@ }, { "cell_type": "markdown", - "id": "6e530963-258e-475f-9128-2417bc8d7e24", + "id": "10", "metadata": {}, "source": [ "We need to histogram the data to perform fits:" @@ -146,7 +147,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d6bcd10f-130e-43e0-8231-1f0b70e8bc53", + "id": "11", "metadata": {}, "outputs": [], "source": [ @@ -155,7 +156,7 @@ }, { "cell_type": "markdown", - "id": "1c4ff398-80d4-4452-92d7-3d3c8d1359dc", + "id": "12", "metadata": {}, "source": [ "The fits require a bin-center coordinate, so convert from bin-edges:" @@ -164,7 +165,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e661fda9-1de4-4d26-a8d7-c84cec10decd", + "id": "13", "metadata": {}, "outputs": [], "source": [ @@ -174,7 +175,7 @@ }, { "cell_type": "markdown", - "id": "b0bbf51f-307f-43c5-8093-ff6606049a1f", + "id": "14", "metadata": {}, "source": [ "Perform the fits:" @@ -183,7 +184,7 @@ { "cell_type": "code", "execution_count": null, - "id": "49f574d8-de6f-4c69-9704-6ce4acb9bdb3", + "id": "15", "metadata": {}, "outputs": [], "source": [ @@ -192,7 +193,7 @@ }, { "cell_type": "markdown", - "id": "19251c69-75eb-4dd0-be97-d2272946bacd", + "id": "16", "metadata": {}, "source": [ "Remove the fitted peaks to obtain the incoherent scattering.\n", @@ -207,7 +208,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fbcde35f-8608-4ecb-9b6d-67f686d7839a", + "id": "17", "metadata": {}, "outputs": [], "source": [ @@ -218,7 +219,7 @@ }, { "cell_type": "markdown", - "id": "6f19a754-c41a-4507-9ac5-a9f68dbab60f", + "id": "18", "metadata": {}, "source": [ "We can further inspect the results.\n", @@ -251,7 +252,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0fd4e65a-35b3-4c12-a4ee-24649bda2551", + "id": "19", "metadata": {}, "outputs": [], "source": [ @@ -275,9 +276,26 @@ " ), strict=True)\n", "\n", " # The actual data\n", - " fig = data.plot(c=\"C0\")\n", + " plot_data = {'data': data, 'removed': removed}\n", + " linestyles = {}\n", + " markers = {}\n", + " colors = {'data': 'C0','removed': 'C2'}\n", + "\n", + " # Overlay with fit models evaluated at optimized parameters\n", + " for i, result in enumerate(fit_results):\n", + " if all(not sc.isnan(param).value for param in result.popt.values()):\n", + " best_fit = data[data.dim, result.window[0] : result.window[1]].copy(deep=False)\n", + " best_fit.coords[best_fit.dim] = sc.midpoints(best_fit.coords[best_fit.dim])\n", + " best_fit.data = result.eval_model(best_fit.coords[best_fit.dim])\n", + "\n", + " key = f'result_{i}'\n", + " plot_data[key] = best_fit\n", + " linestyles[key] = '-'\n", + " markers[key] = \"none\"\n", + " colors[key] = \"C1\"\n", + "\n", + " fig = pp.plot(plot_data, ls=linestyles, marker=markers, c=colors, legend=False)\n", " ax = fig.ax\n", - " removed.plot(ax=ax, c='C2')\n", "\n", " # Initial estimates\n", " for estimate, result in zip(peak_estimates, fit_results, strict=True):\n", @@ -306,21 +324,13 @@ " if not result.success:\n", " ax.text(left.value, hi, result.message.split(\":\", 1)[0])\n", "\n", - " # Overlay with fit models evaluated at optimized parameters\n", - " for result in fit_results:\n", - " if all(not sc.isnan(param).value for param in result.popt.values()):\n", - " best_fit = data[data.dim, result.window[0] : result.window[1]].copy(deep=False)\n", - " best_fit.coords[best_fit.dim] = sc.midpoints(best_fit.coords[best_fit.dim])\n", - " best_fit.data = result.eval_model(best_fit.coords[best_fit.dim])\n", - " best_fit.plot(ax=ax, c=\"C1\", ls=\"-\", marker=\"none\")\n", - "\n", " return fig" ] }, { "cell_type": "code", "execution_count": null, - "id": "bee3ae5a-ae4c-41a8-901b-b0fada19504c", + "id": "20", "metadata": {}, "outputs": [], "source": [ @@ -335,7 +345,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fa420140-073c-4104-b9aa-990190f9bd4f", + "id": "21", "metadata": {}, "outputs": [], "source": [ @@ -350,7 +360,7 @@ }, { "cell_type": "markdown", - "id": "6bab60d1-1ea9-4481-9f5c-1d55423766c7", + "id": "22", "metadata": {}, "source": [ "The resulting data array `incoherent` can be saved and used in the main workflow [POWGEN_data_reduction](./POWGEN_data_reduction.rst) to replace `FocussedDataDspacing[VanadiumRun]`." diff --git a/pyproject.toml b/pyproject.toml index f903a2c7..cf7825a2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,13 @@ dependencies = [ dynamic = ["version"] +[project.optional-dependencies] +test = [ + "pandas", + "pooch", + "pytest", +] + [project.urls] "Bug Tracker" = "https://github.com/scipp/essdiffraction/issues" "Documentation" = "https://scipp.github.io/essdiffraction" @@ -83,7 +90,7 @@ ignore = [ # https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules "COM812", "COM819", "D206", "D300", "E111", "E114", "E117", "ISC001", "ISC002", "Q000", "Q001", "Q002", "Q003", "W191", ] -fixable = ["I001", "B010"] +fixable = ["B010", "I001", "PT001"] isort.known-first-party = ["ess.diffraction", "ess.dream", "ess.powder"] pydocstyle.convention = "numpy" @@ -115,3 +122,11 @@ enable_error_code = [ "truthy-bool", ] warn_unreachable = true + +[tool.codespell] +ignore-words-list = [ + # Codespell wants "socioeconomic" which seems to be the standard spelling. + # But we use the word in our code of conduct which is the contributor covenant. + # Let's not modify it if we don't have to. + "socio-economic", +] diff --git a/requirements/base.txt b/requirements/base.txt index 84f26bd4..1e916674 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -19,11 +19,11 @@ cyclebane==24.6.0 # via sciline cycler==0.12.1 # via matplotlib -dask==2024.8.2 +dask==2024.9.0 # via -r base.in decorator==5.1.1 # via ipython -essreduce==24.9.0 +essreduce==24.9.1 # via -r base.in exceptiongroup==1.2.2 # via ipython @@ -31,7 +31,7 @@ executing==2.1.0 # via stack-data fonttools==4.53.1 # via matplotlib -fsspec==2024.6.1 +fsspec==2024.9.0 # via dask graphviz==0.20.3 # via -r base.in @@ -39,7 +39,7 @@ h5py==3.11.0 # via # scippneutron # scippnexus -importlib-metadata==8.4.0 +importlib-metadata==8.5.0 # via dask ipydatawidgets==4.3.5 # via pythreejs @@ -53,7 +53,7 @@ jedi==0.19.1 # via ipython jupyterlab-widgets==3.0.13 # via ipywidgets -kiwisolver==1.4.6 +kiwisolver==1.4.7 # via matplotlib locket==1.0.0 # via partd @@ -91,7 +91,7 @@ pexpect==4.9.0 # via ipython pillow==10.4.0 # via matplotlib -plopp==24.6.0 +plopp==24.9.1 # via # -r base.in # scippneutron @@ -123,9 +123,9 @@ scipp==24.9.1 # essreduce # scippneutron # scippnexus -scippneutron==24.8.0 +scippneutron==24.9.0 # via -r base.in -scippnexus==24.8.1 +scippnexus==24.9.0 # via # -r base.in # essreduce @@ -160,5 +160,5 @@ wcwidth==0.2.13 # via prompt-toolkit widgetsnbextension==4.0.13 # via ipywidgets -zipp==3.20.1 +zipp==3.20.2 # via importlib-metadata diff --git a/requirements/basetest.in b/requirements/basetest.in index 18c6cbba..3ddc0c92 100644 --- a/requirements/basetest.in +++ b/requirements/basetest.in @@ -1,7 +1,12 @@ # Dependencies that are only used by tests. # Do not make an environment from this file, use test.txt instead! +# Add more dependencies in the ``test`` list +# under ``[project.optional-dependencies]`` section, in ``pyproject.toml`` -numpy +# Anything above "--- END OF CUSTOM SECTION ---" +# will not be touched by ``make_base.py`` +# --- END OF CUSTOM SECTION --- +# The following was generated by 'tox -e deps', DO NOT EDIT MANUALLY! pandas pooch pytest diff --git a/requirements/basetest.txt b/requirements/basetest.txt index 5ee45ada..138d2513 100644 --- a/requirements/basetest.txt +++ b/requirements/basetest.txt @@ -1,4 +1,4 @@ -# SHA1:71bfa26144d7bd59b7128e5f32727ebae47f0168 +# SHA1:c4f3e9aaa3abd10fcdf497bea14415857f62cc89 # # This file is autogenerated by pip-compile-multi # To update, run: @@ -11,31 +11,29 @@ charset-normalizer==3.3.2 # via requests exceptiongroup==1.2.2 # via pytest -idna==3.8 +idna==3.10 # via requests iniconfig==2.0.0 # via pytest numpy==2.1.1 - # via - # -r basetest.in - # pandas + # via pandas packaging==24.1 # via # pooch # pytest pandas==2.2.2 # via -r basetest.in -platformdirs==4.2.2 +platformdirs==4.3.6 # via pooch pluggy==1.5.0 # via pytest pooch==1.8.2 # via -r basetest.in -pytest==8.3.2 +pytest==8.3.3 # via -r basetest.in python-dateutil==2.9.0.post0 # via pandas -pytz==2024.1 +pytz==2024.2 # via pandas requests==2.32.3 # via pooch @@ -45,5 +43,5 @@ tomli==2.0.1 # via pytest tzdata==2024.1 # via pandas -urllib3==2.2.2 +urllib3==2.2.3 # via requests diff --git a/requirements/ci.txt b/requirements/ci.txt index 07ac45f8..28ed2397 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -17,7 +17,7 @@ colorama==0.4.6 # via tox distlib==0.3.8 # via virtualenv -filelock==3.15.4 +filelock==3.16.1 # via # tox # virtualenv @@ -25,20 +25,20 @@ gitdb==4.0.11 # via gitpython gitpython==3.1.43 # via -r ci.in -idna==3.8 +idna==3.10 # via requests packaging==24.1 # via # -r ci.in # pyproject-api # tox -platformdirs==4.2.2 +platformdirs==4.3.6 # via # tox # virtualenv pluggy==1.5.0 # via tox -pyproject-api==1.7.1 +pyproject-api==1.7.2 # via tox requests==2.32.3 # via -r ci.in @@ -48,9 +48,9 @@ tomli==2.0.1 # via # pyproject-api # tox -tox==4.18.0 +tox==4.19.0 # via -r ci.in -urllib3==2.2.2 +urllib3==2.2.3 # via requests -virtualenv==20.26.3 +virtualenv==20.26.5 # via tox diff --git a/requirements/dev.txt b/requirements/dev.txt index 5aad6e79..3c90233e 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -26,7 +26,7 @@ arrow==1.3.0 # via isoduration async-lru==2.0.4 # via jupyterlab -cffi==1.17.0 +cffi==1.17.1 # via argon2-cffi-bindings copier==9.3.1 # via -r dev.in @@ -87,9 +87,9 @@ prometheus-client==0.20.0 # via jupyter-server pycparser==2.22 # via cffi -pydantic==2.8.2 +pydantic==2.9.2 # via copier -pydantic-core==2.20.1 +pydantic-core==2.23.4 # via pydantic python-json-logger==2.0.7 # via jupyter-events @@ -115,7 +115,7 @@ terminado==0.18.1 # jupyter-server-terminals toposort==1.10 # via pip-compile-multi -types-python-dateutil==2.9.0.20240821 +types-python-dateutil==2.9.0.20240906 # via arrow uri-template==1.3.0 # via jsonschema diff --git a/requirements/docs.txt b/requirements/docs.txt index 4b711a19..026f58ac 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -42,7 +42,7 @@ docutils==0.21.2 # sphinxcontrib-bibtex fastjsonschema==2.20.0 # via nbformat -idna==3.8 +idna==3.10 # via requests imagesize==1.4.1 # via sphinx @@ -62,7 +62,7 @@ jsonschema==4.23.0 # via nbformat jsonschema-specifications==2023.12.1 # via jsonschema -jupyter-client==8.6.2 +jupyter-client==8.6.3 # via # ipykernel # nbclient @@ -85,7 +85,7 @@ markupsafe==2.1.5 # via # jinja2 # nbconvert -mdit-py-plugins==0.4.1 +mdit-py-plugins==0.4.2 # via myst-parser mdurl==0.1.2 # via markdown-it-py @@ -110,7 +110,7 @@ pandas==2.2.2 # via -r docs.in pandocfilters==1.5.1 # via nbconvert -platformdirs==4.2.2 +platformdirs==4.3.6 # via # jupyter-core # pooch @@ -128,7 +128,7 @@ pybtex-docutils==1.0.3 # via sphinxcontrib-bibtex pydata-sphinx-theme==0.15.4 # via -r docs.in -pytz==2024.1 +pytz==2024.2 # via pandas pyzmq==26.2.0 # via @@ -160,7 +160,7 @@ sphinx==8.0.2 # sphinx-copybutton # sphinx-design # sphinxcontrib-bibtex -sphinx-autodoc-typehints==2.3.0 +sphinx-autodoc-typehints==2.4.3 # via -r docs.in sphinx-copybutton==0.5.2 # via -r docs.in @@ -168,7 +168,7 @@ sphinx-design==0.6.1 # via -r docs.in sphinxcontrib-applehelp==2.0.0 # via sphinx -sphinxcontrib-bibtex==2.6.2 +sphinxcontrib-bibtex==2.6.3 # via -r docs.in sphinxcontrib-devhelp==2.0.0 # via sphinx @@ -190,7 +190,7 @@ tornado==6.4.1 # jupyter-client tzdata==2024.1 # via pandas -urllib3==2.2.2 +urllib3==2.2.3 # via requests webencodings==0.5.1 # via diff --git a/requirements/make_base.py b/requirements/make_base.py index 493ede16..ccbab001 100644 --- a/requirements/make_base.py +++ b/requirements/make_base.py @@ -42,8 +42,14 @@ def write_dependencies(dependency_name: str, dependencies: list[str]) -> None: if dependencies is None: raise RuntimeError("No dependencies found in pyproject.toml") dependencies = [dep.strip().strip('"') for dep in dependencies] + test_dependencies = ( + pyproject["project"].get("optional-dependencies", {}).get("test", []) + ) + test_dependencies = [dep.strip().strip('"') for dep in test_dependencies] + write_dependencies("base", dependencies) +write_dependencies("basetest", test_dependencies) def as_nightly(repo: str) -> str: diff --git a/requirements/nightly.txt b/requirements/nightly.txt index 5327e18b..7ec4d15f 100644 --- a/requirements/nightly.txt +++ b/requirements/nightly.txt @@ -20,7 +20,7 @@ cyclebane==24.6.0 # via sciline cycler==0.12.1 # via matplotlib -dask==2024.8.2 +dask==2024.9.0 # via -r nightly.in decorator==5.1.1 # via ipython @@ -30,7 +30,7 @@ executing==2.1.0 # via stack-data fonttools==4.53.1 # via matplotlib -fsspec==2024.6.1 +fsspec==2024.9.0 # via dask graphviz==0.20.3 # via -r nightly.in @@ -38,7 +38,7 @@ h5py==3.11.0 # via # scippneutron # scippnexus -importlib-metadata==8.4.0 +importlib-metadata==8.5.0 # via dask ipydatawidgets==4.3.5 # via pythreejs @@ -52,7 +52,7 @@ jedi==0.19.1 # via ipython jupyterlab-widgets==3.0.13 # via ipywidgets -kiwisolver==1.4.6 +kiwisolver==1.4.7 # via matplotlib locket==1.0.0 # via partd @@ -135,5 +135,5 @@ wcwidth==0.2.13 # via prompt-toolkit widgetsnbextension==4.0.13 # via ipywidgets -zipp==3.20.1 +zipp==3.20.2 # via importlib-metadata diff --git a/requirements/static.txt b/requirements/static.txt index 85da246d..d7f3ca42 100644 --- a/requirements/static.txt +++ b/requirements/static.txt @@ -9,17 +9,17 @@ cfgv==3.4.0 # via pre-commit distlib==0.3.8 # via virtualenv -filelock==3.15.4 +filelock==3.16.1 # via virtualenv -identify==2.6.0 +identify==2.6.1 # via pre-commit nodeenv==1.9.1 # via pre-commit -platformdirs==4.2.2 +platformdirs==4.3.6 # via virtualenv pre-commit==3.8.0 # via -r static.in pyyaml==6.0.2 # via pre-commit -virtualenv==20.26.3 +virtualenv==20.26.5 # via pre-commit diff --git a/requirements/wheels.txt b/requirements/wheels.txt index a1fa46e2..24447442 100644 --- a/requirements/wheels.txt +++ b/requirements/wheels.txt @@ -5,7 +5,7 @@ # # pip-compile-multi # -build==1.2.1 +build==1.2.2 # via -r wheels.in packaging==24.1 # via build diff --git a/src/ess/diffraction/__init__.py b/src/ess/diffraction/__init__.py index c42366fc..1986f16f 100644 --- a/src/ess/diffraction/__init__.py +++ b/src/ess/diffraction/__init__.py @@ -9,7 +9,7 @@ import importlib.metadata try: - __version__ = importlib.metadata.version(__package__ or __name__) + __version__ = importlib.metadata.version("essdiffraction") except importlib.metadata.PackageNotFoundError: __version__ = "0.0.0" diff --git a/src/ess/dream/instrument_view.py b/src/ess/dream/instrument_view.py index 58f5e0f9..7f769ed3 100644 --- a/src/ess/dream/instrument_view.py +++ b/src/ess/dream/instrument_view.py @@ -99,6 +99,7 @@ def __init__( self.slice_nodes = self.pre_process_nodes to_scatter = self.pre_process_nodes + kwargs.setdefault('cbar', True) self.fig = pp.scatter3d( to_scatter, pos="position", diff --git a/src/ess/dream/io/geant4.py b/src/ess/dream/io/geant4.py index 716c6257..7eda04f0 100644 --- a/src/ess/dream/io/geant4.py +++ b/src/ess/dream/io/geant4.py @@ -4,7 +4,6 @@ import numpy as np import sciline import scipp as sc -from ess.reduce.nexus.generic_workflow import GenericNeXusWorkflow from ess.powder.types import ( CalibratedDetector, @@ -18,6 +17,7 @@ NeXusSource, RunType, ) +from ess.reduce.nexus.generic_workflow import GenericNeXusWorkflow MANTLE_DETECTOR_ID = sc.index(7) HIGH_RES_DETECTOR_ID = sc.index(8) diff --git a/src/ess/dream/io/nexus.py b/src/ess/dream/io/nexus.py index 60e58644..fe916106 100644 --- a/src/ess/dream/io/nexus.py +++ b/src/ess/dream/io/nexus.py @@ -14,6 +14,7 @@ """ import sciline + from ess.reduce.nexus.generic_workflow import GenericNeXusWorkflow from ess.reduce.nexus.types import DetectorBankSizes diff --git a/src/ess/powder/correction.py b/src/ess/powder/correction.py index 794b018a..e585b232 100644 --- a/src/ess/powder/correction.py +++ b/src/ess/powder/correction.py @@ -5,9 +5,10 @@ from typing import Any import scipp as sc -from ess.reduce.uncertainty import broadcast_uncertainties from scippneutron.conversion.graph import beamline, tof +from ess.reduce.uncertainty import broadcast_uncertainties + from ._util import event_or_outer_coord from .logging import get_logger from .smoothing import lowpass diff --git a/src/ess/powder/transform.py b/src/ess/powder/transform.py index 1b4b0486..3207c5e8 100644 --- a/src/ess/powder/transform.py +++ b/src/ess/powder/transform.py @@ -3,6 +3,7 @@ """Signal transformation algorithms for powder diffraction.""" import scipp as sc + from ess.reduce.uncertainty import UncertaintyBroadcastMode, broadcast_uncertainties diff --git a/src/ess/powder/types.py b/src/ess/powder/types.py index 0a6d794e..dc8d5d44 100644 --- a/src/ess/powder/types.py +++ b/src/ess/powder/types.py @@ -12,6 +12,7 @@ import sciline import scipp as sc + from ess.reduce.nexus import generic_types as reduce_gt from ess.reduce.nexus import types as reduce_t from ess.reduce.uncertainty import UncertaintyBroadcastMode as _UncertaintyBroadcastMode diff --git a/src/ess/snspowder/powgen/instrument_view.py b/src/ess/snspowder/powgen/instrument_view.py index 677c04f0..157c6c0d 100644 --- a/src/ess/snspowder/powgen/instrument_view.py +++ b/src/ess/snspowder/powgen/instrument_view.py @@ -36,6 +36,7 @@ def instrument_view( # unit=da.coords[positions].unit) # } # } + kwargs.setdefault('cbar', True) return scn.instrument_view( da, positions=positions, components=components, pixel_size=pixel_size, **kwargs ) diff --git a/tests/dream/geant4_reduction_test.py b/tests/dream/geant4_reduction_test.py index b1d2ac23..1cd15a4e 100644 --- a/tests/dream/geant4_reduction_test.py +++ b/tests/dream/geant4_reduction_test.py @@ -4,9 +4,9 @@ import pytest import sciline import scipp as sc -from ess import dream, powder import ess.dream.data # noqa: F401 +from ess import dream, powder from ess.powder.types import ( AccumulatedProtonCharge, BackgroundRun, @@ -30,7 +30,7 @@ ) -@pytest.fixture() +@pytest.fixture def providers(): from ess.dream.io.geant4 import providers as geant4_providers @@ -67,7 +67,7 @@ def params_for_det(request): return {**params, NeXusDetectorName: request.param} -@pytest.fixture() +@pytest.fixture def workflow(params_for_det): wf = dream.DreamGeant4Workflow() for key, value in params_for_det.items(): diff --git a/tests/dream/instrument_view_test.py b/tests/dream/instrument_view_test.py index 4e3fd46d..e5863949 100644 --- a/tests/dream/instrument_view_test.py +++ b/tests/dream/instrument_view_test.py @@ -8,7 +8,7 @@ from ess.dream.instrument_view import InstrumentView -@pytest.fixture() +@pytest.fixture def fake_instrument_data(modules=('bank1', 'bank2', 'bank3', 'bank4', 'bank5')): rng = np.random.default_rng() diff --git a/tests/dream/io/geant4_test.py b/tests/dream/io/geant4_test.py index 4ca29f04..d3396c3f 100644 --- a/tests/dream/io/geant4_test.py +++ b/tests/dream/io/geant4_test.py @@ -45,12 +45,12 @@ def load_file_without_sans(file_path_without_sans): return archive.read(archive.namelist()[0]) -@pytest.fixture() +@pytest.fixture def file(load_file): return BytesIO(load_file) -@pytest.fixture() +@pytest.fixture def file_without_sans(load_file_without_sans): return BytesIO(load_file_without_sans) diff --git a/tests/dream/io/nexus_test.py b/tests/dream/io/nexus_test.py index 6b0e6c70..59a8a936 100644 --- a/tests/dream/io/nexus_test.py +++ b/tests/dream/io/nexus_test.py @@ -3,6 +3,8 @@ import pytest import sciline import scipp as sc + +import ess.dream.data # noqa: F401 from ess import dream from ess.reduce.nexus.generic_types import ( CalibratedDetector, @@ -15,13 +17,11 @@ ) from ess.reduce.nexus.types import NeXusDetectorName -import ess.dream.data # noqa: F401 - bank_dims = {'wire', 'module', 'segment', 'strip', 'counter'} hr_sans_dims = {'strip', 'other'} -@pytest.fixture() +@pytest.fixture def nexus_workflow() -> sciline.Pipeline: return dream.io.nexus.LoadNeXusWorkflow() diff --git a/tests/powder/correction_test.py b/tests/powder/correction_test.py index 0c37ef16..5e1800db 100644 --- a/tests/powder/correction_test.py +++ b/tests/powder/correction_test.py @@ -8,7 +8,7 @@ from ess.powder.correction import apply_lorentz_correction, merge_calibration -@pytest.fixture() +@pytest.fixture def calibration(): rng = np.random.default_rng(789236) n = 30 diff --git a/tests/snspowder/powgen/load_test.py b/tests/snspowder/powgen/load_test.py index 22d03b44..540a32c3 100644 --- a/tests/snspowder/powgen/load_test.py +++ b/tests/snspowder/powgen/load_test.py @@ -1,6 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2023 Scipp contributors (https://github.com/scipp) import pytest + from ess.snspowder.powgen import data, load_calibration diff --git a/tests/snspowder/powgen/powgen_reduction_test.py b/tests/snspowder/powgen/powgen_reduction_test.py index 7313ace6..3e7172c8 100644 --- a/tests/snspowder/powgen/powgen_reduction_test.py +++ b/tests/snspowder/powgen/powgen_reduction_test.py @@ -1,13 +1,12 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2023 Scipp contributors (https://github.com/scipp) -import ess.snspowder.powgen.data # noqa: F401 import pytest import sciline import scipp as sc -from ess import powder -from ess.snspowder import powgen +import ess.snspowder.powgen.data # noqa: F401 +from ess import powder from ess.powder.types import ( CalibrationFilename, DspacingBins, @@ -25,16 +24,17 @@ VanadiumRun, WavelengthMask, ) +from ess.snspowder import powgen -@pytest.fixture() +@pytest.fixture def providers(): from ess import powder return [*powder.providers, *powgen.providers, *powgen.data.providers] -@pytest.fixture() +@pytest.fixture def params(): return { NeXusDetectorName: "powgen_detector",