aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/extragalactic
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2019-01-11 00:23:03 +0800
committerAaron LI <aly@aaronly.me>2019-01-11 00:23:03 +0800
commit96fc980003e29a3a6de360971a0ea0eb5b50a498 (patch)
treee74bbdcba6c97478e60cb23e4095fd4b1187e8be /fg21sim/extragalactic
parent8b88004202b7be34e354879cc224a2d6ed72ecd7 (diff)
downloadfg21sim-96fc980003e29a3a6de360971a0ea0eb5b50a498.tar.bz2
clusters/halo: Refactor calc_radius_turb()
Keep all the calculated properties that can be used to tweak the parameters or to help debug.
Diffstat (limited to 'fg21sim/extragalactic')
-rw-r--r--fg21sim/extragalactic/clusters/halo.py51
1 files changed, 37 insertions, 14 deletions
diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py
index 47895fe..9867ba2 100644
--- a/fg21sim/extragalactic/clusters/halo.py
+++ b/fg21sim/extragalactic/clusters/halo.py
@@ -964,28 +964,51 @@ class RadioHalo:
largest turbulence radius of a merger that is generating a genuine
radio halo.
- Attributes
- ----------
+ Returns
+ -------
radius_turb_eff : float
Effective radius of the turbulence region
Unit: [kpc]
+
+ Attributes
+ ----------
+ radius_turb_eff : float
+ _halos : list[dict]
+ List of dictionary with each one saving the properties of the
+ halo generated by the corresponding merger.
"""
logger.info("Determining the effective turbulence radius ...")
- halos = [RadioHalo1M(M_obs=self.M_obs, z_obs=self.z_obs,
- M_main=self.M_main[i],
- M_sub=self.M_sub[i],
- z_merger=self.z_merger[i],
- configs=self.configs)
- for i in range(self.merger_num)]
- halos.sort(key=lambda h: h.radius_turbulence(h.age_merger),
- reverse=True)
- for halo in halos:
+ halos = [{
+ "M_main": self.M_main[i],
+ "M_sub": self.M_sub[i],
+ "z_merger": self.z_merger[i],
+ "i": i,
+ } for i in range(self.merger_num)]
+ for hdict in halos:
+ halo = RadioHalo1M(M_obs=self.M_obs, z_obs=self.z_obs,
+ M_main=hdict["M_main"],
+ M_sub=hdict["M_sub"],
+ z_merger=hdict["z_merger"],
+ configs=self.configs)
+ hdict["halo"] = halo
+ hdict["radius_turb"] = halo.radius_turbulence(halo.age_merger)
+ hdict["genuine"] = False
+
+ halos.sort(key=lambda h: h["radius_turb"], reverse=True)
+ for hdict in halos:
+ halo = hdict["halo"]
logger.info("Checking merger: %.2e & %.2e @ %.3f ..." %
(halo.M_main, halo.M_sub, halo.z_merger))
n_e = halo.calc_electron_spectrum()
- genuine, factor = halo.is_genuine(n_e)
+ genuine, em_factor = halo.is_genuine(n_e)
+ hdict["n_e"] = n_e
+ hdict["genuine"] = genuine
+ hdict["em_factor"] = em_factor
+
if genuine:
- self.radius_turb_eff = halo.radius_turbulence(halo.age_merger)
- logger.info("Identified effective merger")
+ self.radius_turb_eff = hdict["radius_turb"]
+ logger.info("Identified effective merger.")
break
+
+ self._halos = halos
return self.radius_turb_eff