diff --git a/notebooks/REMI/REMI_Digitize_and_Transform.ipynb b/notebooks/REMI/REMI_Digitize_and_Transform.ipynb index 1c78263ce6caffbda31d6f5b0647273b90965966..8d7ce5a454e0517b27cedbb4b18600f2ad371f7e 100644 --- a/notebooks/REMI/REMI_Digitize_and_Transform.ipynb +++ b/notebooks/REMI/REMI_Digitize_and_Transform.ipynb @@ -484,8 +484,12 @@ " col = (signal_idx % 2) if signal_idx < 6 else np.s_[:]\n", " ax = fig.add_subplot(grid[row, col])\n", " \n", - " pulse_idx = np.where(np.isfinite(edges[:, signal_idx, 0]))[0][0]\n", - " train_idx = np.where(pulse_idx >= pulse_offsets)[0][-1]\n", + " finite_edges = np.isfinite(edges[:, signal_idx, 0])\n", + " if not finite_edges.any():\n", + " continue\n", + " \n", + " pulse_idx = finite_edges.nonzero()[0][0]\n", + " train_idx = (pulse_idx >= pulse_offsets).nonzero()[0][-1]\n", " trigger = triggers[pulse_idx]\n", " \n", " sourcekey = remi.get_channel_sourcekey(\n", @@ -500,7 +504,7 @@ " \n", " pulse_trace = corr_trace[np.s_[trigger['start']:trigger['stop']]]\n", " \n", - " x_time = remi.get_time_calibration() * (np.arange(len(pulse_trace) + trigger['offset']))\n", + " x_time = remi.get_time_calibration() * (np.arange(len(pulse_trace)) + trigger['offset'])\n", " \n", " ax.plot(x_time, pulse_trace, lw=1)\n", " ax.set_xlim(x_time[0], x_time[-1])\n", @@ -895,9 +899,9 @@ "dataset_kwargs = {k[8:]: v for k, v in locals().items() if k.startswith('dataset_compression')}\n", "\n", "metadata = dc.run_metadata()\n", - "daq_library_bytes = metadata['daqLibrary'].encode('ascii')\n", - "karabo_framework_bytes = metadata['karaboFramework'].encode('ascii')\n", - "proposal_number = int(proposal) if proposal else metadata['proposalNumber']\n", + "daq_library_bytes = metadata.get('daqLibrary', '0.0').encode('ascii')\n", + "karabo_framework_bytes = metadata.get('karaboFramework', '0.0').encode('ascii')\n", + "proposal_number = int(proposal) if proposal else metadata.get('proposalNumber', -1)\n", "\n", "print('Writing sequence files', flush=True, end='')\n", "\n",