From a27f728a01f67eaa4f0582e3fccdd7d810d595a1 Mon Sep 17 00:00:00 2001 From: Karim Ahmed <karim.ahmed@xfel.eu> Date: Tue, 24 Sep 2019 10:48:54 +0200 Subject: [PATCH] add error message --- notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb index 88deaed4a..6d015baab 100644 --- a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb +++ b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb @@ -404,6 +404,7 @@ " dig_signal_edges = None\n", " gain_stats = 0\n", " when = None\n", + " err = None\n", " \n", " try:\n", " start = datetime.now()\n", @@ -483,6 +484,7 @@ " \n", " except Exception as e:\n", " print(e)\n", + " err = e\n", " success = False\n", " reason = \"Error\"\n", " \n", @@ -495,7 +497,7 @@ " #influx = create_influx_entry(run, proposal, qm, sequence, filesize, CHUNK_SIZE, total_sequences, success, duration, reason)\n", " #client.write_points([influx])\n", " return (hists_signal_low, hists_signal_high, hists_gain_vs_signal, hists_dig_gain_vs_signal,\n", - " low_edges, high_edges, signal_edges, dig_signal_edges, gain_stats, max_cells, when)\n", + " low_edges, high_edges, signal_edges, dig_signal_edges, gain_stats, max_cells, when, err)\n", " \n", "done = False\n", "first_files = []\n", @@ -518,6 +520,7 @@ "fileparms = calfile\n", "all_cells = []\n", "whens = []\n", + "errors = []\n", "while not done:\n", " \n", " dones = []\n", @@ -553,9 +556,10 @@ "\n", " for rr in r:\n", " if rr is not None:\n", - " hl, hh, hg, hdg, low_edges, high_edges, signal_edges, dig_signal_edges, gs, cells, when = rr\n", + " hl, hh, hg, hdg, low_edges, high_edges, signal_edges, dig_signal_edges, gs, cells, when, err = rr\n", " all_cells.append(cells)\n", " whens.append(when)\n", + " errors.append(err)\n", " if hl is not None: # any one being None will also make the others None\n", " hists_signal_low += hl.astype(np.float64)\n", " hists_signal_high += hh.astype(np.float64)\n", @@ -576,7 +580,10 @@ "print(\"Offset where injected on: \")\n", "for i, when in enumerate(whens):\n", " qm = \"Q{}M{}\".format((i%16)//4 + 1, i%4 +1)\n", - " print(\"{}: {}\".format(qm, when))" + " if errors[i] is None: \n", + " print(\"{}: {} \".format(qm, when))\n", + " else:\n", + " print(\"{}: {}. Reason: {}\".format(qm, when, errors[i]))" ] }, { -- GitLab