diff options
author | Aaron LI <aly@aaronly.me> | 2018-01-01 23:36:32 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2018-01-01 23:36:32 +0800 |
commit | 655e9e5e0c342af57c942fe36e7baf3c60d8c21c (patch) | |
tree | e7c7ad70d8e4ed71b96ecf57b44336c363072e39 /fg21sim | |
parent | 55483e5408ce122cf43059f53409c19ca7adeeb9 (diff) | |
download | fg21sim-655e9e5e0c342af57c942fe36e7baf3c60d8c21c.tar.bz2 |
clusters/formation: add "mergers()" to extract all the merger events
Diffstat (limited to 'fg21sim')
-rw-r--r-- | fg21sim/extragalactic/clusters/formation.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/fg21sim/extragalactic/clusters/formation.py b/fg21sim/extragalactic/clusters/formation.py index 7d7b9a2..e7595d5 100644 --- a/fg21sim/extragalactic/clusters/formation.py +++ b/fg21sim/extragalactic/clusters/formation.py @@ -197,6 +197,10 @@ class ClusterFormation: Parameters ---------- + mtree : `~MergerTree`, optional + Specify the merger tree from which to identify the most + recent merger event. + Default: self.mtree ratio_major : float, optional The mass ratio of the main and sub clusters to define whether the merger is a major event or a minor one. @@ -258,6 +262,38 @@ class ClusterFormation: else: return event_max + def mergers(self, mtree=None): + """ + Extract and return all the merger events. + + Parameters + ---------- + mtree : `~MergerTree`, optional + Specify the merger tree from which to identify the most + recent merger event. + Default: self.mtree + + Returns + ------- + evlist : list[event] + List of merger events with each element being a dictionary + same as the return of ``self.recent_major_merger``. + """ + if mtree is None: + mtree = self.mtree + + evlist = [] + for main, sub in mtree.itermain(): + if sub: + evlist.append({ + "M_main": main["mass"], + "M_sub": sub["mass"], + "R_mass": main["mass"] / sub["mass"], + "z": main["z"], + "age": main["age"] + }) + return evlist + def _trace_main(self): """ Iteratively trace the merger and accretion events of the |