aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-01-01 23:02:13 +0800
committerAaron LI <aly@aaronly.me>2018-01-01 23:02:13 +0800
commit925d4a2e42601db7fef20b13ac0238478b51bd66 (patch)
treed4f867904956cd40ebd5eb6d50bcb82b0af46dfd /fg21sim
parenta543598a41af2b1488d59b57a0960e7261b37051 (diff)
downloadfg21sim-925d4a2e42601db7fef20b13ac0238478b51bd66.tar.bz2
clusters/mergertree: add param mtree to maximum_merger and recent_major_merger
Diffstat (limited to 'fg21sim')
-rw-r--r--fg21sim/extragalactic/clusters/formation.py11
-rw-r--r--fg21sim/extragalactic/clusters/main.py4
2 files changed, 8 insertions, 7 deletions
diff --git a/fg21sim/extragalactic/clusters/formation.py b/fg21sim/extragalactic/clusters/formation.py
index a48d68e..38f7764 100644
--- a/fg21sim/extragalactic/clusters/formation.py
+++ b/fg21sim/extragalactic/clusters/formation.py
@@ -192,7 +192,7 @@ class ClusterFormation:
logger.debug("Simulated cluster formation with merger tree.")
return self.mtree
- def recent_major_merger(self, ratio_major=3.0):
+ def recent_major_merger(self, mtree=None, ratio_major=3.0):
"""
Identify and return the most recent major merger event.
@@ -213,7 +213,8 @@ class ClusterFormation:
"z": z, "age": age}``;
``None`` if no major event found.
"""
- mtree = self.mtree
+ if mtree is None:
+ mtree = self.mtree
event = None
while mtree and mtree.main:
if mtree.sub is None:
@@ -239,8 +240,7 @@ class ClusterFormation:
return event
- @property
- def maximum_merger(self):
+ def maximum_merger(self, mtree=None):
"""
The merger event corresponding to the biggest sub cluster, i.e.,
the main cluster gains the most mass.
@@ -257,7 +257,8 @@ class ClusterFormation:
the above ``self.recent_major_event``.
``None`` if no mergers occurred during the traced period.
"""
- mtree = self.mtree
+ if mtree is None:
+ mtree = self.mtree
event_max = {"M_main": -1, "M_sub": -1, "R_mass": -1,
"z": -1, "age": -1}
while mtree and mtree.main:
diff --git a/fg21sim/extragalactic/clusters/main.py b/fg21sim/extragalactic/clusters/main.py
index 9d3810d..b704938 100644
--- a/fg21sim/extragalactic/clusters/main.py
+++ b/fg21sim/extragalactic/clusters/main.py
@@ -217,9 +217,9 @@ class GalaxyClusters:
clform.simulate_mtree(main_only=True)
if self.use_max_merger:
# NOTE: may be ``None`` due to no mergers occurred at all!
- mmev = clform.maximum_merger
+ mmev = clform.maximum_merger()
else:
- mmev = clform.recent_major_merger(self.ratio_major)
+ mmev = clform.recent_major_merger(ratio_major=self.ratio_major)
if mmev:
mdata[i, :] = [mmev["M_main"], mmev["M_sub"],
mmev["z"], mmev["age"]]