diff options
author | Aaron LI <aly@aaronly.me> | 2017-10-22 16:20:27 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2017-10-22 16:20:27 +0800 |
commit | ca93978b0e758a8c7a11cdff37aff6a1e3fd1134 (patch) | |
tree | c39774e942ece2bbbbca1cf1f0fc9ca36904f7bf /fg21sim/extragalactic/clusters | |
parent | a42a613f3a1328ca0582bef19e024868fa3a3ad5 (diff) | |
download | fg21sim-ca93978b0e758a8c7a11cdff37aff6a1e3fd1134.tar.bz2 |
clusters/formation: Add method to found the maximum merger event
Diffstat (limited to 'fg21sim/extragalactic/clusters')
-rw-r--r-- | fg21sim/extragalactic/clusters/formation.py | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/fg21sim/extragalactic/clusters/formation.py b/fg21sim/extragalactic/clusters/formation.py index f92c868..193c7ec 100644 --- a/fg21sim/extragalactic/clusters/formation.py +++ b/fg21sim/extragalactic/clusters/formation.py @@ -217,6 +217,7 @@ class ClusterFormation: event = None while mtree and mtree.main: if mtree.sub is None: + # Accretion mtree = mtree.main continue @@ -224,7 +225,7 @@ class ClusterFormation: M_sub = mtree.sub.data["mass"] z = mtree.main.data["z"] age = mtree.main.data["age"] - if M_main / M_sub < self.ratio_major: + if M_main / M_sub <= self.ratio_major: # Found a major merger event event = {"M_main": M_main, "M_sub": M_sub, @@ -238,6 +239,55 @@ class ClusterFormation: return event + @property + def max_merger(self): + """ + The merger event corresponding to the biggest sub cluster, i.e., + the main cluster gains most mass. + + NOTE + ---- + Generally, the above most recent major merger event, if identified, + should also be maximum merger found here. Otherwise, a warning + message is logged. + + Returns + ------- + event : + A dictionary representing this merger event, same format as + the above ``self.recent_major_event``. + """ + mtree = self.mtree + event_max = {"M_main": 0, "M_sub": 0, "R_mass": 0, "z": 0, "age": 0} + event_major = None # Record the most recent major merger event + while mtree and mtree.main: + if mtree.sub is None: + mtree = mtree.main + continue + + M_main = mtree.main.data["mass"] + M_sub = mtree.sub.data["mass"] + z = mtree.main.data["z"] + age = mtree.main.data["age"] + if (M_sub > event_max["M_sub"]): + # Track the found maximum merger + event_max = {"M_main": M_main, "M_sub": M_sub, + "R_mass": M_main / M_sub, + "z": z, "age": age} + if (event_major is None) and (M_main/M_sub <= self.ratio_major): + # Most recent major merger event + event_major = {"M_main": M_main, "M_sub": M_sub, + "R_mass": M_main / M_sub, + "z": z, "age": age} + + # Continue + mtree = mtree.main + + if event_major and abs(event_major["z"]-event_max["z"]) > 1e-4: + logger.warning("recent major merger != maximum merger") + + return event_max + def _trace_main(self): """ Iteratively trace the merger and accretion events of the |