From 34f3fbf180c86ad11b586040a03b0be4bded0151 Mon Sep 17 00:00:00 2001
From: Philipp Schmidt <philipp.schmidt@xfel.eu>
Date: Thu, 7 Oct 2021 15:29:05 +0200
Subject: [PATCH] Add manual train_ids parameter to AGIPD correct notebook

---
 notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
index 147757da0..34038d771 100644
--- a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
+++ b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
@@ -21,6 +21,7 @@
     "out_folder = \"/gpfs/exfel/data/scratch/ahmedk/test/hibef_agipd2\"  # the folder to output to, required\n",
     "sequences = [-1] # sequences to correct, set to -1 for all, range allowed\n",
     "modules = [-1] # modules to correct, set to -1 for all, range allowed\n",
+    "train_ids = [-1] # train IDs to correct, set to -1 for all, range allowed\n",
     "run = 155 # runs to process, required\n",
     "\n",
     "karabo_id = \"HED_DET_AGIPD500K2G\" # karabo karabo_id\n",
@@ -390,8 +391,8 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "# Obtain trains to process if using a pulse picker device.\n",
     "if use_ppu_device:\n",
+    "    # Obtain trains to process if using a pulse picker device.\n",
     "    run = RunDirectory(in_folder / f'r{run:04d}')\n",
     "\n",
     "    # Will throw an uncaught exception if the device is wrong.\n",
@@ -403,7 +404,11 @@
     "\n",
     "    print(f'PPU device {use_ppu_device} triggered for {len(train_ids)} trains')\n",
     "\n",
+    "elif train_ids[0] != [-1]:\n",
+    "    # Specific trains passed by parameter, convert to ndarray.\n",
+    "    train_ids = np.array(train_ids)\n",
     "else:\n",
+    "    # Process all trains.\n",
     "    train_ids = None"
    ]
   },
-- 
GitLab