From 8e563e91d8b0dc239e124fb7e88d84c1c8506b67 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Thu, 21 Feb 2019 20:52:44 +0800 Subject: clusters/halo: Implement _merger_end_time() method Determine the ending time of the most recent merger happened before the given time. --- fg21sim/extragalactic/clusters/halo.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'fg21sim') diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py index eb873ec..5eda8da 100644 --- a/fg21sim/extragalactic/clusters/halo.py +++ b/fg21sim/extragalactic/clusters/halo.py @@ -672,6 +672,13 @@ class RadioHalo1M: """ return self.t_merger + def _merger_end_time(self, t=None): + """ + The (cosmic) time when the merger ends. + Unit: [Gyr] + """ + return self.t_merger_end + def _validate_time(self, t, include_end=True): """ Validate that the given time ``t`` is the time when a merger begins @@ -921,6 +928,17 @@ class RadioHaloAM(RadioHalo1M): m = self._merger_event(t) return m["t"] + def _merger_end_time(self, t): + """ + Determine the ending time of the most recent merger happened before + the given time. + + Unit: [Gyr] + """ + t_end = np.sort(self.t_merger_end) # increasing order + idx = (t_end <= t).sum() - 1 + return t_end[idx] + @property @lru_cache() def _time_adjust(self): -- cgit v1.2.2