From 261c97a6f2bac601014ec3337328dc1fd4155f4a Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Thu, 21 Feb 2019 18:32:57 +0800 Subject: clusters/halo: Apply @property and @lru_cache() to _time_adjust() --- fg21sim/extragalactic/clusters/halo.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fg21sim/extragalactic/clusters/halo.py b/fg21sim/extragalactic/clusters/halo.py index d42d236..4c27dc0 100644 --- a/fg21sim/extragalactic/clusters/halo.py +++ b/fg21sim/extragalactic/clusters/halo.py @@ -935,6 +935,8 @@ class RadioHaloAM(RadioHalo1M): m = self._merger_event(t) return m["t"] + @property + @lru_cache() def _time_adjust(self): """ Determine the time points when spectrum adjustment is needed. @@ -1032,7 +1034,7 @@ class RadioHaloAM(RadioHalo1M): return n_e logger.debug("Calculating the electron spectrum ...") - tps = [self.t_begin] + self._time_adjust() + [self.t_obs] + tps = [self.t_begin] + self._time_adjust + [self.t_obs] n1_e = n0_e for t1, t2 in zip(tps, tps[1:]): if tstart >= t2 or tstop < t1: -- cgit v1.2.2