From 4aa2140d629cf2c778533f9104188e35365726b3 Mon Sep 17 00:00:00 2001 From: ahmedk <karim.ahmed@xfel.eu> Date: Tue, 26 Sep 2023 17:32:52 +0200 Subject: [PATCH] fixes and refactoring code to account for CS or PC --- notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb | 4 ++-- notebooks/AGIPD/AGIPD_Correct_and_Verify_Summary_NBC.ipynb | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb index db092d2dd..eaed1327a 100644 --- a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb +++ b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb @@ -653,7 +653,7 @@ "\n", "print(\"Preparing constants (\"\n", " f\"FF: {agipd_corr.corr_bools.get('xray_corr', False)}, \"\n", - " f\"{rel_gain}: {any(agipd_corr.rel_gain_bools)}, \"\n", + " f\"{rel_gain_alias}: {any(agipd_corr.rel_gain_bools)}, \"\n", " f\"BLC: {any(agipd_corr.blc_bools)})\")\n", "# Display retrieved calibration constants timestamps\n", "agipd_cal.display_markdown_retrieved_constants(metadata=agipd_metadata)" @@ -757,7 +757,7 @@ "\n", " # Store few time stamps if exists\n", " # Add NA to keep array structure\n", - " for key in ['Offset', f'Slopes{rel_gain_mode}', 'SlopesFF']:\n", + " for key in ['Offset', f'Slopes{rel_gain_alias}', 'SlopesFF']:\n", " if key in mod_mdata:\n", " module_timestamps[key] = mod_mdata[key][\"begin_validity_at\"]\n", " else:\n", diff --git a/notebooks/AGIPD/AGIPD_Correct_and_Verify_Summary_NBC.ipynb b/notebooks/AGIPD/AGIPD_Correct_and_Verify_Summary_NBC.ipynb index 36e21e922..7c3aba0df 100644 --- a/notebooks/AGIPD/AGIPD_Correct_and_Verify_Summary_NBC.ipynb +++ b/notebooks/AGIPD/AGIPD_Correct_and_Verify_Summary_NBC.ipynb @@ -18,7 +18,8 @@ "metadata_folder = \"\" # Directory containing calibration_metadata.yml when run by xfel-calibrate\n", "karabo_id = \"SPB_DET_AGIPD1M-1\" # karabo karabo_id\n", "modules = [-1]\n", - "karabo_da = ['-1'] # a list of data aggregators names, Default [-1] for selecting all data aggregators" + "karabo_da = ['-1'] # a list of data aggregators names, Default [-1] for selecting all data aggregators\n", + "rel_gain = \"off\" # Select relative gain correction. Choices [`PC`, `CS`, `off`]. (`PC`: Pulse Capacitor, `CS`: Current Source, `off`: Disable relative gain correction). Default: off." ] }, { @@ -105,8 +106,8 @@ " display(Latex(tabulate.tabulate(table,\n", " tablefmt=\"latex\",\n", " headers=[\"Timestamps\", \"Modules and sequences\"])))\n", - "\n", - "for const in ['Offset', 'SlopesPC', 'SlopesFF']:\n", + "rel_gain_alias = \"CS\" if rel_gain.lower() == \"cs\" else \"PC\"\n", + "for const in ['Offset', f'Slopes{rel_gain_alias}', 'SlopesFF']:\n", " print_const_table(const)" ] } -- GitLab