From a00fedbfc6b9062e4734c310acd557c1fd7ea7d0 Mon Sep 17 00:00:00 2001
From: ahmedk <karim.ahmed@xfel.eu>
Date: Wed, 9 Aug 2023 14:28:40 +0200
Subject: [PATCH] small changes after resolving conflict

---
 .../Gotthard2/Correction_Gotthard2_NBC.ipynb  | 53 +++++++++++--------
 1 file changed, 30 insertions(+), 23 deletions(-)

diff --git a/notebooks/Gotthard2/Correction_Gotthard2_NBC.ipynb b/notebooks/Gotthard2/Correction_Gotthard2_NBC.ipynb
index 7d2efd56c..117a70399 100644
--- a/notebooks/Gotthard2/Correction_Gotthard2_NBC.ipynb
+++ b/notebooks/Gotthard2/Correction_Gotthard2_NBC.ipynb
@@ -44,16 +44,16 @@
    "metadata": {},
    "outputs": [],
    "source": [
-    "in_folder = \"/gpfs/exfel/exp/FXE/202221/p003225/raw\"  # the folder to read data from, required\n",
+    "in_folder = \"/gpfs/exfel/exp/DETLAB/202330/p900326/raw\"  # the folder to read data from, required\n",
     "out_folder = \"/gpfs/exfel/data/scratch/ahmedk/test/gotthard2\"  # the folder to output to, required\n",
     "metadata_folder = \"\"  # Directory containing calibration_metadata.yml when run by xfel-calibrate\n",
-    "run = 50  # run to process, required\n",
+    "run = 20  # run to process, required\n",
     "sequences = [-1]  # sequences to correct, set to [-1] for all, range allowed\n",
     "sequences_per_node = 1  # number of sequence files per node if notebook executed through xfel-calibrate, set to 0 to not run SLURM parallel\n",
     "\n",
     "# Parameters used to access raw data.\n",
-    "karabo_id = \"FXE_XAD_G2XES\"  # karabo prefix of Gotthard-II devices\n",
-    "karabo_da = [\"GH201\"]  # data aggregators\n",
+    "karabo_id = \"DETLAB_25UM_GH2\"  # karabo prefix of Gotthard-II devices\n",
+    "karabo_da = [\"DA01/1\", \"DA01/2\"]  # data aggregators\n",
     "receiver_template = \"RECEIVER\"  # receiver template used to read INSTRUMENT keys.\n",
     "control_template = \"CONTROL\"  # control template used to read CONTROL keys.\n",
     "ctrl_source_template = \"{}/DET/{}\"  # template for control source name (filled with karabo_id_control)\n",
@@ -62,7 +62,7 @@
     "# Parameters for calibration database.\n",
     "cal_db_interface = \"tcp://max-exfl-cal001:8016#8025\"  # the database interface to use.\n",
     "cal_db_timeout = 180000  # timeout on caldb requests.\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",
+    "creation_time = \"2023-03-22 10:04:26\"  # To overwrite the measured creation_time. Required Format: YYYY-MM-DD HR:MN:SC e.g. \"2022-06-28 13:00:00\"\n",
     "\n",
     "# Parameters affecting corrected data.\n",
     "constants_file = \"\"  # Use constants in given constant file path. /gpfs/exfel/data/scratch/ahmedk/dont_remove/gotthard2/constants/calibration_constants_GH2.h5\n",
@@ -317,24 +317,31 @@
     "\n",
     "# Prepare constant arrays.\n",
     "if not constants_file:\n",
-    "    # Create the mask array.\n",
-    "    bpix = const_data[mod].get(\"BadPixelsDarkGotthard2\")\n",
-    "    if bpix is None:\n",
-    "        bpix = np.zeros((1280, 2, 3), dtype=np.uint32)\n",
-    "    if const_data[mod].get(\"BadPixelsFFGotthard2\") is not None:\n",
-    "        bpix |= const_data[mod][\"BadPixelsFFGotthard2\"]\n",
-    "    const_data[mod][\"Mask\"] = bpix\n",
-    "\n",
-    "    # Prepare empty arrays for missing constants.\n",
-    "    if const_data[mod].get(\"OffsetGotthard2\") is None:\n",
-    "        const_data[mod][\"OffsetGotthard2\"] = np.zeros(\n",
-    "            (1280, 2, 3), dtype=np.float32)\n",
-    "\n",
-    "    if const_data[mod].get(\"RelativeGainGotthard2\") is None:\n",
-    "        const_data[mod][\"RelativeGainGotthard2\"] = np.ones(\n",
-    "            (1280, 2, 3), dtype=np.float32)\n",
-    "    const_data[mod][\"RelativeGainGotthard2\"] = const_data[mod][\"RelativeGainGotthard2\"].astype(  # noqa\n",
-    "        np.float32, copy=False)  # Old gain constants are not float32."
+    "    for mod in karabo_da:\n",
+    "        # Create the mask array.\n",
+    "        bpix = const_data[mod].get(\"BadPixelsDarkGotthard2\")\n",
+    "        if bpix is None:\n",
+    "            bpix = np.zeros((1280, 2, 3), dtype=np.uint32)\n",
+    "        if const_data[mod].get(\"BadPixelsFFGotthard2\") is not None:\n",
+    "            bpix |= const_data[mod][\"BadPixelsFFGotthard2\"]\n",
+    "        const_data[mod][\"Mask\"] = bpix\n",
+    "        print(const_data[mod].keys())\n",
+    "\n",
+    "        # Prepare empty arrays for missing constants.\n",
+    "        if const_data[mod].get(\"OffsetGotthard2\") is None:\n",
+    "            const_data[mod][\"OffsetGotthard2\"] = np.zeros(\n",
+    "                (1280, 2, 3), dtype=np.float32)\n",
+    "\n",
+    "        if const_data[mod].get(\"RelativeGainGotthard2\") is None:\n",
+    "            const_data[mod][\"RelativeGainGotthard2\"] = np.ones(\n",
+    "                (1280, 2, 3), dtype=np.float32)\n",
+    "        const_data[mod][\"RelativeGainGotthard2\"] = const_data[mod][\"RelativeGainGotthard2\"].astype(  # noqa\n",
+    "            np.float32, copy=False)  # Old gain constants are not float32."
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
    "id": "b41f3720-2abd-43ed-b948-8d2f0815b6a3",
    "metadata": {},
    "outputs": [],
-- 
GitLab