Beispiel #1
0
 def setUpClass(cls):
     cls.cases = Path(__file__).absolute().resolve().parent / 'cases'
     cls.aa = ArrayAnalyse.load(cls.cases / 'save' / 'dump_0_3_0.tar')
     cls.out_folder = cls.cases / 'testing_reports'
     cls.out_folder.mkdir(exist_ok=True, parents=True)
     cls.additional_info = [
         dict(key='system_name', name='System name', value='UnitTest'),
         dict(key='membrane_name', name='Membrane name', value='Membrane A')
     ]
Beispiel #2
0
 def test_modify_exposure_t(self):
     aa = ArrayAnalyse.load(self.cases / 'save' / 'dump_0_3_0.tar')
     exposure, reorder = aa.modify_exposure({
         'start': 10,
         'step': 30
     },
                                            test=True)
     self.assertFalse(reorder)
     self.assertListEqual(exposure, [10, 40, 70, 100, 130])
Beispiel #3
0
    def test_save_load(self):
        save_mem = io.BytesIO()
        self.aa.save(file=save_mem)
        save_mem_hash = hash_mem(save_mem, skip=0)
        save_mem.seek(0)
        saved_aa = ArrayAnalyse.load(save_mem)
        np.testing.assert_array_equal(saved_aa.original_index,
                                      self.aa.original_index)
        np.testing.assert_array_equal(saved_aa.exposure, self.aa.exposure)
        np.testing.assert_array_equal(saved_aa.raw_images, self.aa.raw_images)
        del saved_aa

        self.aa.save(self.out_folder / 'dump.tar')
        save_file_hash = hash_file(self.out_folder / 'dump.tar', skip=0)

        self.assertEqual(save_file_hash, save_mem_hash)
Beispiel #4
0
 def test_modify_exposure_mix(self):
     aa = ArrayAnalyse.load(self.cases / 'save' / 'dump_0_3_0.tar')
     exposure, reorder = aa.modify_exposure([10, 40, 100, 70, 130])
     self.assertTrue(reorder)
     np.testing.assert_array_equal(aa.raw_index, [0, 1, 3, 2, 4])