diff options
author | Aaron LI <aly@aaronly.me> | 2017-07-31 23:32:10 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2017-07-31 23:32:10 +0800 |
commit | 68dac5c2e1972c3868503b8ce6208b455240c61c (patch) | |
tree | b689634105d5f89d5d95a4e0ad45021aa2431882 /fg21sim/extragalactic/clusters | |
parent | daa69f553da9fa847aa130d490bbb1d291eff0e3 (diff) | |
download | fg21sim-68dac5c2e1972c3868503b8ce6208b455240c61c.tar.bz2 |
Fix several small issues; Also update PSFormalism a bit
Signed-off-by: Aaron LI <aly@aaronly.me>
Diffstat (limited to 'fg21sim/extragalactic/clusters')
-rw-r--r-- | fg21sim/extragalactic/clusters/psformalism.py | 14 |
1 files changed, 10 insertions, 4 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"]) |