From c63ea48fe4faa9560d63476b4f6088967e935f32 Mon Sep 17 00:00:00 2001
From: Karim Ahmed <karim.ahmed@xfel.eu>
Date: Tue, 1 Sep 2020 16:21:26 +0200
Subject: [PATCH] no latex table in case of 0 sequences

---
 ...Jungfrau_Gain_Correct_and_Verify_NBC.ipynb | 20 ++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb b/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb
index ee7241236..61ffef34c 100644
--- a/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb
+++ b/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb
@@ -157,15 +157,17 @@
     "print(f\"Processing a total of {total_sequences} sequence files\")\n",
     "table = []\n",
     "fi = 0\n",
-    "for i, key in enumerate(mapped_files):\n",
-    "    for k, f in enumerate(list(mapped_files[key].queue)):\n",
-    "        if k == 0:\n",
-    "            table.append((fi, karabo_da[i], k, f))\n",
-    "        else:\n",
-    "            table.append((fi, \"\", k,  f))\n",
-    "        fi += 1\n",
-    "md = display(Latex(tabulate.tabulate(table, tablefmt='latex',\n",
-    "                                     headers=[\"#\", \"module\", \"# module\", \"file\"])))\n",
+    "# avoid creating a table in case of 0 sequences\n",
+    "if total_sequences:\n",
+    "    for i, key in enumerate(mapped_files):\n",
+    "        for k, f in enumerate(list(mapped_files[key].queue)):\n",
+    "            if k == 0:\n",
+    "                table.append((fi, karabo_da[i], k, f))\n",
+    "            else:\n",
+    "                table.append((fi, \"\", k,  f))\n",
+    "            fi += 1\n",
+    "    md = display(Latex(tabulate.tabulate(table, tablefmt='latex',\n",
+    "                                         headers=[\"#\", \"module\", \"# module\", \"file\"])))\n",
     "\n",
     "# restore the queue\n",
     "mmf = map_modules_from_folder(in_folder, run, path_template, karabo_da, sequences)\n",
-- 
GitLab