diff --git a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb index a7d9edcae615d51f22b018d72a134311782bf693..139fdd748d934e5b3fac9f3e685217457c291126 100644 --- a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb +++ b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb @@ -1044,29 +1044,26 @@ "display(Markdown(f'## Preview and statistics for {gains.shape[0]} images of the train {tid} ##\\n'))" ] }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Signal vs. Analogue Gain ###" - ] - }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "raw_float = raw.astype(np.float32)\n", - "signal = raw[:, 0, ...]\n", + "# As part of data reduction efforts, the DAQ now has an option to discard AGIPD gain data\n", + "# when it is known that all data is in the same gain stage. In such cases, the gain data\n", + "# will be set to zeros. Consequently, the signal vs. analog gain 2D histogram can be skipped.\n", "gain = raw[:, 1, ...]\n", - "hist, bins_x, bins_y = calgs.histogram2d(\n", + "if gain.max() > 0:\n", + " signal = raw[:, 0, ...]\n", + " display(Markdown(\"### Signal vs. Analogue Gain\"))\n", + " hist, bins_x, bins_y = calgs.histogram2d(\n", " signal.flatten().astype(np.float32),\n", " gain.flatten().astype(np.float32),\n", " bins=(100, 100),\n", " range=[\n", " np.percentile(signal, [0.02, 99.8]),\n", - " [0, 3],\n", + " np.percentile(signal, [0.02, 99.8]),\n", " ],\n", " )\n", "do_2d_plot(hist, (bins_x, bins_y), \"Signal (ADU)\", \"Analogue gain (ADU)\")"