From 1c7c7f0215ec38722cc7014fa96c114d4aac02c4 Mon Sep 17 00:00:00 2001
From: ahmedk <karim.ahmed@xfel.eu>
Date: Fri, 9 Feb 2024 12:53:07 +0100
Subject: [PATCH] use nanpercentile with corrected data and replace deprecated
 np.int with int

---
 notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
index 3fa1efccd..0da892794 100644
--- a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
+++ b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
@@ -1148,7 +1148,7 @@
     "fig = plt.figure(figsize=(10, 10))\n",
     "corrected_ave = np.nansum(corrected, axis=(2, 3))\n",
     "plt.scatter(corrected_ave.flatten()/10**6, blshift.flatten(), s=0.9)\n",
-    "plt.xlim(np.percentile(corrected_ave/10**6, [2, 98]))\n",
+    "plt.xlim(np.nanpercentile(corrected_ave/10**6, [2, 98]))\n",
     "plt.grid()\n",
     "plt.xlabel('Illuminated corrected [MADU] ')\n",
     "_ = plt.ylabel('Estimated baseline shift [ADU]')"
@@ -1216,7 +1216,7 @@
     "    display(Markdown(f'A mean across train: {tid}\\n'))\n",
     "    fig = plt.figure(figsize=(20, 10))\n",
     "    ax = fig.add_subplot(111)\n",
-    "    data = np.mean(corrected, axis=0)\n",
+    "    data = np.nanmean(corrected, axis=0)\n",
     "    vmin, vmax = np.nanpercentile(data, [5, 99.9])\n",
     "    ax = geom.plot_data_fast(data, ax=ax, vmin=vmin, vmax=vmax, cmap=cmap)\n",
     "    pass\n",
@@ -1249,7 +1249,7 @@
     "fig = plt.figure(figsize=(20, 10))\n",
     "ax = fig.add_subplot(111)\n",
     "vmin, vmax = get_range(corrected[cell_idx_preview], 5, -50)\n",
-    "nbins = np.int((vmax + 50) / 2)\n",
+    "nbins = int((vmax + 50) / 2)\n",
     "h = ax.hist(corrected[cell_idx_preview].flatten(),\n",
     "            bins=nbins, range=(-50, vmax),\n",
     "            histtype='stepfilled', log=True)\n",
@@ -1272,7 +1272,7 @@
     "vmax = np.nanmax(corrected)\n",
     "if vmax > 50000:\n",
     "    vmax = 50000\n",
-    "nbins = np.int((vmax + 100) / 5)\n",
+    "nbins = int((vmax + 100) / 5)\n",
     "h = ax.hist(corrected.flatten(), bins=nbins,\n",
     "            range=(-100, vmax), histtype='step', log=True, label = 'All')\n",
     "ax.hist(corrected[gains == 0].flatten(), bins=nbins, range=(-100, vmax),\n",
-- 
GitLab