def test_compute_intensities_signal_from_periphery(self): image_set = ImageSet(self.repo, path_list=['protein/arhgdia/4h/']) self.assertEqual(len(image_set.images), 5, "Expected 5 images") peripheral_signals = image_set.compute_signal_from_periphery() cytoplasmic_intensities = [img.compute_cytoplasmic_total_intensity() for img in image_set.images] self.assertEqual(peripheral_signals.shape, (5, 100)) self.assertTrue(np.allclose(peripheral_signals[:, 99], np.array(cytoplasmic_intensities))) self.assertAlmostEqual(peripheral_signals.sum(), 29384734352.0)
def test_compute_spots_signal_from_periphery(self): image_set = ImageSet(self.repo, path_list=['mrna/arhgdia/2h/']) self.assertEqual(len(image_set.images), 5, "Expected 5 images") peripheral_signals = image_set.compute_signal_from_periphery() self.assertEqual(peripheral_signals.shape, (5, 100)) spots_counts = [img.compute_cytoplasmic_total_spots() for img in image_set.images] self.assertTrue(np.all(peripheral_signals[:, 99] == np.array(spots_counts))) self.assertAlmostEqual(peripheral_signals.sum(), 20166.0)