From 5bf1bdcc87a1613a1f7b09a01abc0544ff9d482e Mon Sep 17 00:00:00 2001 From: Joe Naegele Date: Thu, 7 May 2026 16:08:03 -0400 Subject: [PATCH 1/3] Make conda build noarch --- .devcontainer/devcontainer.json | 6 ++++++ .github/workflows/ismrmrd_python_conda.yml | 5 +---- conda/meta.yaml | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..7aa3767 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,6 @@ +{ + "name": "ismrmrd-python conda", + "image": "condaforge/miniforge3:latest", + "postCreateCommand": "conda install -y conda-build anaconda-client", + "remoteUser": "root" +} diff --git a/.github/workflows/ismrmrd_python_conda.yml b/.github/workflows/ismrmrd_python_conda.yml index 8939ba0..1ece7aa 100644 --- a/.github/workflows/ismrmrd_python_conda.yml +++ b/.github/workflows/ismrmrd_python_conda.yml @@ -10,10 +10,7 @@ on: jobs: build-conda-packages: - strategy: - matrix: - os: [ubuntu-latest, macos-latest] - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - uses: conda-incubator/setup-miniconda@v3 diff --git a/conda/meta.yaml b/conda/meta.yaml index dafc854..17ac01a 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -7,6 +7,9 @@ package: source: path: ../ +build: + noarch: python + requirements: build: - python {{ python }} From ff2955bb3ddb30afa0ce6bff42588ce3cea4ffaa Mon Sep 17 00:00:00 2001 From: Joe Naegele Date: Thu, 7 May 2026 16:27:14 -0400 Subject: [PATCH 2/3] PR feedback --- .devcontainer/devcontainer.json | 5 ++--- conda/conda_build_config.yaml | 3 --- conda/meta.yaml | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) delete mode 100644 conda/conda_build_config.yaml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 7aa3767..380db91 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,6 +1,5 @@ { "name": "ismrmrd-python conda", - "image": "condaforge/miniforge3:latest", - "postCreateCommand": "conda install -y conda-build anaconda-client", - "remoteUser": "root" + "image": "condaforge/miniforge3:24.11.3-0", + "postCreateCommand": "conda install -y conda-build anaconda-client" } diff --git a/conda/conda_build_config.yaml b/conda/conda_build_config.yaml deleted file mode 100644 index a042c9f..0000000 --- a/conda/conda_build_config.yaml +++ /dev/null @@ -1,3 +0,0 @@ -python: - - 3.10 - - 3.12 \ No newline at end of file diff --git a/conda/meta.yaml b/conda/meta.yaml index 17ac01a..4d9421e 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -12,13 +12,13 @@ build: requirements: build: - - python {{ python }} + - python - xsdata>=24.0 - setuptools - pip run: - - python + - python >=3.9 - numpy>=1.22.0 - h5py>=2.3 - xsdata>=24.0 From d70f0dea9e63946717153cdffb4986cfacad93e5 Mon Sep 17 00:00:00 2001 From: Joe Naegele Date: Thu, 7 May 2026 16:43:32 -0400 Subject: [PATCH 3/3] Add XSD header construction test --- setup.py | 2 +- tests/end-to-end/test-reconstruction.sh | 2 +- tests/test_xsd.py | 53 +++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 tests/test_xsd.py diff --git a/setup.py b/setup.py index c4b284f..b96e3b2 100644 --- a/setup.py +++ b/setup.py @@ -66,7 +66,7 @@ def generate_schema(self, schema_filename, config_filename, subpackage_name, out shutil.move(subpackage_name, destination) setup( - version='1.14.3', + version='1.15.0', packages=find_packages(), cmdclass={ 'generate_schema': GenerateSchemaCommand diff --git a/tests/end-to-end/test-reconstruction.sh b/tests/end-to-end/test-reconstruction.sh index 10f6981..d7a9425 100755 --- a/tests/end-to-end/test-reconstruction.sh +++ b/tests/end-to-end/test-reconstruction.sh @@ -2,7 +2,7 @@ set -euo pipefail -ISMRMRD_IMAGE=ghcr.io/ismrmrd/ismrmrd:v1.14.2 +ISMRMRD_IMAGE=ghcr.io/ismrmrd/ismrmrd:v1.15.0 SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}") PROJECT_DIR=$(realpath "${SCRIPT_DIR}/../..") diff --git a/tests/test_xsd.py b/tests/test_xsd.py new file mode 100644 index 0000000..5273730 --- /dev/null +++ b/tests/test_xsd.py @@ -0,0 +1,53 @@ +import ismrmrd.xsd +from ismrmrd.xsd.ismrmrdschema import ( + ismrmrdHeader, + experimentalConditionsType, + encodingType, + encodingSpaceType, + matrixSizeType, + fieldOfViewMm, + encodingLimitsType, + trajectoryType, +) + + +def make_encoding_space(x, y, z, fov_x, fov_y, fov_z): + return encodingSpaceType( + matrixSize=matrixSizeType(x=x, y=y, z=z), + fieldOfView_mm=fieldOfViewMm(x=fov_x, y=fov_y, z=fov_z), + ) + + +def make_header(): + return ismrmrdHeader( + experimentalConditions=experimentalConditionsType( + H1resonanceFrequency_Hz=128000000, + ), + encoding=[ + encodingType( + encodedSpace=make_encoding_space(256, 256, 1, 300.0, 300.0, 6.0), + reconSpace=make_encoding_space(256, 256, 1, 300.0, 300.0, 6.0), + encodingLimits=encodingLimitsType(), + trajectory=trajectoryType.CARTESIAN, + ) + ], + ) + + +def test_construct_header(): + """Constructing ismrmrdHeader and its sub-types using required keyword args should not raise.""" + header = make_header() + assert header.experimentalConditions.H1resonanceFrequency_Hz == 128000000 + assert len(header.encoding) == 1 + enc = header.encoding[0] + assert enc.trajectory == trajectoryType.CARTESIAN + assert enc.encodedSpace.matrixSize.x == 256 + assert enc.encodedSpace.fieldOfView_mm.z == 6.0 + + +def test_header_roundtrip(): + """A header built from constructors should survive a ToXML -> CreateFromDocument round-trip.""" + header = make_header() + xml = ismrmrd.xsd.ToXML(header) + reparsed = ismrmrd.xsd.CreateFromDocument(xml) + assert ismrmrd.xsd.ToXML(reparsed) == xml