From 2562e90c7810f09794c6bf864fd103faf577290d Mon Sep 17 00:00:00 2001 From: Philipp Schmidt <philipp.schmidt@xfel.eu> Date: Sun, 23 Oct 2022 17:03:08 +0200 Subject: [PATCH] Move first pulse by missing PPL pulses if FEL-only --- notebooks/REMI/REMI_Digitize_and_Transform.ipynb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/notebooks/REMI/REMI_Digitize_and_Transform.ipynb b/notebooks/REMI/REMI_Digitize_and_Transform.ipynb index 95b065bd9..1968322d6 100644 --- a/notebooks/REMI/REMI_Digitize_and_Transform.ipynb +++ b/notebooks/REMI/REMI_Digitize_and_Transform.ipynb @@ -257,6 +257,15 @@ " \n", " if num_pulses == 0:\n", " return\n", + " elif len(ppl_pos) == 0 and ppl_offset < 0:\n", + " # No PPL pulses, but a negative offset is configured. This will cause\n", + " # first_pulse_offset to start early and most likely miss pulses at the\n", + " # end, so we correct by adding the ppl_offset to relative positions\n", + " # when computing trace positions.\n", + " pos_corr = abs(ppl_offset)\n", + " else:\n", + " pos_corr = 0\n", + " \n", "\n", " rel_pos = all_pos - all_pos[0]\n", "\n", @@ -265,7 +274,7 @@ " elif num_pulses == 1:\n", " pulse_len = single_pulse_length\n", "\n", - " start_frac = first_pulse_offset + rel_pos * 2 * clock_factor\n", + " start_frac = first_pulse_offset + (rel_pos + pos_corr) * 2 * clock_factor\n", " start_int = start_frac.astype(int)\n", "\n", " pulse_offset = pulse_offsets[index]\n", -- GitLab