aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/extragalactic
diff options
context:
space:
mode:
Diffstat (limited to 'fg21sim/extragalactic')
-rw-r--r--fg21sim/extragalactic/clusters/formation.py43
1 files changed, 42 insertions, 1 deletions
diff --git a/fg21sim/extragalactic/clusters/formation.py b/fg21sim/extragalactic/clusters/formation.py
index 59c8cbe..c1a93bf 100644
--- a/fg21sim/extragalactic/clusters/formation.py
+++ b/fg21sim/extragalactic/clusters/formation.py
@@ -49,6 +49,11 @@ class ClusterFormation:
zmax : float, optional
The maximum redshift/age when to stop the formation trace.
Default: 3.0 (i.e., looking back time ~11.5 Gyr)
+ 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.
+ If ``M_main/M_sub < ratio_major``, then it is a major merger event.
+ Default: 3.0
cosmo : `~Cosmology`, optional
Adopted cosmological model with custom utility functions.
merger_mass_min : float, optional
@@ -61,11 +66,12 @@ class ClusterFormation:
mtree : `~MergerTree`
Merging history of this cluster.
"""
- def __init__(self, M0, z0, zmax=3.0,
+ def __init__(self, M0, z0, zmax=3.0, ratio_major=3.0,
cosmo=Cosmology(), merger_mass_min=1e12):
self.M0 = M0 # [Msun]
self.z0 = z0
self.zmax = zmax
+ self.ratio_major = ratio_major
self.cosmo = cosmo
self.merger_mass_min = merger_mass_min
@@ -196,6 +202,41 @@ class ClusterFormation:
logger.info("Simulated cluster formation with merger tree")
return self.mtree
+ @property
+ def last_major_merger(self):
+ """
+ Identify and return the last major merger event
+
+ Returns
+ -------
+ event :
+ An dictionary containing the properties of the found major
+ event:
+ ``{"M_main": M_main, "M_sub": M_sub, "z": z, "age": age}``;
+ ``None`` if no major event found.
+ """
+ mtree = self.mtree
+ event = None
+ while mtree and mtree.main:
+ if mtree.sub is None:
+ mtree = mtree.main
+ continue
+
+ M_main = mtree.main["mass"]
+ M_sub = mtree.sub["mass"]
+ z = mtree.main["z"]
+ age = mtree.main["age"]
+ if M_main / M_sub < self.ratio_major:
+ # Found a major merger event
+ event = {"M_main": M_main, "M_sub": M_sub,
+ "z": z, "age": age}
+ break
+
+ # A minor merger event, continue
+ mtree = mtree.main
+
+ return event
+
def _trace_main(self):
"""
Iteratively trace the merger and accretion events of the