From 2fb3e3b9ede1686e530ad059b51ae509a786906b Mon Sep 17 00:00:00 2001 From: Vratko Rovensky <vratko.rovensky@xfel.eu> Date: Tue, 16 Jul 2024 13:00:08 +0200 Subject: [PATCH] fix: [AGIPD][PC] Fixing plotting in summary notebook --- .../Chracterize_AGIPD_Gain_PC_Summary.ipynb | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/notebooks/AGIPD/Chracterize_AGIPD_Gain_PC_Summary.ipynb b/notebooks/AGIPD/Chracterize_AGIPD_Gain_PC_Summary.ipynb index 0511729a0..8c99eb084 100644 --- a/notebooks/AGIPD/Chracterize_AGIPD_Gain_PC_Summary.ipynb +++ b/notebooks/AGIPD/Chracterize_AGIPD_Gain_PC_Summary.ipynb @@ -15,13 +15,13 @@ "metadata": {}, "outputs": [], "source": [ - "in_folder = \"/gpfs/exfel/exp/HED/202430/p900438/raw/\" # path to input data, required\n", - "out_folder = \"/gpfs/exfel/exp/HED/202430/p900438/scratch/rovensky/pc/\" # path to output to, required\n", + "in_folder = \"/gpfs/exfel/exp/SPB/202431/p900461/raw/\" # path to input data, required\n", + "out_folder = \"/gpfs/exfel/exp/SPB/202431/p900461/usr/PC/352cells1.1MHz_gs0_20clk/\" # path to output to, required\n", "metadata_folder = \"\" # Directory containing calibration_metadata.yml when run by xfel-calibrate\n", "runs = [] # runs to use, required, range allowed\n", "\n", - "karabo_id_control = \"HED_DET_AGIPD65K1\" # karabo-id for the control device e.g. \"MID_EXP_AGIPD1M1\", or \"SPB_IRU_AGIPD1M1\"\n", - "karabo_id = \"HED_DET_AGIPD65K1\"\n", + "karabo_id_control = \"SPB_IRU_AGIPD1M1\" # karabo-id for the control device e.g. \"MID_EXP_AGIPD1M1\", or \"SPB_IRU_AGIPD1M1\"\n", + "karabo_id = \"SPB_DET_AGIPD1M-1\"\n", "ctrl_source_template = '{}/MDL/FPGA_COMP' # path to control information\n", "\n", "creation_time = \"\" # To overwrite the measured creation_time. Required Format: YYYY-MM-DD HR:MN:SC e.g. \"2022-06-28 13:00:00\"\n", @@ -304,7 +304,7 @@ "source": [ "def retrieve_old_PC(mod):\n", " dconst = getattr(Constants.AGIPD, 'SlopesPC')()\n", - " old_PC = get_from_db(karabo_id=karabo_id,\n", + " old_PC, _ = get_from_db(karabo_id=karabo_id,\n", " karabo_da=karabo_da[mod],\n", " constant=dconst,\n", " condition=condition,\n", @@ -332,7 +332,7 @@ "pixel_range = [0,0,512,128]\n", "const_data = {}\n", "old_const = {}\n", - "const_order = [0, 1, 3, 4]\n", + "const_order = [0, 1, 3, 4] # this holds the position of slopes and intercepts in PC const array.\n", "\n", "for (key, c) in zip(keys, const_order):\n", " const_data[key] = np.full((nmods, mem_cells, 512, 128), np.nan)\n", @@ -341,9 +341,9 @@ " if key in fit_data[mn]:\n", " const_data[key][cnt,:,pixel_range[0]:pixel_range[2],\n", " pixel_range[1]:pixel_range[3]] = fit_data[mn][key]\n", - " if np.any(old_PC_consts[0][0]):\n", + " if np.any(old_PC_consts[cnt]):\n", " old_const[key][cnt,:,pixel_range[0]:pixel_range[2],\n", - " pixel_range[1]:pixel_range[3]] = old_PC_consts[cnt][0][c].swapaxes(1,2)\n", + " pixel_range[1]:pixel_range[3]] = old_PC_consts[cnt][c].swapaxes(1,2)\n", "\n", "const_data['BadPixelsPC'] = np.full((nmods, mem_cells, 512, 128), np.nan)\n", "for cnt, mn in enumerate(modules):\n", @@ -546,11 +546,11 @@ " data[gain_data['BP']['BadPixelsPC']>0] = np.nan\n", "\n", " d = []\n", - " for i in range(nmods):\n", + " for i, m in enumerate(modules):\n", " d.append({'x': np.arange(data[i].shape[0]),\n", " 'y': np.nanmean(data[i], axis=(1,2)),\n", " 'drawstyle': 'steps-pre',\n", - " 'label': f'{modules[i]}',\n", + " 'label': f'{m}',\n", " 'linewidth': 2,\n", " 'linestyle': '--' if i>7 else '-'\n", " })\n", @@ -576,11 +576,11 @@ "outputs": [], "source": [ "d = []\n", - "for i in range(nmods):\n", + "for i, m in enumerate(modules):\n", " d.append({'x': np.arange(ratio[i].shape[0]),\n", " 'y': np.nanmedian(ratio[i], axis=(1,2)),\n", " 'drawstyle': 'steps-pre',\n", - " 'label': f'{modules[i]}',\n", + " 'label': f'{m}',\n", " 'linewidth': 2,\n", " 'linestyle': '--' if i>7 else '-'\n", " })\n", @@ -701,7 +701,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.11" + "version": "3.8.18" }, "latex_envs": { "LaTeX_envs_menu_present": true, -- GitLab