aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/extragalactic/clusters
diff options
context:
space:
mode:
Diffstat (limited to 'fg21sim/extragalactic/clusters')
-rw-r--r--fg21sim/extragalactic/clusters/formation.py10
-rw-r--r--fg21sim/extragalactic/clusters/main.py1
2 files changed, 9 insertions, 2 deletions
diff --git a/fg21sim/extragalactic/clusters/formation.py b/fg21sim/extragalactic/clusters/formation.py
index 193c7ec..bfe2142 100644
--- a/fg21sim/extragalactic/clusters/formation.py
+++ b/fg21sim/extragalactic/clusters/formation.py
@@ -256,9 +256,11 @@ class ClusterFormation:
event :
A dictionary representing this merger event, same format as
the above ``self.recent_major_event``.
+ ``None`` if no mergers occurred during the traced period.
"""
mtree = self.mtree
- event_max = {"M_main": 0, "M_sub": 0, "R_mass": 0, "z": 0, "age": 0}
+ event_max = {"M_main": -1, "M_sub": -1, "R_mass": -1,
+ "z": -1, "age": -1}
event_major = None # Record the most recent major merger event
while mtree and mtree.main:
if mtree.sub is None:
@@ -286,7 +288,11 @@ class ClusterFormation:
if event_major and abs(event_major["z"]-event_max["z"]) > 1e-4:
logger.warning("recent major merger != maximum merger")
- return event_max
+ if event_max["z"] <= 0:
+ logger.warning("no mergers occurred at all!!")
+ return None
+ else:
+ return event_max
def _trace_main(self):
"""
diff --git a/fg21sim/extragalactic/clusters/main.py b/fg21sim/extragalactic/clusters/main.py
index 1aeb522..0be553a 100644
--- a/fg21sim/extragalactic/clusters/main.py
+++ b/fg21sim/extragalactic/clusters/main.py
@@ -216,6 +216,7 @@ class GalaxyClusters:
merger_mass_min=self.merger_mass_min)
clform.simulate_mergertree(main_only=True)
if self.use_max_merger:
+ # NOTE: may be ``None`` due to no mergers occurred at all!
mmev = clform.max_merger
else:
mmev = clform.recent_major_merger