def compute_zline_distance(repo, molecule_list, timepoints, z_line_spacing): all_median_profiles = [] for molecule in molecule_list: for timepoint in timepoints: image_set = ImageSet(repo, [f"{'mrna'}/{molecule}/{timepoint}/"]) if image_set.__sizeof__() < 5: logger.warning("Image set is small for {}", molecule) total_profile = image_set.compute_zline_distance(z_line_spacing) all_median_profiles.append(np.median(total_profile, axis=0)) return all_median_profiles
def test_compute_zline_distance(self): image_set = ImageSet(self.repo, path_list=['mrna/actn2/immature/']) result = image_set.compute_zline_distance(20) test = [[0.24374599, 0.03463759, 0.0365619, 0.0436177, 0.03207184, 0.02758178, 0.0365619, 0.03207184, 0.03014753, 0.02694035, 0.02309173, 0.01860167, 0.02180885, 0.02758178, 0.01988454, 0.0, 0.0, 0.0, 0.0, 0.0], [0.38974359, 0.01230769, 0.01025641, 0.02871795, 0.02153846, 0.02461538, 0.01948718, 0.02666667, 0.03076923, 0.01333333, 0.0225641, 0.01025641, 0.01538462, 0.01333333, 0.00923077, 0.0, 0.0, 0.0, 0.0, 0.0]] self.assertEqual(len(result), len(test)) self.assertAlmostEqual(np.sum(result), np.sum(test), places=5)