aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-10-23 22:15:45 +0800
committerAaron LI <aly@aaronly.me>2017-10-23 22:15:45 +0800
commitf6ea62f3c52b71c066b6d80cd6313e73a0267d71 (patch)
treed34cbdc8dce6e7f2cb31b737e38513c5156c4a03
parent998c64d7b5d54d1ef209f8eaf0992216ed130f67 (diff)
downloadfg21sim-f6ea62f3c52b71c066b6d80cd6313e73a0267d71.tar.bz2
clusters/psformalism: Use functools.lru_cache()
-rw-r--r--fg21sim/extragalactic/clusters/psformalism.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/fg21sim/extragalactic/clusters/psformalism.py b/fg21sim/extragalactic/clusters/psformalism.py
index da2796d..3489eb5 100644
--- a/fg21sim/extragalactic/clusters/psformalism.py
+++ b/fg21sim/extragalactic/clusters/psformalism.py
@@ -12,6 +12,7 @@ and redshift for each cluster.
import logging
import random
+from functools import lru_cache
import numpy as np
import pandas as pd
@@ -86,6 +87,7 @@ class PSFormalism:
return massfunc
@property
+ @lru_cache()
def z(self):
"""
The redshift points where to calculate the dndlnm data.
@@ -93,6 +95,7 @@ class PSFormalism:
return np.arange(self.z_min, self.z_max+self.z_step/2, self.z_step)
@property
+ @lru_cache()
def mass(self):
"""
The mass points where to calculate the dndlnm data.