Skip to content

Commit

Permalink
process test
Browse files Browse the repository at this point in the history
  • Loading branch information
DolicaAkelloEgwel committed Mar 9, 2023
1 parent 2b01d56 commit 36e9c50
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/release_notes/next.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Fixes
- #1712 : Fix redrawing of all ROIs and spectrum line plots of toggle and change of normalized stacks within spectrum viewer
- #1219 : Fix image_180deg.tiff being included in sample stack
- #1730 : Allow any characters in filenames
- #1698 : Store processed (but not reconstructed) data in a different place in the nexus file

Developer Changes
-----------------
Expand Down
12 changes: 11 additions & 1 deletion mantidimaging/core/io/test/io_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from mantidimaging.core.data.dataset import StrictDataset
from mantidimaging.core.io import loader
from mantidimaging.core.io import saver
from mantidimaging.core.io.saver import _rescale_recon_data, _save_recon_to_nexus
from mantidimaging.core.io.saver import _rescale_recon_data, _save_recon_to_nexus, _save_processed_data_to_nexus
from mantidimaging.core.utility.version_check import CheckVersion
from mantidimaging.helper import initialise_logging
from mantidimaging.test_helpers import FileOutputtingTestCase
Expand Down Expand Up @@ -332,6 +332,16 @@ def test_save_recons_if_present(self, recon_save_mock: mock.Mock):

self.assertEqual(recon_save_mock.call_count, len(sd.recons))

def test_save_process(self):
ds = StrictDataset(th.generate_images())
process_path = "processed-data/process"
with h5py.File("path", "w", driver="core", backing_store=False) as nexus_file:
_save_processed_data_to_nexus(nexus_file, ds)
assert "process" in nexus_file["processed-data"]
self.assertEqual(_nexus_dataset_to_string(nexus_file[process_path]["program"]), "Mantid Imaging")
self.assertEqual(_nexus_dataset_to_string(nexus_file[process_path]["version"]), CheckVersion.get_version())
self.assertIn(str(datetime.date.today()), _nexus_dataset_to_string(nexus_file[process_path]["date"]))

@mock.patch("mantidimaging.core.io.saver._save_recon_to_nexus")
def test_dont_save_recons_if_none_present(self, recon_save_mock: mock.Mock):

Expand Down

0 comments on commit 36e9c50

Please sign in to comment.