aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2019-02-21 18:32:57 +0800
committerAaron LI <aly@aaronly.me>2019-02-21 18:32:57 +0800
commit261c97a6f2bac601014ec3337328dc1fd4155f4a (patch)
tree111ac29e2322a68b8f5ff8dc6394493f7de68bcc
parent528d71723f5c58261a6907528ab814f8f590b13f (diff)
downloadfg21sim-261c97a6f2bac601014ec3337328dc1fd4155f4a.tar.bz2
clusters/halo: Apply @property and @lru_cache() to _time_adjust()
-rw-r--r--fg21sim/extragalactic/clusters/halo.py4
1 files changed, 3 insertions, 1 deletions
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: