diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..380db91 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,5 @@ +{ + "name": "ismrmrd-python conda", + "image": "condaforge/miniforge3:24.11.3-0", + "postCreateCommand": "conda install -y conda-build anaconda-client" +} 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/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 dafc854..4d9421e 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -7,15 +7,18 @@ package: source: path: ../ +build: + noarch: python + 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 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