aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-07-31 23:32:10 +0800
committerAaron LI <aly@aaronly.me>2017-07-31 23:32:10 +0800
commit68dac5c2e1972c3868503b8ce6208b455240c61c (patch)
treeb689634105d5f89d5d95a4e0ad45021aa2431882
parentdaa69f553da9fa847aa130d490bbb1d291eff0e3 (diff)
downloadfg21sim-68dac5c2e1972c3868503b8ce6208b455240c61c.tar.bz2
Fix several small issues; Also update PSFormalism a bit
Signed-off-by: Aaron LI <aly@aaronly.me>
-rw-r--r--fg21sim/extragalactic/clusters/psformalism.py14
-rw-r--r--fg21sim/share.py2
2 files changed, 11 insertions, 5 deletions
diff --git a/fg21sim/extragalactic/clusters/psformalism.py b/fg21sim/extragalactic/clusters/psformalism.py
index 4a65b8f..f28c0d4 100644
--- a/fg21sim/extragalactic/clusters/psformalism.py
+++ b/fg21sim/extragalactic/clusters/psformalism.py
@@ -44,7 +44,10 @@ class PSFormalism:
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]
- self.Mmin_halo = self.Mmin_cluster * self.f_darkmatter
+
+ @property
+ def Mmin_halo(self):
+ return self.Mmin_cluster * self.f_darkmatter
def _load_data(self, filepath=None):
"""
@@ -116,7 +119,7 @@ class PSFormalism:
dM = self.delta(self.masses)
dMgrip, dzgrip = np.meshgrid(dM, dz)
Mgrip, zgrip = np.meshgrid(self.masses, self.redshifts)
- dVcgrip = COSMO.differential_comoving_volume(zgrip).value # [Mpc^3/sr]
+ dVcgrip = COSMO.dVc(zgrip) # [Mpc^3/sr]
numgrid = self.densities * dVcgrip * dzgrip * dMgrip
return numgrid
@@ -193,7 +196,7 @@ class PSFormalism:
i = 0
while i < counts:
z = random.uniform(zmin, zmax)
- M = random.uniform(self.mass_min, Mmax)
+ M = random.uniform(self.Mmin_halo, Mmax)
r = random.random()
zi1 = (self.redshifts < z).sum()
zi2 = zi1 - 1
@@ -215,7 +218,10 @@ class PSFormalism:
z_list.append(z)
M_list.append(M)
i += 1
- logger.info("Sampled %d (z, mass) pairs for each cluster" % counts)
+ if i % 100 == 0:
+ logger.debug("[%d/%d] %.1f%% done ..." %
+ (i, counts, 100*i/counts))
+ logger.info("Sampled %d pairs of (z, mass) for each cluster" % counts)
df = pd.DataFrame(np.column_stack([z_list, M_list]),
columns=["z", "mass"])
diff --git a/fg21sim/share.py b/fg21sim/share.py
index bbe52b4..72bc23d 100644
--- a/fg21sim/share.py
+++ b/fg21sim/share.py
@@ -8,7 +8,7 @@ NOTE: ``global`` and ``globals`` are both preserved by Python :-(
"""
from .configs import ConfigManager
-from .utils import Cosmology
+from .utils.cosmology import Cosmology
# The globally shared `~ConfigManager` instance/object, that holds the