From 6f28b7d037dbbe3aba0a0e2cf0c3ffcd51643987 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Fri, 5 Jan 2018 20:57:59 +0800 Subject: clusters/halo: fix _merger_time() error when t < age_begin --- fg21sim/extragalactic/clusters/halo.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'fg21sim') 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): """ -- cgit v1.2.2