From cdcd57e6d33036895b80c2158218ab4a28980d21 Mon Sep 17 00:00:00 2001 From: karnem <mikhail.karnevskiy@desy.de> Date: Thu, 5 Sep 2019 10:59:33 +0200 Subject: [PATCH] Prevent case where number of trains is less then number of skipped trains --- notebooks/LPD/LPDChar_Darks_NBC.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/LPD/LPDChar_Darks_NBC.ipynb b/notebooks/LPD/LPDChar_Darks_NBC.ipynb index 682580489..5bec878b3 100644 --- a/notebooks/LPD/LPDChar_Darks_NBC.ipynb +++ b/notebooks/LPD/LPDChar_Darks_NBC.ipynb @@ -238,8 +238,8 @@ " first = infile[f\"{bpath}/first\"][()]\n", " valid = count != 0\n", " count, first = count[valid], first[valid]\n", - " first_image = first[skip_first_ntrains]\n", - " last_image = first_image + np.sum(count[skip_first_ntrains:skip_first_ntrains+ntrains])\n", + " first_image = int(first[skip_first_ntrains] if first.shape[0] > skip_first_ntrains else 0)\n", + " last_image = int(first_image + np.sum(count[skip_first_ntrains:skip_first_ntrains+ntrains]))\n", "\n", " im = np.array(infile[\"/INSTRUMENT/FXE_DET_LPD1M-1/DET/{}CH0:xtdf/image/data\".format(\n", " channel)][first_image:last_image, ...])\n", -- GitLab