Skip to content

Commit

Permalink
Update for new version of xsdata
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeyiasemis committed Apr 2, 2024
1 parent cda0ead commit 1be817e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/tests_data/test_datasets.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# coding=utf-8
# Copyright (c) DIRECT Contributors

"""Tests for the direct.data.datasets module."""
"""Tests for the `direct.data.datasets` module."""

import pathlib
import tempfile
Expand All @@ -10,6 +9,7 @@
import ismrmrd
import numpy as np
import pytest
from xsdata.formats.dataclass.serializers import XmlSerializer

from direct.data.datasets import (
CalgaryCampinasDataset,
Expand Down Expand Up @@ -83,7 +83,10 @@ def create_fastmri_h5file(filename, shape, recon_shape):
h5file = h5py.File(filename, "w")
h5file.create_dataset("kspace", data=kspace)
h5file.create_dataset("reconstruction_rss", data=rss)
h5file.create_dataset("ismrmrd_header", data=header.toXML())

# Serializing 'header' object to XML string.
xml_string = XmlSerializer().render(header)
h5file.create_dataset("ismrmrd_header", data=xml_string)

h5file.attrs["norm"] = np.linalg.norm(kspace)
h5file.attrs["max"] = np.abs(kspace).max()
Expand Down

0 comments on commit 1be817e

Please sign in to comment.