diff --git a/notebooks/REMI/REMI_Digitize_and_Transform.ipynb b/notebooks/REMI/REMI_Digitize_and_Transform.ipynb index 95b065bd9839b49d92acd326946b82f3471bd779..1968322d6f074887d7d89652c5ad4aeab176bed6 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",