From 02d9b9bc2263d4eabee8a07bbf8c7606255fa761 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Tue, 16 May 2017 14:21:58 +0800 Subject: configs: Use separate section "foregrounds" to config components Also update copyright information. --- fg21sim/configs/manager.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'fg21sim/configs/manager.py') diff --git a/fg21sim/configs/manager.py b/fg21sim/configs/manager.py index 7818d1c..1cddb75 100644 --- a/fg21sim/configs/manager.py +++ b/fg21sim/configs/manager.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 Weitian LI +# Copyright (c) 2016-2017 Weitian LI # MIT license # # References: @@ -454,6 +454,22 @@ class ConfigManager: logger.warning("Cannot convert to absolute path: %s" % path) return os.path.normpath(path) + @property + def foregrounds(self): + """Get all available and enabled foreground components. + + Returns + ------- + enabled : list[str] + Enabled foreground components to be simulated + available : list[str] + All available foreground components + """ + fg = self.get("foregrounds") + avaliable = list(fg.keys()) + enabled = [key for key, value in fg.items() if value] + return (enabled, avaliable) + @property def frequencies(self): """Get or calculate if ``frequency/type = custom`` the frequencies -- cgit v1.2.2