aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-08-29 20:53:31 +0800
committerAaron LI <aly@aaronly.me>2017-08-29 20:53:31 +0800
commitfea0272a343ec700505654c6d042538d0db590f9 (patch)
tree0693bf7fdbbfed64e802895bc4f6fa99fbb0f654
parent2379c84736f687e4ebc32583a3c2a34be0b88e98 (diff)
downloadfg21sim-fea0272a343ec700505654c6d042538d0db590f9.tar.bz2
clusters/psformalism: Remove config "f_darkmatter"
Use "1 - baryon_fraction = 1 - Ob0/Om0" to replace "f_darkmatter".
-rw-r--r--fg21sim/configs/20-extragalactic.conf.spec3
-rw-r--r--fg21sim/extragalactic/clusters/psformalism.py5
-rw-r--r--fg21sim/utils/cosmology.py10
3 files changed, 12 insertions, 6 deletions
diff --git a/fg21sim/configs/20-extragalactic.conf.spec b/fg21sim/configs/20-extragalactic.conf.spec
index 3137c73..e960a5e 100644
--- a/fg21sim/configs/20-extragalactic.conf.spec
+++ b/fg21sim/configs/20-extragalactic.conf.spec
@@ -30,9 +30,6 @@
# native *pickle* format (i.e., .pkl)
halos_dumpfile = string(default=None)
- # The fraction of the dark matter mass in galaxy clusters.
- f_darkmatter = float(default=0.8, min=0.5, max=1.0)
-
# The minimum mass for clusters when to determine the galaxy clusters
# total counts and their distributions.
# Unit: [Msun]
diff --git a/fg21sim/extragalactic/clusters/psformalism.py b/fg21sim/extragalactic/clusters/psformalism.py
index f28c0d4..508d391 100644
--- a/fg21sim/extragalactic/clusters/psformalism.py
+++ b/fg21sim/extragalactic/clusters/psformalism.py
@@ -42,12 +42,11 @@ class PSFormalism:
"""
comp = "extragalactic/clusters"
self.datafile = self.configs.get_path(comp+"/ps_data")
- self.f_darkmatter = self.configs.getn(comp+"/f_darkmatter")
self.Mmin_cluster = self.configs.getn(comp+"/mass_min") # [Msun]
@property
def Mmin_halo(self):
- return self.Mmin_cluster * self.f_darkmatter
+ return self.Mmin_cluster * COSMO.darkmatter_fraction
def _load_data(self, filepath=None):
"""
@@ -225,7 +224,7 @@ class PSFormalism:
df = pd.DataFrame(np.column_stack([z_list, M_list]),
columns=["z", "mass"])
- df["mass"] /= self.f_darkmatter
+ df["mass"] /= COSMO.darkmatter_fraction
comment = [
"cluster number counts : %d" % counts,
"z : redshift",
diff --git a/fg21sim/utils/cosmology.py b/fg21sim/utils/cosmology.py
index d66de09..cc347e4 100644
--- a/fg21sim/utils/cosmology.py
+++ b/fg21sim/utils/cosmology.py
@@ -248,6 +248,16 @@ class Cosmology:
"""
return self.Ob0 / self.Om0
+ @property
+ def darkmatter_fraction(self):
+ """
+ The cosmological mean dark matter fraction (w.r.t. matter),
+ assumed to be *constant* regardless of redshifts!
+
+ See also: ``self.baryon_fraction``
+ """
+ return 1 - self.baryon_fraction
+
def overdensity_virial(self, z):
"""
Calculate the virial overdensity, which generally used to