diff options
author | Aaron LI <aly@aaronly.me> | 2018-01-01 23:02:13 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2018-01-01 23:02:13 +0800 |
commit | 925d4a2e42601db7fef20b13ac0238478b51bd66 (patch) | |
tree | d4f867904956cd40ebd5eb6d50bcb82b0af46dfd /fg21sim | |
parent | a543598a41af2b1488d59b57a0960e7261b37051 (diff) | |
download | fg21sim-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.py | 11 | ||||
-rw-r--r-- | fg21sim/extragalactic/clusters/main.py | 4 |
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"]] |