aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/extragalactic/clusters
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-01-05 20:57:59 +0800
committerAaron LI <aly@aaronly.me>2018-01-05 20:57:59 +0800
commit6f28b7d037dbbe3aba0a0e2cf0c3ffcd51643987 (patch)
tree8d140c93e6d805308e666569b491f9b6635d0bb7 /fg21sim/extragalactic/clusters
parentf4ed13d9eef250a8a2b094c53e93d6b7316bd0f4 (diff)
downloadfg21sim-6f28b7d037dbbe3aba0a0e2cf0c3ffcd51643987.tar.bz2
clusters/halo: fix _merger_time() error when t < age_begin
Diffstat (limited to 'fg21sim/extragalactic/clusters')
-rw-r--r--fg21sim/extragalactic/clusters/halo.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py
index d536ba4..ace50d1 100644
--- a/fg21sim/extragalactic/clusters/halo.py
+++ b/fg21sim/extragalactic/clusters/halo.py
@@ -707,6 +707,8 @@ class RadioHalo:
in the ICM that the turbulence could effectively accelerate the
relativistic electrons.
"""
+ if t < self.age_begin:
+ return False
t_merger = self._merger_time(t)
t_turb = self.time_turbulence(t=t_merger)
if (t >= t_merger) or (t <= t_merger + t_turb):
@@ -813,8 +815,11 @@ class RadioHaloAM(RadioHalo):
Determine the beginning time of the merger event within which
the given time is located.
"""
- idx = self._merger_idx(t)
- return self.age_merger[idx]
+ try:
+ idx = self._merger_idx(t)
+ return self.age_merger[idx]
+ except IndexError:
+ return None
def _merger(self, idx):
"""