From 154a735908b5d30b4890a6c8a265ec9e25b972a5 Mon Sep 17 00:00:00 2001 From: Enrico Faulhaber Date: Mon, 18 Jun 2018 16:37:46 +0200 Subject: [PATCH] Allow units of parameters to reference the unit of the main value via using '$' as special char. Change-Id: Idfbad84b76d2f5161cb6ecc21d63349f23cd47fa Reviewed-on: https://forge.frm2.tum.de/review/18188 Tested-by: JenkinsCodeReview Reviewed-by: Enrico Faulhaber --- secop/modules.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/secop/modules.py b/secop/modules.py index a1def52..defefd2 100644 --- a/secop/modules.py +++ b/secop/modules.py @@ -367,7 +367,10 @@ class Module(object): # to cache the current value + qualifiers... params = {} for k, v in list(self.parameters.items()): - params[k] = v.copy() + entry = v.copy() + if '$' in entry.unit: + entry.unit = entry.unit.replace('$', self.parameters['value'].unit) + params[k] = entry # do not re-use self.parameters as this is the same for all instances self.parameters = params