Commit 1d107543 authored by payno's avatar payno
Browse files

fix projections

parent 2a78dc35
......@@ -50,7 +50,9 @@ class _ScanMock:
:param scan_path:
:param n_radio:
:param n_ini_radio:
:param n_ini_radio: number of radio existing at t time. If None,
will create all the radio and consider the
acquisition as finished
:param n_extra_radio:
:param scan_range:
:param n_recons:
......@@ -74,6 +76,12 @@ class _ScanMock:
self.write_metadata(n_radio=n_radio, scan_range=scan_range,
ref_n=ref_n, dark_n=dark_n)
if n_ini_radio is None:
n_ini_radio = n_radio + n_extra_radio
call_acqui_end = True
else:
call_acqui_end = False
for i_radio in range(n_ini_radio):
self.add_radio(i_radio)
for i_extra_radio in range(n_extra_radio):
......@@ -85,6 +93,9 @@ class _ScanMock:
if recons_vol is True:
self.add_recons_vol()
if call_acqui_end is True:
self.end_acquisition()
def add_radio(self, index=None):
raise NotImplementedError('Base class')
......
......@@ -77,7 +77,7 @@ class TestScanFactory(unittest.TestCase):
self.assertTrue(isinstance(scan, EDFTomoScan))
class FTSerieReconstructionTest(unittest.TestCase):
class TestDarksFlats(unittest.TestCase):
"""unit test for the FTSerieReconstruction functions"""
def setUp(self):
def saveData(data, _file, folder):
......@@ -145,6 +145,36 @@ class FTSerieReconstructionTest(unittest.TestCase):
self.assertTrue(12 not in self.acquiTwoFlats.flats)
class TestProjections(unittest.TestCase):
"""Test that the """
def setUp(self) -> None:
self.folder = tempfile.mkdtemp()
def tearDown(self) -> None:
shutil.rmtree(self.folder)
def testProjectionNoExtra(self):
mock = MockEDF(scan_path=self.folder, n_radio=10, n_extra_radio=0)
mock.end_acquisition()
scan = EDFTomoScan(scan=self.folder)
self.assertEqual(len(scan.projections), 10)
def testProjectionUpdate(self):
mock = MockEDF(scan_path=self.folder, n_radio=10, n_ini_radio=3)
scan = EDFTomoScan(scan=self.folder)
self.assertEqual(len(scan.projections), 3)
mock.add_radio()
self.assertEqual(len(scan.projections), 3)
scan.update()
self.assertEqual(len(scan.projections), 4)
def testProjectionWithExtraRadio(self):
mock = MockEDF(scan_path=self.folder, n_radio=10, n_extra_radio=3)
mock.end_acquisition()
scan = EDFTomoScan(scan=self.folder)
self.assertEqual(len(scan.projections), 10)
class TestScanValidatorFindFiles(unittest.TestCase):
"""Function testing the getReconstructionsPaths function is correctly
functioning"""
......@@ -338,8 +368,8 @@ class TestScanBaseJSON(unittest.TestCase):
def suite():
test_suite = unittest.TestSuite()
for ui in (TestScanFactory, FTSerieReconstructionTest,
TestScanValidatorFindFiles, TestRadioPath,
for ui in (TestScanFactory, TestDarksFlats,
TestScanValidatorFindFiles, TestRadioPath, TestProjections,
TestTomoBaseHashable):
test_suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(ui))
return test_suite
......
Supports Markdown
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