aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/extragalactic/clusters
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-10-25 11:56:01 +0800
committerAaron LI <aly@aaronly.me>2018-10-25 11:56:01 +0800
commit087822f918a0d6a814da064281305c8fde31b8fa (patch)
tree9d56445c846b492a95fdeb00b5c969b751642d17 /fg21sim/extragalactic/clusters
parent67b9349a8d1cdc786926a10d5ad3d0c2cc8a6d13 (diff)
downloadfg21sim-087822f918a0d6a814da064281305c8fde31b8fa.tar.bz2
clusters/halo: Change _merger() to accept time to simplify its usage
Diffstat (limited to 'fg21sim/extragalactic/clusters')
-rw-r--r--fg21sim/extragalactic/clusters/halo.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py
index 4e1b0bf..2236000 100644
--- a/fg21sim/extragalactic/clusters/halo.py
+++ b/fg21sim/extragalactic/clusters/halo.py
@@ -801,11 +801,13 @@ class RadioHaloAM(RadioHalo):
idx = self._merger_idx(t)
return self.age_merger[idx]
- def _merger(self, idx):
+ def _merger(self, t):
"""
- Return the properties of the idx-th merger event.
+ Return the merger event at cosmic time ``t``.
"""
+ idx = self._merger_idx(t)
return {
+ "idx": idx,
"M_main": self.M_main[idx],
"M_sub": self.M_sub[idx],
"z": self.z_merger[idx],
@@ -820,8 +822,7 @@ class RadioHaloAM(RadioHalo):
if t >= self.age_obs:
return self.M_obs
else:
- idx = self._merger_idx(t)
- merger = self._merger(idx)
+ merger = self._merger(t)
return (merger["M_main"] + merger["M_sub"])
def mass_sub(self, t):
@@ -829,8 +830,7 @@ class RadioHaloAM(RadioHalo):
The mass of the sub cluster at the given (cosmic) time.
Unit: [Msun]
"""
- idx = self._merger_idx(t)
- merger = self._merger(idx)
+ merger = self._merger(t)
return merger["M_sub"]
def mass_main(self, t):
@@ -849,17 +849,17 @@ class RadioHaloAM(RadioHalo):
The mass of the main cluster.
Unit: [Msun]
"""
- idx = self._merger_idx(t)
- merger1 = self._merger(idx)
+ merger1 = self._merger(t)
+ idx1 = merger1["idx"]
mass1 = merger1["M_main"]
t1 = merger1["age"]
- if idx == 0:
+ if idx1 == 0:
mass0 = self.M_obs
t0 = self.age_obs
else:
- merger0 = self._merger(idx-1)
- mass0 = merger0["M_main"]
- t0 = merger0["age"]
+ idx0 = idx1 - 1
+ mass0 = self.M_main[idx0]
+ t0 = self.age_merger[idx0]
rate = (mass0 - mass1) / (t0 - t1)
return (mass1 + rate * (t - t1))