From 86e47b356a282b069901e75caed0d721aaa03151 Mon Sep 17 00:00:00 2001 From: LukasK13 Date: Mon, 18 May 2020 11:13:56 +0200 Subject: [PATCH] Check for equal length of SNR and exposure time --- esbo_etc/classes/Config.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/esbo_etc/classes/Config.py b/esbo_etc/classes/Config.py index 296a899..e3126d8 100644 --- a/esbo_etc/classes/Config.py +++ b/esbo_etc/classes/Config.py @@ -156,6 +156,11 @@ class Configuration(object): mes is not None and error("Configuration check: common -> snr: " + mes) self.conf.common.snr.val = readCSV(self.conf.common.snr.val, [u.dimensionless_unscaled], format_="csv").columns[0].quantity + if hasattr(self.conf.common, "exposure_time") and len(self.conf.common.snr.val) != len( + self.conf.common.exposure_time.val): + error( + "Configuration check: common -> snr: Length of exposure time (%d) not matching the length of " + "the SNR (%d)" % (len(self.conf.common.exposure_time.val), len(self.conf.common.snr.val))) if not (hasattr(self.conf.common, "exposure_time") or hasattr(self.conf.common, "snr")): error("Configuration check: common: Expected at least one of the containers 'exposure_time' or 'snr' but" + "got none.") @@ -220,7 +225,7 @@ class Configuration(object): """ if hasattr(conf, "optical_component"): for component in (conf.optical_component if type(conf.optical_component) == list else - [conf.optical_component]): + [conf.optical_component]): if not hasattr(component, "type"): return "optical_component: Missing required parameter 'type'." if component.type not in dir(oc): @@ -232,4 +237,4 @@ class Configuration(object): if mes is not None: print(component.type) print(mes) - return "optical_component -> " + component.type + ": " + mes \ No newline at end of file + return "optical_component -> " + component.type + ": " + mes