From f5d8dab64c9dc9b7486830260ed0654041039e08 Mon Sep 17 00:00:00 2001 From: Jeremie Fouquet Date: Mon, 26 Jun 2023 10:45:09 -0400 Subject: [PATCH 1/3] Output None for inexistent parameter Output explanatory string in BIDS json --- brkraw/lib/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brkraw/lib/utils.py b/brkraw/lib/utils.py index a75d5f2..c61f038 100644 --- a/brkraw/lib/utils.py +++ b/brkraw/lib/utils.py @@ -263,7 +263,7 @@ def meta_check_source(key_string, acqp, method, visu_pars): for i, ans in enumerate(key_exist): if ans: return get_value(pool[i], key_string) - return key_string + return None def yes_or_no(question): From cf828bcd72e89e83d49eaaa6be80df6ff042c933 Mon Sep 17 00:00:00 2001 From: Jeremie Fouquet Date: Fri, 2 Feb 2024 11:47:20 -0500 Subject: [PATCH 2/3] Revert "Output None for inexistent parameter" This reverts commit f5d8dab64c9dc9b7486830260ed0654041039e08. --- brkraw/lib/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/brkraw/lib/utils.py b/brkraw/lib/utils.py index c61f038..a75d5f2 100644 --- a/brkraw/lib/utils.py +++ b/brkraw/lib/utils.py @@ -263,7 +263,7 @@ def meta_check_source(key_string, acqp, method, visu_pars): for i, ans in enumerate(key_exist): if ans: return get_value(pool[i], key_string) - return None + return key_string def yes_or_no(question): From 30c025a4d82ca080c9a19dd175ed0f8addc36423 Mon Sep 17 00:00:00 2001 From: Jeremie Fouquet Date: Fri, 2 Feb 2024 11:54:22 -0500 Subject: [PATCH 3/3] Assign None when val is string inside meta_check_express --- brkraw/lib/utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/brkraw/lib/utils.py b/brkraw/lib/utils.py index a75d5f2..46ff41d 100644 --- a/brkraw/lib/utils.py +++ b/brkraw/lib/utils.py @@ -249,6 +249,8 @@ def meta_check_express(value, acqp, method, visu_pars): if k != 'Equation': exec('global {}'.format(k)) val = meta_get_value(v, acqp, method, visu_pars) + if isinstance(val, str): + val = None exec('{} = {}'.format(k, val)) try: exec("output = {}".format(value['Equation']), globals(), lcm)