From 6a0b4c2c23c70a43f50109cfdc76e2e70b6a9cc6 Mon Sep 17 00:00:00 2001 From: Mikhail Karnevskiy <karnem@max-exfl015.desy.de> Date: Thu, 30 Aug 2018 12:00:50 +0200 Subject: [PATCH] Add check of the type of given concurrency parameter. Convert to a list if needed. --- xfel_calibrate/calibrate.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/xfel_calibrate/calibrate.py b/xfel_calibrate/calibrate.py index 40e03443d..ea9bc3547 100755 --- a/xfel_calibrate/calibrate.py +++ b/xfel_calibrate/calibrate.py @@ -424,12 +424,19 @@ def run(): if not isinstance(defcval, (list, tuple)): cvals = range(defcval) else: - cvals = defcval - else: - for p in parms: - if p.name == cvar: - cvals = p.value - print("Concurrency parameter '{}' is taken from '{}'".format(cvar, notebook)) + cvals = defcval + + if cvals is None: + print (parms) + for p in parms: + if p.name == cvar: + defcval = p.value + if defcval is not None: + print("Concurrency parameter '{}' is taken from '{}'".format(cvar, notebook)) + if not isinstance(defcval, (list, tuple)): + cvals = [defcval] + else: + cvals = defcval if con_func: func = get_concurrency_function(nb, con_func) -- GitLab