Unverified Commit 4ce926d4 authored by Henri Payno's avatar Henri Payno
Browse files

test: improve test by adding call to tomoscan.validator.is_valid_for_reconsrtuction

parent 86bf90b7
Pipeline #60688 passed with stages
in 4 minutes and 6 seconds
......@@ -37,6 +37,7 @@ from nxtomomill import converter
from tomoscan.esrf.hdf5scan import HDF5TomoScan
from nxtomomill.test.utils.dxfile import MockDxFile
from silx.io.utils import get_data
from tomoscan.validator import is_valid_for_reconstruction
class TestDxToNxConverter(unittest.TestCase):
......@@ -83,6 +84,7 @@ class TestDxToNxConverter(unittest.TestCase):
self.assertEqual(len(scan.flats), self.n_flats)
self.assertEqual(numpy.array(scan.rotation_angle).min(), 0)
self.assertEqual(numpy.array(scan.rotation_angle).max(), 180)
assert is_valid_for_reconstruction(scan)
# check arrays are correctly copied from mock
numpy.testing.assert_array_equal(
......
......@@ -36,6 +36,7 @@ from tomoscan.esrf.mock import MockEDF
from tomoscan.esrf.hdf5scan import HDF5TomoScan
from tomoscan.esrf.edfscan import EDFTomoScan
from tomoscan import version
from tomoscan.validator import is_valid_for_reconstruction
from nxtomomill.utils import Progress
import pytest
......@@ -75,3 +76,4 @@ def test_edf_to_nx_converter(progress):
assert len(hdf5_scan.alignment_projections) == n_alignment_proj
assert hdf5_scan.dim_1 == dim
assert hdf5_scan.dim_2 == dim
assert is_valid_for_reconstruction(hdf5_scan)
......@@ -41,6 +41,7 @@ from nxtomomill.converter.hdf5.acquisition.baseacquisition import EntryReader
from nxtomomill.converter.hdf5.acquisition.baseacquisition import DatasetReader
from nxtomomill.io.config import TomoHDF5Config
from tomoscan.esrf.hdf5scan import HDF5TomoScan
from tomoscan.validator import is_valid_for_reconstruction
from nxtomomill.test.utils.bliss import MockBlissAcquisition
from silx.io.url import DataUrl
from silx.io.utils import get_data
......@@ -288,6 +289,7 @@ class TestH5ToNxConverter(unittest.TestCase):
scan = HDF5TomoScan(scan=res_tuple[0], entry=res_tuple[1])
if hasattr(scan, "z_translation"):
self.assertTrue(scan.z_translation is not None)
self.assertTrue(is_valid_for_reconstruction(scan))
def test_ignore_sub_entries(self):
"""
......@@ -503,18 +505,20 @@ class TestStandardAcqConversionWithExternalUrls(unittest.TestCase):
url=DataUrl(file_path=dark_flat_file, data_path="/3.1", scheme="silx"),
),
)
converter.from_h5_to_nx(
configuration=self.config,
)
self.assertTrue(os.path.exists(self.config.output_file))
self.assertTrue(
os.path.exists(self.config.output_file), "output file does not exists"
)
with h5py.File(self.config.output_file, mode="r") as h5s:
self.assertEqual(len(h5s.items()), 1)
self.assertTrue("entry0000" in h5s)
scan = HDF5TomoScan(scan=self.config.output_file, entry="entry0000")
self.assertTrue(is_valid_for_reconstruction(scan))
# check the `data`has been created
self.assertTrue(len(scan.projections), 20)
......@@ -609,6 +613,7 @@ class TestStandardAcqConversionWithExternalUrls(unittest.TestCase):
self.assertEqual(vs.file_name, "acqui_1/sample_0/sample_0.h5")
scan = HDF5TomoScan(scan=self.config.output_file, entry="entry0000")
self.assertTrue(is_valid_for_reconstruction(scan))
# check the `data`has been created
self.assertTrue(len(scan.projections), 40)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment