From 7c48b70a5be4ba0671707b4be0973573e4fce927 Mon Sep 17 00:00:00 2001
From: Philipp Schmidt <philipp.schmidt@xfel.eu>
Date: Sun, 17 Oct 2021 07:59:29 +0200
Subject: [PATCH] Minor fixes to AGIPD PPU code from testing

---
 notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
index c51bddf95..f7ceefad2 100644
--- a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
+++ b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
@@ -228,7 +228,7 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "if sequences[0] == -1:\n",
+    "if sequences == [-1]:\n",
     "    sequences = None\n",
     "\n",
     "control_fn = in_folder / f'r{run:04d}' / f'RAW-R{run:04d}-{karabo_da_control}-S00000.h5'\n",
@@ -285,13 +285,13 @@
     "    dc = RunDirectory(in_folder / f'r{run:04d}')\n",
     "\n",
     "    # Will throw an uncaught exception if the device is wrong.\n",
-    "    seq_start = run[use_ppu_device, 'trainTrigger.sequenceStart.value'].ndarray()\n",
+    "    seq_start = dc[use_ppu_device, 'trainTrigger.sequenceStart.value'].ndarray()\n",
     "\n",
     "    # The trains picked are the unique values of trainTrigger.sequenceStart\n",
     "    # minus the first (previous trigger before this run).\n",
     "    train_ids = np.unique(seq_start)[1:] + ppu_train_offset\n",
     "\n",
-    "    print(f'PPU device {use_ppu_device} triggered for {len(train_ids)} trains')\n",
+    "    print(f'PPU device {use_ppu_device} triggered for {len(train_ids)} train(s)')\n",
     "    \n",
     "    # Since we got the DataCollection already, narrow down the files we open.\n",
     "    # This hardcodes the receiver_id and path_template parameters currently, but this\n",
@@ -299,7 +299,7 @@
     "    subdc = dc.select_trains(by_id[train_ids]).select(f'{karabo_id}/DET/*CH0:xtdf')\n",
     "    subseq = {int(f.filename[-8:-3]) for f in subdc.files}\n",
     "    \n",
-    "    if sequences == [-1]:\n",
+    "    if sequences is None:\n",
     "        # All sequences were meant to be processed by this job, so take the entire\n",
     "        # subset of sequences.\n",
     "        sequences = sorted(subseq)\n",
@@ -312,7 +312,7 @@
     "    # Specific trains passed by parameter, convert to ndarray.\n",
     "    train_ids = np.array(train_ids)\n",
     "    \n",
-    "    print(f'Processing up to {len(train_ids)} manually selected trains')\n",
+    "    print(f'Processing up to {len(train_ids)} manually selected train(s)')\n",
     "else:\n",
     "    # Process all trains.\n",
     "    train_ids = None\n",
-- 
GitLab