Esempio n. 1
0
 def test_ARY015(self):
     aa = ArrayAnalyse('ARY015')
     aa.strict = False
     aa.load_image(self.cases / 'ARY015.tif')
     aa.finalize_collection()
     self.assertAlmostEqual(0.2759596293934661,
                            aa.evaluate('A1', just_value=True,
                                        norm='raw')[0][0],
                            delta=1E-13)
     self.assertAlmostEqual(0.18749890601518324,
                            aa.evaluate('E13', just_value=True,
                                        norm='raw')[0][0],
                            delta=1E-13)
Esempio n. 2
0
 def test_ARY028(self):
     aa = ArrayAnalyse('ARY028')
     aa.strict = False
     aa.load_image(self.cases / 'ARY028.tif')
     aa.finalize_collection()
     self.assertAlmostEqual(0.5281856065937371,
                            aa.evaluate('A1', just_value=True,
                                        norm='raw')[0][0],
                            delta=1E-13)
     self.assertAlmostEqual(0.05475981244045449,
                            aa.evaluate('E13', just_value=True,
                                        norm='raw')[0][0],
                            delta=1E-13)
Esempio n. 3
0
 def test_ARY007(self):
     aa = ArrayAnalyse('ARY007')
     aa.strict = False
     aa.load_image(self.cases / 'ARY007.tif')
     aa.finalize_collection()
     self.assertAlmostEqual(0.5117877836372805,
                            aa.evaluate('A1', just_value=True,
                                        norm='raw')[0][0],
                            delta=1E-13)
     self.assertAlmostEqual(0.06156276344709296,
                            aa.evaluate('E13', just_value=True,
                                        norm='raw')[0][0],
                            delta=1E-13)
Esempio n. 4
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')
     ]
Esempio n. 5
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])
Esempio n. 6
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)
Esempio n. 7
0
    def setUpClass(cls):
        cls.aa = ArrayAnalyse('ARY022B')
        cls.cases = Path(__file__).absolute().resolve().parent / 'cases'
        cls.out_folder = cls.cases / 'testing_collection'
        cls.out_folder.mkdir(exist_ok=True, parents=True)
        cls.aa.load_collection(cls.cases / 'prepared', rotation=90)

        cls.compare_raw_bg = {
            'position': (0, 0),
            'info': ['Reference Spots', 'N/A', 'RS'],
            'value': [
                0.02435921, 0.02744768, 0.03043349, 0.03340112, 0.0363117,
                0.03901506, 0.04165865, 0.04422421, 0.04678247, 0.04915831,
                0.05159785, 0.05389296, 0.05621142, 0.05833439, 0.06049102,
                0.06279641, 0.06493878, 0.06679878, 0.06875748, 0.07078687,
                0.07264834, 0.07467496, 0.07659154, 0.07851298, 0.0802008,
                0.08157714, 0.08358657
            ]
        }
Esempio n. 8
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])
Esempio n. 9
0
 def setUpClass(cls):
     cls.aa = ArrayAnalyse('ARY022B')
     cls.cases = Path(__file__).absolute().resolve().parent / 'cases'