aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/extragalactic/clusters/emission.py
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-10-23 21:11:07 +0800
committerAaron LI <aly@aaronly.me>2017-10-23 21:11:07 +0800
commitc1a561a8c05a7e59cdf3a34ac2112eed5ea7c406 (patch)
treedc187a7b7d24f50c9d1a765b2f78be9e827bd301 /fg21sim/extragalactic/clusters/emission.py
parent6fa552dca1ad74f39a7d1d44e55d9eb8eaa4a9b9 (diff)
downloadfg21sim-c1a561a8c05a7e59cdf3a34ac2112eed5ea7c406.tar.bz2
clusters/halo: Use "lru_cache()", also improves some performance
Diffstat (limited to 'fg21sim/extragalactic/clusters/emission.py')
-rw-r--r--fg21sim/extragalactic/clusters/emission.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/fg21sim/extragalactic/clusters/emission.py b/fg21sim/extragalactic/clusters/emission.py
index 5195423..4801eba 100644
--- a/fg21sim/extragalactic/clusters/emission.py
+++ b/fg21sim/extragalactic/clusters/emission.py
@@ -25,6 +25,7 @@ References
"""
import logging
+from functools import lru_cache
import numpy as np
import scipy.special
@@ -102,6 +103,7 @@ class SynchrotronEmission:
self.B = B # [uG]
@property
+ @lru_cache()
def B_gauss(self):
"""
Magnetic field in unit of [G] (i.e., Gauss)
@@ -109,6 +111,7 @@ class SynchrotronEmission:
return self.B * 1e-6 # [uG] -> [G]
@property
+ @lru_cache()
def frequency_larmor(self):
"""
Electron Larmor frequency (a.k.a. gyro frequency):