Commit eba42cce authored by Pierre Paleo's avatar Pierre Paleo
Browse files

[hdf5scan] Add unit test for ignore_projections

parent f6897c28
......@@ -311,9 +311,46 @@ class TestGetSinogram(HDF5TestBaseClass):
self.scan.get_sinogram(line=25, subsampling=1)
class TestIgnoredProjections(HDF5TestBaseClass):
"""Test the ignore_projections parameter"""
def setUp(self) -> None:
super(TestIgnoredProjections, self).setUp()
self.dataset_file = self.get_dataset("frm_edftomomill_oneentry.nx")
self.ignored_projs = [387, 388, 389, 390, 391, 392, 393, 394, 395, 396]
self.ignored_projs_fname = os.path.join(
self.test_dir, "ignored_projections.txt"
)
numpy.savetxt(
self.ignored_projs_fname,
self.ignored_projs,
header="Indices of ignored projections",
comments="#",
)
def testIgnoreProjections(self):
self.scan = HDF5TomoScan(
scan=self.dataset_file, ignore_projections=self.ignored_projs_fname
)
self.scan._projections = None
self.assertTrue(
numpy.allclose(self.scan._ignored_projections, self.ignored_projs)
)
for idx in self.ignored_projs:
self.assertFalse(
idx in self.scan.projections,
"Projection index %d is supposed to be ignored" % idx,
)
def suite():
test_suite = unittest.TestSuite()
for ui in (TestHDF5Scan, TestFlatFieldCorrection, TestGetSinogram):
for ui in (
TestHDF5Scan,
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