From f6ea62f3c52b71c066b6d80cd6313e73a0267d71 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Mon, 23 Oct 2017 22:15:45 +0800 Subject: clusters/psformalism: Use functools.lru_cache() --- fg21sim/extragalactic/clusters/psformalism.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'fg21sim/extragalactic') 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. -- cgit v1.2.2