From 8b51a48468b9fc15537716ab5680bd28f2542f30 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Tue, 4 Oct 2016 10:44:54 +0800 Subject: configs/manager.py: Add "frequencies" property The "frequencies" property will return or calculate the frequency values of the simulation. --- fg21sim/configs/manager.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'fg21sim') diff --git a/fg21sim/configs/manager.py b/fg21sim/configs/manager.py index 81351ad..18b9024 100644 --- a/fg21sim/configs/manager.py +++ b/fg21sim/configs/manager.py @@ -115,6 +115,22 @@ class ConfigManager: keys = keys.split(sep) return reduce(dict.get, keys, self._config) + @property + def frequencies(self): + """Get (calculate if necessary) )the frequencies at which to + carry out the simulations. + """ + if self.getn("frequency/type") == "custom": + frequencies = self.getn("frequency/frequencies") + else: + # calculate the frequency values + start = self.getn("frequency/start") + stop = self.getn("frequency/stop") + step = self.getn("frequency/step") + num = int((stop - start) / step + 1) + frequencies = [start + step*i for i in range(num)] + return frequencies + @property def logging(self): """Get and prepare the logging configurations for -- cgit v1.2.2