aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-05-11 16:57:46 +0800
committerAaron LI <aly@aaronly.me>2018-05-12 10:33:57 +0800
commit73e7fe043cb7e9f83174b922d4eb916f948a5632 (patch)
tree76b4b8ddabf35069a76337917f85d94a9852c9f3
parent4bf1e89c77c7e8e4abe6a0d654547e3f0bc56521 (diff)
downloadfg21sim-73e7fe043cb7e9f83174b922d4eb916f948a5632.tar.bz2
clusters: Fix cluster distribution calculation about mass
-rw-r--r--fg21sim/configs/20-extragalactic.conf.spec15
-rw-r--r--fg21sim/extragalactic/clusters/psformalism.py22
-rw-r--r--fg21sim/utils/cosmology.py5
3 files changed, 17 insertions, 25 deletions
diff --git a/fg21sim/configs/20-extragalactic.conf.spec b/fg21sim/configs/20-extragalactic.conf.spec
index c039429..dbebe4e 100644
--- a/fg21sim/configs/20-extragalactic.conf.spec
+++ b/fg21sim/configs/20-extragalactic.conf.spec
@@ -11,20 +11,19 @@
[extragalactic]
#
- # Press-Schechter formalism to determine the dark matter halos
- # distribution with respect to masses and redshifts, from which
- # to further determine the total number of halos within a sky
- # patch and to sample the masses and redshifts for each halo.
- # NOTE: only consider the *dark matter* mass within the halo!
+ # Press-Schechter formalism to determine the cluster distributions
+ # with respect to mass and redshift, from which to further determine
+ # the total number of clusters within a sky patch and to sample the
+ # masses and redshifts for each cluster.
#
[[psformalism]]
- # The model of the fitting function for halo mass distribution
+ # The model of the fitting function for halo/cluster mass distribution
# For all models and more details:
# https://hmf.readthedocs.io/en/latest/_autosummary/hmf.fitting_functions.html
model = option("smt", "jenkins", "ps", default="ps")
- # The minimum (inclusive) and maximum (exclusive!) halo mass (dark
- # matter only) within which to calculate the halo mass distribution.
+ # The minimum (inclusive) and maximum (exclusive!) cluster mass
+ # within which to calculate the halo mass distribution.
# Unit: [Msun]
M_min = float(default=1e12, min=1e10, max=1e14)
M_max = float(default=1e16, min=1e14, max=1e18)
diff --git a/fg21sim/extragalactic/clusters/psformalism.py b/fg21sim/extragalactic/clusters/psformalism.py
index f17aae1..dff69a5 100644
--- a/fg21sim/extragalactic/clusters/psformalism.py
+++ b/fg21sim/extragalactic/clusters/psformalism.py
@@ -6,7 +6,7 @@ Press-Schechter (PS) formalism
First determine the number of clusters within a sky patch (i.e., sky
coverage) according to the cluster distribution predicted by the PS
-formalism; then sampling from the halo mass function to derive the mass
+formalism; then sampling from the mass function to derive the mass
and redshift for each cluster.
"""
@@ -29,7 +29,7 @@ class PSFormalism:
"""
Press-Schechter (PS) formalism
- Calculate the halo mass distribution with respect to mass and redshift,
+ Calculate the mass distribution with respect to mass and redshift,
determine the clusters number counts and generate their distribution
(mass and z) within a sky patch of certain coverage.
"""
@@ -52,7 +52,7 @@ class PSFormalism:
self.dndlnm_outfile = self.configs.get_path(comp+"/dndlnm_outfile")
comp = "extragalactic/clusters"
- self.Mmin_cluster = self.configs.getn(comp+"/mass_min") # [Msun]
+ self.Mmin = self.configs.getn(comp+"/mass_min") # [Msun]
self.boost = self.configs.getn(comp+"/boost")
self.clobber = self.configs.getn("output/clobber")
@@ -150,10 +150,6 @@ class PSFormalism:
clobber=self.clobber)
logger.info("Wrote dndlnm data into file: %s" % outfile)
- @property
- def Mmin_halo(self):
- return self.Mmin_cluster * COSMO.darkmatter_fraction
-
@staticmethod
def delta(x, logeven=False):
"""
@@ -211,10 +207,9 @@ class PSFormalism:
"""
logger.info("Calculating the total number of clusters within "
"sky patch of coverage %.1f [deg^2]" % coverage)
- logger.info("Minimum cluster mass: %.2e [Msun]" % self.Mmin_cluster)
- logger.info("Minimum halo mass: %.2e [Msun]" % self.Mmin_halo)
+ logger.info("Minimum cluster mass: %.2e [Msun]" % self.Mmin)
coverage *= AUC.deg2rad**2 # [deg^2] -> [rad^2] = [sr]
- midx = (self.mass >= self.Mmin_halo)
+ midx = (self.mass >= self.Mmin)
numgrid = self.number_grid
counts = np.sum(numgrid[:, midx]) * coverage * self.boost
counts = int(np.round(counts))
@@ -257,7 +252,7 @@ class PSFormalism:
zmin = z.min()
zmax = z.max()
log10mass = np.log10(self.mass)
- log10Mmin = np.log10(self.Mmin_halo)
+ log10Mmin = np.log10(self.Mmin)
log10Mmax = log10mass.max()
midx = (log10mass >= log10Mmin)
log10mass = log10mass[midx]
@@ -297,11 +292,10 @@ class PSFormalism:
logger.info("Sampled %d pairs of (z, mass) for each cluster" % counts)
z = np.array(z_list)
- mass = np.array(mass_list) / COSMO.darkmatter_fraction
+ mass = np.array(mass_list)
comment = [
"halo mass function model: %s" % self.hmf_model,
- "cluster minimum mass: %.2e [Msun]" % self.Mmin_cluster,
- "dark matter fraction: %.2f" % COSMO.darkmatter_fraction,
+ "cluster minimum mass: %.2e [Msun]" % self.Mmin,
"cluster counts: %d" % counts,
"boost factor for cluster counts: %s" % self.boost,
"",
diff --git a/fg21sim/utils/cosmology.py b/fg21sim/utils/cosmology.py
index 21db450..8da335a 100644
--- a/fg21sim/utils/cosmology.py
+++ b/fg21sim/utils/cosmology.py
@@ -306,10 +306,9 @@ class Cosmology:
@property
def darkmatter_fraction(self):
"""
- The cosmological mean dark matter fraction (w.r.t. matter),
- assumed to be *constant* regardless of redshifts!
+ The cosmological mean dark matter fraction (w.r.t. matter).
- See also: ``self.baryon_fraction``
+ XXX: assumed to be *constant* regardless of redshifts!
"""
return 1 - self.baryon_fraction