From a8f45b0a0329a6a9ffce58c0200c15540d7a43bd Mon Sep 17 00:00:00 2001
From: ahmedk <karim.ahmed@xfel.eu>
Date: Wed, 31 Jul 2024 16:16:33 +0200
Subject: [PATCH] fix: handle 50um case when there is no affixes and an
 input-source-template with no affixes placeholder

---
 src/cal_tools/gotthard2/gotthard2lib.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/cal_tools/gotthard2/gotthard2lib.py b/src/cal_tools/gotthard2/gotthard2lib.py
index 86f8ac6e8..8276a5049 100644
--- a/src/cal_tools/gotthard2/gotthard2lib.py
+++ b/src/cal_tools/gotthard2/gotthard2lib.py
@@ -6,10 +6,14 @@ import extra_data
 
 
 def map_da_to_source(dc, das, source_template, karabo_id, affixes):
-    source_names = [
-        source_template.format(karabo_id=karabo_id, input_source_affixes=aff)  # noqa
-        for aff in affixes
-    ]
+    if "{input_source_affixes}" in source_template:
+        source_names = [
+            source_template.format(karabo_id=karabo_id, input_source_affixes=aff)  # noqa
+            for aff in affixes
+        ]
+    else:  # e.g 50um doesnt need to have affixes.
+        source_names = [source_template.format(karabo_id=karabo_id)]
+
     if len(source_names) != len(das):
         raise ValueError(
             "Number of source names (and given affixes) "
-- 
GitLab