diff options
author | Aaron LI <aaronly.me@outlook.com> | 2016-10-04 10:44:54 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@outlook.com> | 2016-10-04 10:44:54 +0800 |
commit | 8b51a48468b9fc15537716ab5680bd28f2542f30 (patch) | |
tree | ee1747f32b7b09ca29153119261e7b9b6360db50 /fg21sim | |
parent | 3c6e976827fe382661c2d3682caa597e695bef5c (diff) | |
download | fg21sim-8b51a48468b9fc15537716ab5680bd28f2542f30.tar.bz2 |
configs/manager.py: Add "frequencies" property
The "frequencies" property will return or calculate the frequency
values of the simulation.
Diffstat (limited to 'fg21sim')
-rw-r--r-- | fg21sim/configs/manager.py | 16 |
1 files changed, 16 insertions, 0 deletions
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 @@ -116,6 +116,22 @@ class ConfigManager: 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 ``logging.basicConfig()`` to initialize the logging module. |