From 8dcf5caa1e6b37d7717ea04167e96ebee3e9516a Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Thu, 11 Jan 2018 19:55:54 +0800 Subject: clusters/main: minor cleanups --- fg21sim/extragalactic/clusters/main.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'fg21sim/extragalactic/clusters') diff --git a/fg21sim/extragalactic/clusters/main.py b/fg21sim/extragalactic/clusters/main.py index 68291eb..2c8ac54 100644 --- a/fg21sim/extragalactic/clusters/main.py +++ b/fg21sim/extragalactic/clusters/main.py @@ -297,11 +297,10 @@ class GalaxyClusters: """ logger.info("Calculating the radio halo emissions ...") num = len(self.halos) - i = 0 - for hdict in self.halos: - i += 1 - if i % 100 == 0: - logger.info("[%d/%d] %.1f%% ..." % (i, num, 100*i/num)) + for i, hdict in enumerate(self.halos): + ii = i + 1 + if ii % 100 == 0: + logger.info("[%d/%d] %.1f%% ..." % (ii, num, 100*ii/num)) haloem = HaloEmission(gamma=hdict["gamma"], n_e=hdict["n_e"], B=hdict["B0"], radius=hdict["Rhalo"], redshift=hdict["z0"]) @@ -357,11 +356,10 @@ class GalaxyClusters: """ num = len(self.halos) logger.info("Draw template images for %d halos ..." % num) - i = 0 - for hdict in self.halos: - i += 1 - if i % 100 == 0: - logger.info("[%d/%d] %.1f%% ..." % (i, num, 100*i/num)) + for i, hdict in enumerate(self.halos): + ii = i + 1 + if ii % 100 == 0: + logger.info("[%d/%d] %.1f%% ..." % (ii, num, 100*ii/num)) theta_e = hdict["Rhalo_angular"] / self.sky.pixelsize template = helper.draw_halo(radius=theta_e, felong=hdict["felong"], -- cgit v1.2.2