aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-12-30 20:23:52 +0800
committerAaron LI <aly@aaronly.me>2017-12-30 20:52:17 +0800
commit4b4103c9f44bce064d0f02bef1e997286bb6a7ef (patch)
tree2b1f3e2786fe3314162e0cc683b102a470ec0917
parent07d2312bcea7971ff30229fa04d27c87dc1b297c (diff)
downloadfg21sim-4b4103c9f44bce064d0f02bef1e997286bb6a7ef.tar.bz2
clusters/halo: support to drop out the most powerful halos
The new option "extragalactic/clusters/halo_dropout" is added to specify how many halos to be dropped out.
-rw-r--r--fg21sim/configs/20-extragalactic.conf.spec3
-rw-r--r--fg21sim/extragalactic/clusters/main.py26
2 files changed, 29 insertions, 0 deletions
diff --git a/fg21sim/configs/20-extragalactic.conf.spec b/fg21sim/configs/20-extragalactic.conf.spec
index 7d52de4..7debd75 100644
--- a/fg21sim/configs/20-extragalactic.conf.spec
+++ b/fg21sim/configs/20-extragalactic.conf.spec
@@ -103,6 +103,9 @@
# (NOTE: mainly for testing purpose.)
boost = float(default=1.0, min=0.1, max=1e4)
+ # Number of most powerful halos to be dropped out.
+ halo_dropout = integer(default=0, min=0)
+
# Minimum mass change of the main cluster to be regarded as a merger
# event instead of an accretion event.
# Unit: [Msun]
diff --git a/fg21sim/extragalactic/clusters/main.py b/fg21sim/extragalactic/clusters/main.py
index a02cbb0..b6b5222 100644
--- a/fg21sim/extragalactic/clusters/main.py
+++ b/fg21sim/extragalactic/clusters/main.py
@@ -84,6 +84,7 @@ class GalaxyClusters:
self.dump_halos_data = self.configs.getn(comp+"/dump_halos_data")
self.use_dump_halos_data = self.configs.getn(
comp+"/use_dump_halos_data")
+ self.halo_dropout = self.configs.getn(comp+"/halo_dropout")
self.prefix = self.configs.getn(comp+"/prefix")
self.output_dir = self.configs.get_path(comp+"/output_dir")
self.merger_mass_min = self.configs.getn(comp+"/merger_mass_min")
@@ -333,6 +334,30 @@ class GalaxyClusters:
hdict["Tb_mean"] = Tb_mean # [K]
logger.info("Done calculate the radio emissions.")
+ def _dropout_halos(self):
+ """
+ Considering that the (very) massive galaxy clusters are very rare,
+ while the simulation sky area is rather small, therefore, once a
+ very massive cluster appears, its associated radio halo is also
+ very powerful and (almost) dominate other intermediate/faint halos,
+ causing the simulation results unstable and have large variation.
+
+ Drop out the specified number of most powerful radio halos from
+ the catalog, in order to obtain a more stable simulation.
+ """
+ if self.halo_dropout <= 0:
+ logger.info("No need to drop out halos.")
+ return
+
+ power = np.array([hdict["power"][0] for hdict in self.halos])
+ argsort = power.argsort()[::-1] # max -> min
+ idx_drop = argsort[:self.halo_dropout]
+ halos_new = [hdict for i, hdict in enumerate(self.halos)
+ if i not in idx_drop]
+ self.halos = halos_new
+ logger.info("Dropped out %d most powerful halos" % self.halo_dropout)
+ logger.info("Remaining number of halos: %d" % len(halos_new))
+
def _draw_halos(self):
"""
Draw the template images for each halo, and cache them for
@@ -444,6 +469,7 @@ class GalaxyClusters:
self._simulate_halos()
self._calc_halos_emission()
+ self._dropout_halos()
self._draw_halos()
self._preprocessed = True