Commit 894c67d4 authored by Pierre Paleo's avatar Pierre Paleo
Browse files

[edfscan] add unit test for ignored_projections

parent f818fa79
Pipeline #36686 passed with stages
in 10 minutes and 35 seconds
......@@ -601,6 +601,40 @@ class TestScanBaseJSON(unittest.TestCase):
scan_to_update.load_from_dict(outfile)
class TestIgnoredProjections(unittest.TestCase):
"""Test that the """
def setUp(self) -> None:
self.folder = tempfile.mkdtemp()
self.ignored_projs = [5, 6, 7]
self.ignored_projs_fname = os.path.join(self.folder, "ignored_projections.txt")
numpy.savetxt(
self.ignored_projs_fname,
self.ignored_projs,
header="Indices of ignored projections",
comments="#",
)
def tearDown(self) -> None:
shutil.rmtree(self.folder)
def testProjectionNoExtra(self):
mock = MockEDF(
scan_path=self.folder, n_radio=15, n_ini_radio=10, n_extra_radio=0, dim=10
)
mock.end_acquisition()
scan = EDFTomoScan(
scan=self.folder, ignore_projections=self.ignored_projs_fname
)
print(scan.projections)
self.assertTrue(numpy.allclose(scan._ignored_projections, self.ignored_projs))
for idx in self.ignored_projs:
self.assertFalse(
idx in scan.projections,
"Projection index %d is supposed to be ignored" % idx,
)
def suite():
test_suite = unittest.TestSuite()
for ui in (
......@@ -613,6 +647,7 @@ def suite():
TestOriDarksFlats,
TestFlatFieldCorrection,
TestGetSinogram,
TestIgnoredProjections,
):
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