From bc4c791e6d05cc32a63a1b483b9cf5e088138a15 Mon Sep 17 00:00:00 2001
From: Philipp Schmidt <philipp.schmidt@xfel.eu>
Date: Tue, 18 Oct 2022 10:46:41 +0200
Subject: [PATCH] Include PPT entry for each pulse in triggers table

---
 notebooks/REMI/REMI_Digitize_and_Transform.ipynb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/notebooks/REMI/REMI_Digitize_and_Transform.ipynb b/notebooks/REMI/REMI_Digitize_and_Transform.ipynb
index 34dfdee8d..57b80daaa 100644
--- a/notebooks/REMI/REMI_Digitize_and_Transform.ipynb
+++ b/notebooks/REMI/REMI_Digitize_and_Transform.ipynb
@@ -248,7 +248,7 @@
     "\n",
     "psh.set_default_context('processes', num_workers=remi.get_num_workers(mp_find_triggers))\n",
     "\n",
-    "triggers = psh.alloc(shape=(num_pulses,), dtype=trigger_dt, fill=(-1, -1, np.nan, 0, 0))\n",
+    "triggers = psh.alloc(shape=(num_pulses,), dtype=trigger_dt, fill=(-1, -1, np.nan, -1, 0, 0))\n",
     "\n",
     "clock_factor = remi['digitizer']['clock_factor']\n",
     "\n",
@@ -282,6 +282,7 @@
     "    train_triggers['start'] = start_int\n",
     "    train_triggers['stop'] = start_int + int(pulse_len * 2 * clock_factor) - 1\n",
     "    train_triggers['offset'] = start_frac - start_int\n",
+    "    train_triggers['pulse'] = all_pos.astype(np.int16)\n",
     "    train_triggers['fel'] = [pos in fel_pos for pos in all_pos]\n",
     "    train_triggers['ppl'] = [pos in ppl_pos for pos in all_pos]\n",
     "\n",
@@ -316,13 +317,12 @@
     "\n",
     "lx.vlines(pulse_offsets[:n_trains], 0, max_start, color='grey', linewidth=1, alpha=0.2)\n",
     "lx.tick_params(right=True)\n",
-    "lx.set_ylim(-1, max_start+1)\n",
     "\n",
     "lx.set_xlabel('Pulse index')\n",
     "lx.set_xlim(-15, pulse_offsets[n_trains]+15)\n",
     "\n",
     "lx.set_ylabel('Trigger position')\n",
-    "lx.set_ylim(0, max_start)\n",
+    "lx.set_ylim(-max_start // 20, max_start + max_start // 20)\n",
     "\n",
     "lx.legend(fontsize='small', loc='lower right')\n",
     "\n",
-- 
GitLab