aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-07-31 23:03:18 +0800
committerAaron LI <aly@aaronly.me>2017-07-31 23:03:18 +0800
commitda72ba973ec8ee911f0382860918b448c9b2aa96 (patch)
tree6401e4c66852916c825babccea1b255bd308b26e
parentee0c1612707f416434ec9d41b3f87ce631792afb (diff)
downloadfg21sim-da72ba973ec8ee911f0382860918b448c9b2aa96.tar.bz2
clusters/main.py: Use PSFormalism to simulate cluster catalog
Signed-off-by: Aaron LI <aly@aaronly.me>
-rw-r--r--fg21sim/extragalactic/clusters/main.py24
1 files changed, 11 insertions, 13 deletions
diff --git a/fg21sim/extragalactic/clusters/main.py b/fg21sim/extragalactic/clusters/main.py
index c3e4068..4e3d906 100644
--- a/fg21sim/extragalactic/clusters/main.py
+++ b/fg21sim/extragalactic/clusters/main.py
@@ -22,6 +22,7 @@ import logging
import numpy as np
import pandas as pd
+from .psformalism import PSFormalism
from .formation import ClusterFormation
from .halo import RadioHalo
from ...share import CONFIGS, COSMO
@@ -67,7 +68,6 @@ class GalaxyClusters:
Load the configs and set the corresponding class attributes.
"""
comp = "extragalactic/clusters"
- self.catalog_path = self.configs.get_path(comp+"/catalog")
self.catalog_outfile = self.configs.get_path(comp+"/catalog_outfile")
self.prefix = self.configs.getn(comp+"/prefix")
self.save = self.configs.getn(comp+"/save")
@@ -90,23 +90,21 @@ class GalaxyClusters:
logger.info("Loaded and set up configurations")
- def _load_catalog(self):
+ def _simulate_catalog(self):
"""
- Load the sampled (z, mass) catalogs from the Press-Schechter
- formalism for the clusters in this sky patch.
+ Simulate the (z, mass) catalog of the cluster distribution
+ according to the Press-Schechter formalism.
Catalog columns
---------------
* ``z`` : redshifts
- * ``mass`` : cluster mass; unit: [Msun]
+ * ``mass`` : cluster total mass; unit: [Msun]
"""
- self.catalog = pd.read_csv(self.catalog_path, comment="#")
- self.catalog_comment = [
- "z : redshift",
- "mass : cluster total mass [Msun]",
- ]
- num = len(self.catalog)
- logger.info("Loaded (z, mass) catalog: %d clusters" % num)
+ logger.info("Simulating the clusters (z, mass) catalog ...")
+ psform = PSFormalism(configs=self.configs)
+ counts = psform.calc_cluster_counts(coverage=self.sky.area)
+ self.catalog, self.catalog_comment = psform.sample_z_m(counts)
+ logger.info("Simulated cluster catalog of counts %d." % counts)
def _process_catalog(self):
"""
@@ -281,7 +279,7 @@ class GalaxyClusters:
return
logger.info("{name}: preprocessing ...".format(name=self.name))
- self._load_catalog()
+ self._simulate_catalog()
self._process_catalog()
# self._simulate_mergers()