From 741b0e962579de568f4dd8fd33f9f1655e26a566 Mon Sep 17 00:00:00 2001
From: karnem <mikhail.karnevskiy@desy.de>
Date: Mon, 29 Jul 2019 15:27:18 +0200
Subject: [PATCH] Process without gain if constants are not found

---
 notebooks/ePix/Correction_ePix_NBC.ipynb | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/notebooks/ePix/Correction_ePix_NBC.ipynb b/notebooks/ePix/Correction_ePix_NBC.ipynb
index f4a611741..fbf437b79 100644
--- a/notebooks/ePix/Correction_ePix_NBC.ipynb
+++ b/notebooks/ePix/Correction_ePix_NBC.ipynb
@@ -43,7 +43,7 @@
     "overwrite = True # overwrite output folder\n",
     "limit_images = 0 # process only first N images, 0 - process all\n",
     "use_dir_creation_date = True # date constants injected before directory creation time\n",
-    "db_module = \"ePix100_M17\" # module id in the database\n",
+    "db_module = \"ePix100_M15\" # module id in the database\n",
     "sequences_per_node = 1 # number of sequence files per cluster node if run as slurm job, set to 0 to not run SLURM parallel\n",
     "\n",
     "bias_voltage = 200 # bias voltage\n",
@@ -51,7 +51,7 @@
     "fix_temperature = 290. # fix temperature to this value\n",
     "gain_photon_energy = 9.0 # Photon energy used for gain calibration\n",
     "photon_energy = 8.0 # Photon energy to calibrate in number of photons, 0 for calibration in keV  \n",
-    "no_relative_gain = False # do not do relative gain correction\n",
+    "no_relative_gain = False # do not do gain correction\n",
     "split_evt_primary_threshold = 7. # primary threshold for split event correction\n",
     "split_evt_secondary_threshold = 5. # secondary threshold for split event correction\n",
     "split_evt_mip_threshold = 1000. # minimum ionizing particle threshold\n",
@@ -353,10 +353,16 @@
     "                                     creation_time=creation_time,\n",
     "                                     print_once=2,\n",
     "                                     timeout=cal_db_timeout)\n",
+    "    \n",
+    "    if gainMap is None:\n",
+    "        print(\"Gain map requisted, but not found\")\n",
+    "        print(\"No gain correction will be applied\")\n",
+    "        no_relative_gain = True\n",
+    "        plot_unit = 'ADU'\n",
+    "        gainMap = np.ones(sensorSize, np.float32)\n",
     "\n",
     "else:\n",
-    "    gainMap = np.ones(([sensorSize.shape[0], sensorSize.shape[1]],\n",
-    "                       np.float32))\n"
+    "    gainMap = np.ones(sensorSize, np.float32)\n"
    ]
   },
   {
-- 
GitLab