From 48439e07954d77d83fa6bc1a593f24f71787a03c Mon Sep 17 00:00:00 2001
From: karnem <mikhail.karnevskiy@desy.de>
Date: Thu, 5 Sep 2019 10:55:42 +0200
Subject: [PATCH] Convert NBP to float

---
 notebooks/AGIPD/PlotFromCalDB_AGIPD_NBC.ipynb | 121 ++++++++++++++++--
 .../FastCCD/PlotFromCalDB_FastCCD_NBC.ipynb   |   1 +
 notebooks/LPD/PlotFromCalDB_LPD_NBC.ipynb     |   1 +
 3 files changed, 114 insertions(+), 9 deletions(-)

diff --git a/notebooks/AGIPD/PlotFromCalDB_AGIPD_NBC.ipynb b/notebooks/AGIPD/PlotFromCalDB_AGIPD_NBC.ipynb
index 09e8c0160..7f4b500b3 100644
--- a/notebooks/AGIPD/PlotFromCalDB_AGIPD_NBC.ipynb
+++ b/notebooks/AGIPD/PlotFromCalDB_AGIPD_NBC.ipynb
@@ -21,7 +21,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 1,
    "metadata": {},
    "outputs": [],
    "source": [
@@ -33,7 +33,7 @@
     "modules = [1]  # Modules, set to -1 for all, range allowed\n",
     "bias_voltages = [300, 500]  # Bias voltage\n",
     "mem_cells = [128, 176, 202, 250]  # Number of used memory cells. Typically: 4,32,64,128,176.\n",
-    "acquisition_rate = [None, 1.1, 2.2, 4.5]\n",
+    "acquisition_rate = [0.0, 1.1, 2.2, 4.5]\n",
     "photon_energy = 9.2  # Photon energy of the beam\n",
     "out_folder = \"/gpfs/exfel/data/scratch/karnem/test_AGIPD/\"  # Output folder, required\n",
     "use_existing = \"\" # If not empty, constants stored in given folder will be used\n",
@@ -55,7 +55,7 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 2,
    "metadata": {
     "scrolled": true
    },
@@ -79,9 +79,21 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 3,
    "metadata": {},
-   "outputs": [],
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "Bad pixels data:  {'SlopesFF': 'BadPixelsFF', 'SlopesPC': 'BadPixelsPC', 'Noise': 'BadPixelsDark', 'Offset': 'BadPixelsDark'}\n",
+      "CalDB Interface: tcp://max-exfl016:8015#8025\n",
+      "Start time at:  2019-01-01 00:00:00\n",
+      "End time at:  2019-12-12 00:00:00\n",
+      "Modules:  ['Q1M2']\n"
+     ]
+    }
+   ],
    "source": [
     "# Prepare variables\n",
     "nMem = max(mem_cells) # Number of mem Cells to store\n",
@@ -92,6 +104,8 @@
     "    \n",
     "modules = [\"Q{}M{}\".format(x // 4 + 1, x % 4 + 1) for x in modules]\n",
     "\n",
+    "acquisition_rate[acquisition_rate==0] = None\n",
+    "\n",
     "constantsDark = {\"SlopesFF\": 'BadPixelsFF',\n",
     "                 'SlopesPC': 'BadPixelsPC',\n",
     "                 'Noise': 'BadPixelsDark',\n",
@@ -119,9 +133,17 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 4,
    "metadata": {},
-   "outputs": [],
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "[{'bias_voltage': 300, 'module': 'Q1M2', 'mem_cells': 128, 'acquisition_rate': None}, {'bias_voltage': 300, 'module': 'Q1M2', 'mem_cells': 128, 'acquisition_rate': 1.1}, {'bias_voltage': 300, 'module': 'Q1M2', 'mem_cells': 128, 'acquisition_rate': 2.2}, {'bias_voltage': 300, 'module': 'Q1M2', 'mem_cells': 128, 'acquisition_rate': 4.5}, {'bias_voltage': 300, 'module': 'Q1M2', 'mem_cells': 176, 'acquisition_rate': None}, {'bias_voltage': 300, 'module': 'Q1M2', 'mem_cells': 176, 'acquisition_rate': 1.1}, {'bias_voltage': 300, 'module': 'Q1M2', 'mem_cells': 176, 'acquisition_rate': 2.2}, {'bias_voltage': 300, 'module': 'Q1M2', 'mem_cells': 176, 'acquisition_rate': 4.5}, {'bias_voltage': 300, 'module': 'Q1M2', 'mem_cells': 202, 'acquisition_rate': None}, {'bias_voltage': 300, 'module': 'Q1M2', 'mem_cells': 202, 'acquisition_rate': 1.1}, {'bias_voltage': 300, 'module': 'Q1M2', 'mem_cells': 202, 'acquisition_rate': 2.2}, {'bias_voltage': 300, 'module': 'Q1M2', 'mem_cells': 202, 'acquisition_rate': 4.5}, {'bias_voltage': 300, 'module': 'Q1M2', 'mem_cells': 250, 'acquisition_rate': None}, {'bias_voltage': 300, 'module': 'Q1M2', 'mem_cells': 250, 'acquisition_rate': 1.1}, {'bias_voltage': 300, 'module': 'Q1M2', 'mem_cells': 250, 'acquisition_rate': 2.2}, {'bias_voltage': 300, 'module': 'Q1M2', 'mem_cells': 250, 'acquisition_rate': 4.5}, {'bias_voltage': 500, 'module': 'Q1M2', 'mem_cells': 128, 'acquisition_rate': None}, {'bias_voltage': 500, 'module': 'Q1M2', 'mem_cells': 128, 'acquisition_rate': 1.1}, {'bias_voltage': 500, 'module': 'Q1M2', 'mem_cells': 128, 'acquisition_rate': 2.2}, {'bias_voltage': 500, 'module': 'Q1M2', 'mem_cells': 128, 'acquisition_rate': 4.5}, {'bias_voltage': 500, 'module': 'Q1M2', 'mem_cells': 176, 'acquisition_rate': None}, {'bias_voltage': 500, 'module': 'Q1M2', 'mem_cells': 176, 'acquisition_rate': 1.1}, {'bias_voltage': 500, 'module': 'Q1M2', 'mem_cells': 176, 'acquisition_rate': 2.2}, {'bias_voltage': 500, 'module': 'Q1M2', 'mem_cells': 176, 'acquisition_rate': 4.5}, {'bias_voltage': 500, 'module': 'Q1M2', 'mem_cells': 202, 'acquisition_rate': None}, {'bias_voltage': 500, 'module': 'Q1M2', 'mem_cells': 202, 'acquisition_rate': 1.1}, {'bias_voltage': 500, 'module': 'Q1M2', 'mem_cells': 202, 'acquisition_rate': 2.2}, {'bias_voltage': 500, 'module': 'Q1M2', 'mem_cells': 202, 'acquisition_rate': 4.5}, {'bias_voltage': 500, 'module': 'Q1M2', 'mem_cells': 250, 'acquisition_rate': None}, {'bias_voltage': 500, 'module': 'Q1M2', 'mem_cells': 250, 'acquisition_rate': 1.1}, {'bias_voltage': 500, 'module': 'Q1M2', 'mem_cells': 250, 'acquisition_rate': 2.2}, {'bias_voltage': 500, 'module': 'Q1M2', 'mem_cells': 250, 'acquisition_rate': 4.5}]\n"
+     ]
+    }
+   ],
    "source": [
     "parameter_list = combine_lists(bias_voltages, modules, mem_cells, acquisition_rate,\n",
     "                               names = ['bias_voltage', 'module', 'mem_cells', 'acquisition_rate'])\n",
@@ -130,11 +152,91 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 5,
    "metadata": {
     "scrolled": false
    },
-   "outputs": [],
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "Request:  Noise with paramters: {'bias_voltage': 300, 'module': 'Q1M2', 'mem_cells': 128, 'acquisition_rate': None}\n",
+      "constantDark: BadPixelsDark\n",
+      "Item:  {'id': 6990, 'name': '20190220_072419_sIdx=0', 'file_name': 'cal.1550647458.8201447.h5', 'path_to_file': 'xfel/cal/agipd-type/agipd_siv1_agipdv11_m315/', 'data_set_name': '/AGIPD_SIV1_AGIPDV11_M315/Noise/0', 'flg_deployed': True, 'flg_good_quality': True, 'begin_validity_at': '2019-02-19T15:54:20.000+01:00', 'end_validity_at': None, 'begin_at': '2019-02-19T15:54:20.000+01:00', 'start_idx': 0, 'end_idx': 0, 'raw_data_location': '', 'description': '', 'calibration_constant': {'id': 913, 'name': 'AGIPD-Type_Noise_AGIPD DefJAwEUE0Km+', 'flg_auto_approve': True, 'flg_available': True, 'description': 'Per-pixel (per-memory cell) noise', 'device_type_id': 2, 'calibration_id': 2, 'condition_id': 271}, 'physical_device': {'id': 58, 'name': 'AGIPD_SIV1_AGIPDV11_M315', 'device_type_id': 2, 'flg_available': True, 'parent_id': None, 'description': ''}}\n",
+      "Found constant Noise: begin at 2019-02-19 15:54:20+01:00\n",
+      "Found bad pixels at 2019-02-19 15:54:20+01:00\n",
+      "Item:  {'id': 5471, 'name': '20181027_075853_sIdx=0', 'file_name': 'cal.1540627132.6379695.h5', 'path_to_file': 'xfel/cal/agipd-type/agipd_siv1_agipdv11_m315/', 'data_set_name': '/AGIPD_SIV1_AGIPDV11_M315/Noise/0', 'flg_deployed': True, 'flg_good_quality': True, 'begin_validity_at': '2018-10-27T09:20:58.000+02:00', 'end_validity_at': None, 'begin_at': '2018-10-27T09:20:58.000+02:00', 'start_idx': 0, 'end_idx': 0, 'raw_data_location': '', 'description': '', 'calibration_constant': {'id': 913, 'name': 'AGIPD-Type_Noise_AGIPD DefJAwEUE0Km+', 'flg_auto_approve': True, 'flg_available': True, 'description': 'Per-pixel (per-memory cell) noise', 'device_type_id': 2, 'calibration_id': 2, 'condition_id': 271}, 'physical_device': {'id': 58, 'name': 'AGIPD_SIV1_AGIPDV11_M315', 'device_type_id': 2, 'flg_available': True, 'parent_id': None, 'description': ''}}\n",
+      "Found constant Noise: begin at 2018-10-27 09:20:58+02:00\n",
+      "Found bad pixels at 2018-10-27 09:20:58+02:00\n",
+      "Item:  {'id': 6791, 'name': '20181213_160158_sIdx=0', 'file_name': 'cal.1544716917.4122818.h5', 'path_to_file': 'xfel/cal/agipd-type/agipd_siv1_agipdv11_m315/', 'data_set_name': '/AGIPD_SIV1_AGIPDV11_M315/Noise/0', 'flg_deployed': True, 'flg_good_quality': True, 'begin_validity_at': '2018-10-22T22:24:16.000+02:00', 'end_validity_at': None, 'begin_at': '2018-10-22T22:24:16.000+02:00', 'start_idx': 0, 'end_idx': 0, 'raw_data_location': '', 'description': '', 'calibration_constant': {'id': 913, 'name': 'AGIPD-Type_Noise_AGIPD DefJAwEUE0Km+', 'flg_auto_approve': True, 'flg_available': True, 'description': 'Per-pixel (per-memory cell) noise', 'device_type_id': 2, 'calibration_id': 2, 'condition_id': 271}, 'physical_device': {'id': 58, 'name': 'AGIPD_SIV1_AGIPDV11_M315', 'device_type_id': 2, 'flg_available': True, 'parent_id': None, 'description': ''}}\n",
+      "Found constant Noise: begin at 2018-10-22 22:24:16+02:00\n",
+      "Found bad pixels at 2018-10-22 22:24:16+02:00\n",
+      "Item:  {'id': 6834, 'name': '20190207_135120_sIdx=0', 'file_name': 'cal.1549547479.2884257.h5', 'path_to_file': 'xfel/cal/agipd-type/agipd_siv1_agipdv11_m315/', 'data_set_name': '/AGIPD_SIV1_AGIPDV11_M315/Noise/0', 'flg_deployed': True, 'flg_good_quality': True, 'begin_validity_at': '2018-10-21T20:55:02.000+02:00', 'end_validity_at': None, 'begin_at': '2018-10-21T20:55:02.000+02:00', 'start_idx': 0, 'end_idx': 0, 'raw_data_location': '', 'description': '', 'calibration_constant': {'id': 913, 'name': 'AGIPD-Type_Noise_AGIPD DefJAwEUE0Km+', 'flg_auto_approve': True, 'flg_available': True, 'description': 'Per-pixel (per-memory cell) noise', 'device_type_id': 2, 'calibration_id': 2, 'condition_id': 271}, 'physical_device': {'id': 58, 'name': 'AGIPD_SIV1_AGIPDV11_M315', 'device_type_id': 2, 'flg_available': True, 'parent_id': None, 'description': ''}}\n",
+      "Found constant Noise: begin at 2018-10-21 20:55:02+02:00\n",
+      "Found bad pixels at 2018-10-21 20:55:02+02:00\n",
+      "Item:  {'id': 4670, 'name': '20180923_021047_sIdx=0', 'file_name': 'cal.1537668646.6458402.h5', 'path_to_file': 'xfel/cal/agipd-type/agipd_siv1_agipdv11_m315/', 'data_set_name': '/AGIPD_SIV1_AGIPDV11_M315/Noise/0', 'flg_deployed': True, 'flg_good_quality': True, 'begin_validity_at': '2018-09-23T04:10:45.000+02:00', 'end_validity_at': None, 'begin_at': '2018-09-23T04:10:45.000+02:00', 'start_idx': 0, 'end_idx': 0, 'raw_data_location': '', 'description': '', 'calibration_constant': {'id': 913, 'name': 'AGIPD-Type_Noise_AGIPD DefJAwEUE0Km+', 'flg_auto_approve': True, 'flg_available': True, 'description': 'Per-pixel (per-memory cell) noise', 'device_type_id': 2, 'calibration_id': 2, 'condition_id': 271}, 'physical_device': {'id': 58, 'name': 'AGIPD_SIV1_AGIPDV11_M315', 'device_type_id': 2, 'flg_available': True, 'parent_id': None, 'description': ''}}\n",
+      "Found constant Noise: begin at 2018-09-23 04:10:45+02:00\n",
+      "Found bad pixels at 2018-09-23 04:10:50+02:00\n",
+      "Item:  {'id': 4546, 'name': '20180923_000251_sIdx=0', 'file_name': 'cal.1537660970.398414.h5', 'path_to_file': 'xfel/cal/agipd-type/agipd_siv1_agipdv11_m315/', 'data_set_name': '/AGIPD_SIV1_AGIPDV11_M315/Noise/0', 'flg_deployed': True, 'flg_good_quality': True, 'begin_validity_at': '2018-09-23T02:02:49.000+02:00', 'end_validity_at': None, 'begin_at': '2018-09-23T02:02:49.000+02:00', 'start_idx': 0, 'end_idx': 0, 'raw_data_location': '', 'description': '', 'calibration_constant': {'id': 913, 'name': 'AGIPD-Type_Noise_AGIPD DefJAwEUE0Km+', 'flg_auto_approve': True, 'flg_available': True, 'description': 'Per-pixel (per-memory cell) noise', 'device_type_id': 2, 'calibration_id': 2, 'condition_id': 271}, 'physical_device': {'id': 58, 'name': 'AGIPD_SIV1_AGIPDV11_M315', 'device_type_id': 2, 'flg_available': True, 'parent_id': None, 'description': ''}}\n",
+      "Found constant Noise: begin at 2018-09-23 02:02:49+02:00\n",
+      "Found bad pixels at 2018-09-23 02:02:57+02:00\n",
+      "Item:  {'id': 4482, 'name': '20180922_235703_sIdx=0', 'file_name': 'cal.1537660622.794079.h5', 'path_to_file': 'xfel/cal/agipd-type/agipd_siv1_agipdv11_m315/', 'data_set_name': '/AGIPD_SIV1_AGIPDV11_M315/Noise/0', 'flg_deployed': True, 'flg_good_quality': True, 'begin_validity_at': '2018-09-23T01:57:01.000+02:00', 'end_validity_at': None, 'begin_at': '2018-09-23T01:57:01.000+02:00', 'start_idx': 0, 'end_idx': 0, 'raw_data_location': '', 'description': '', 'calibration_constant': {'id': 913, 'name': 'AGIPD-Type_Noise_AGIPD DefJAwEUE0Km+', 'flg_auto_approve': True, 'flg_available': True, 'description': 'Per-pixel (per-memory cell) noise', 'device_type_id': 2, 'calibration_id': 2, 'condition_id': 271}, 'physical_device': {'id': 58, 'name': 'AGIPD_SIV1_AGIPDV11_M315', 'device_type_id': 2, 'flg_available': True, 'parent_id': None, 'description': ''}}\n",
+      "Found constant Noise: begin at 2018-09-23 01:57:01+02:00\n",
+      "Found bad pixels at 2018-09-23 01:57:06+02:00\n",
+      "Item:  {'id': 5269, 'name': '20181025_061038_sIdx=0', 'file_name': 'cal.1540447837.275528.h5', 'path_to_file': 'xfel/cal/agipd-type/agipd_siv1_agipdv11_m315/', 'data_set_name': '/AGIPD_SIV1_AGIPDV11_M315/Noise/0', 'flg_deployed': True, 'flg_good_quality': True, 'begin_validity_at': '2018-09-02T16:25:41.000+02:00', 'end_validity_at': None, 'begin_at': '2018-09-02T16:25:41.000+02:00', 'start_idx': 0, 'end_idx': 0, 'raw_data_location': '', 'description': '', 'calibration_constant': {'id': 913, 'name': 'AGIPD-Type_Noise_AGIPD DefJAwEUE0Km+', 'flg_auto_approve': True, 'flg_available': True, 'description': 'Per-pixel (per-memory cell) noise', 'device_type_id': 2, 'calibration_id': 2, 'condition_id': 271}, 'physical_device': {'id': 58, 'name': 'AGIPD_SIV1_AGIPDV11_M315', 'device_type_id': 2, 'flg_available': True, 'parent_id': None, 'description': ''}}\n",
+      "Found constant Noise: begin at 2018-09-02 16:25:41+02:00\n",
+      "Found bad pixels at 2018-09-02 16:25:41+02:00\n",
+      "Item:  {'id': 3431, 'name': '20180901_173920_sIdx=0', 'file_name': 'cal.1535823559.5818477.h5', 'path_to_file': 'xfel/cal/agipd-type/agipd_siv1_agipdv11_m315/', 'data_set_name': '/AGIPD_SIV1_AGIPDV11_M315/Noise/0', 'flg_deployed': True, 'flg_good_quality': True, 'begin_validity_at': '2018-09-01T19:39:13.000+02:00', 'end_validity_at': None, 'begin_at': '2018-09-01T19:39:13.000+02:00', 'start_idx': 0, 'end_idx': 0, 'raw_data_location': '', 'description': '', 'calibration_constant': {'id': 913, 'name': 'AGIPD-Type_Noise_AGIPD DefJAwEUE0Km+', 'flg_auto_approve': True, 'flg_available': True, 'description': 'Per-pixel (per-memory cell) noise', 'device_type_id': 2, 'calibration_id': 2, 'condition_id': 271}, 'physical_device': {'id': 58, 'name': 'AGIPD_SIV1_AGIPDV11_M315', 'device_type_id': 2, 'flg_available': True, 'parent_id': None, 'description': ''}}\n",
+      "Found constant Noise: begin at 2018-09-01 19:39:13+02:00\n",
+      "Found bad pixels at 2018-09-01 19:39:29+02:00\n",
+      "Item:  {'id': 3229, 'name': '20180830_164924_sIdx=0', 'file_name': 'cal.1535647763.2838182.h5', 'path_to_file': 'xfel/cal/agipd-type/agipd_siv1_agipdv11_m315/', 'data_set_name': '/AGIPD_SIV1_AGIPDV11_M315/Noise/0', 'flg_deployed': True, 'flg_good_quality': True, 'begin_validity_at': '2018-08-30T18:49:21.000+02:00', 'end_validity_at': None, 'begin_at': '2018-08-30T18:49:21.000+02:00', 'start_idx': 0, 'end_idx': 0, 'raw_data_location': '', 'description': '', 'calibration_constant': {'id': 913, 'name': 'AGIPD-Type_Noise_AGIPD DefJAwEUE0Km+', 'flg_auto_approve': True, 'flg_available': True, 'description': 'Per-pixel (per-memory cell) noise', 'device_type_id': 2, 'calibration_id': 2, 'condition_id': 271}, 'physical_device': {'id': 58, 'name': 'AGIPD_SIV1_AGIPDV11_M315', 'device_type_id': 2, 'flg_available': True, 'parent_id': None, 'description': ''}}\n",
+      "Found constant Noise: begin at 2018-08-30 18:49:21+02:00\n",
+      "Found bad pixels at 2018-08-30 18:49:26+02:00\n",
+      "Item:  {'id': 6413, 'name': '20181210_082033_sIdx=0', 'file_name': 'cal.1544430032.7715538.h5', 'path_to_file': 'xfel/cal/agipd-type/agipd_siv1_agipdv11_m315/', 'data_set_name': '/AGIPD_SIV1_AGIPDV11_M315/Noise/0', 'flg_deployed': True, 'flg_good_quality': True, 'begin_validity_at': '2018-01-29T17:10:23.000+01:00', 'end_validity_at': None, 'begin_at': '2018-01-29T17:10:23.000+01:00', 'start_idx': 0, 'end_idx': 0, 'raw_data_location': '', 'description': '', 'calibration_constant': {'id': 913, 'name': 'AGIPD-Type_Noise_AGIPD DefJAwEUE0Km+', 'flg_auto_approve': True, 'flg_available': True, 'description': 'Per-pixel (per-memory cell) noise', 'device_type_id': 2, 'calibration_id': 2, 'condition_id': 271}, 'physical_device': {'id': 58, 'name': 'AGIPD_SIV1_AGIPDV11_M315', 'device_type_id': 2, 'flg_available': True, 'parent_id': None, 'description': ''}}\n",
+      "Found constant Noise: begin at 2018-01-29 17:10:23+01:00\n",
+      "Found bad pixels at 2018-01-29 17:10:23+01:00\n",
+      "Item:  {'id': 6348, 'name': '20181210_081739_sIdx=0', 'file_name': 'cal.1544429858.2109814.h5', 'path_to_file': 'xfel/cal/agipd-type/agipd_siv1_agipdv11_m315/', 'data_set_name': '/AGIPD_SIV1_AGIPDV11_M315/Noise/0', 'flg_deployed': True, 'flg_good_quality': True, 'begin_validity_at': '2017-12-04T20:15:40.000+01:00', 'end_validity_at': None, 'begin_at': '2017-12-04T20:15:40.000+01:00', 'start_idx': 0, 'end_idx': 0, 'raw_data_location': '', 'description': '', 'calibration_constant': {'id': 913, 'name': 'AGIPD-Type_Noise_AGIPD DefJAwEUE0Km+', 'flg_auto_approve': True, 'flg_available': True, 'description': 'Per-pixel (per-memory cell) noise', 'device_type_id': 2, 'calibration_id': 2, 'condition_id': 271}, 'physical_device': {'id': 58, 'name': 'AGIPD_SIV1_AGIPDV11_M315', 'device_type_id': 2, 'flg_available': True, 'parent_id': None, 'description': ''}}\n",
+      "Bad pixels are not found!\n",
+      "Item:  {'id': 6590, 'name': '20181210_092654_sIdx=0', 'file_name': 'cal.1544434013.2191806.h5', 'path_to_file': 'xfel/cal/agipd-type/agipd_siv1_agipdv11_m315/', 'data_set_name': '/AGIPD_SIV1_AGIPDV11_M315/Noise/0', 'flg_deployed': True, 'flg_good_quality': True, 'begin_validity_at': '2017-10-10T19:00:34.000+02:00', 'end_validity_at': None, 'begin_at': '2017-10-10T19:00:34.000+02:00', 'start_idx': 0, 'end_idx': 0, 'raw_data_location': '', 'description': '', 'calibration_constant': {'id': 913, 'name': 'AGIPD-Type_Noise_AGIPD DefJAwEUE0Km+', 'flg_auto_approve': True, 'flg_available': True, 'description': 'Per-pixel (per-memory cell) noise', 'device_type_id': 2, 'calibration_id': 2, 'condition_id': 271}, 'physical_device': {'id': 58, 'name': 'AGIPD_SIV1_AGIPDV11_M315', 'device_type_id': 2, 'flg_available': True, 'parent_id': None, 'description': ''}}\n",
+      "Found constant Noise: begin at 2017-10-10 19:00:34+02:00\n",
+      "Found bad pixels at 2017-10-10 19:00:34+02:00\n",
+      "Item:  {'id': 6509, 'name': '20181210_085802_sIdx=0', 'file_name': 'cal.1544432281.1941464.h5', 'path_to_file': 'xfel/cal/agipd-type/agipd_siv1_agipdv11_m315/', 'data_set_name': '/AGIPD_SIV1_AGIPDV11_M315/Noise/0', 'flg_deployed': True, 'flg_good_quality': True, 'begin_validity_at': '2017-09-19T15:10:49.000+02:00', 'end_validity_at': None, 'begin_at': '2017-09-19T15:10:49.000+02:00', 'start_idx': 0, 'end_idx': 0, 'raw_data_location': '', 'description': '', 'calibration_constant': {'id': 913, 'name': 'AGIPD-Type_Noise_AGIPD DefJAwEUE0Km+', 'flg_auto_approve': True, 'flg_available': True, 'description': 'Per-pixel (per-memory cell) noise', 'device_type_id': 2, 'calibration_id': 2, 'condition_id': 271}, 'physical_device': {'id': 58, 'name': 'AGIPD_SIV1_AGIPDV11_M315', 'device_type_id': 2, 'flg_available': True, 'parent_id': None, 'description': ''}}\n",
+      "Found constant Noise: begin at 2017-09-19 15:10:49+02:00\n",
+      "Found bad pixels at 2017-09-19 15:10:49+02:00\n",
+      "Item:  {'id': 6543, 'name': '20181210_085904_sIdx=0', 'file_name': 'cal.1544432342.903418.h5', 'path_to_file': 'xfel/cal/agipd-type/agipd_siv1_agipdv11_m315/', 'data_set_name': '/AGIPD_SIV1_AGIPDV11_M315/Noise/0', 'flg_deployed': True, 'flg_good_quality': True, 'begin_validity_at': '2017-09-15T23:33:29.000+02:00', 'end_validity_at': None, 'begin_at': '2017-09-15T23:33:29.000+02:00', 'start_idx': 0, 'end_idx': 0, 'raw_data_location': '', 'description': '', 'calibration_constant': {'id': 913, 'name': 'AGIPD-Type_Noise_AGIPD DefJAwEUE0Km+', 'flg_auto_approve': True, 'flg_available': True, 'description': 'Per-pixel (per-memory cell) noise', 'device_type_id': 2, 'calibration_id': 2, 'condition_id': 271}, 'physical_device': {'id': 58, 'name': 'AGIPD_SIV1_AGIPDV11_M315', 'device_type_id': 2, 'flg_available': True, 'parent_id': None, 'description': ''}}\n",
+      "Found constant Noise: begin at 2017-09-15 23:33:29+02:00\n",
+      "Found bad pixels at 2017-09-15 23:33:29+02:00\n",
+      "Request:  Noise with paramters: {'bias_voltage': 300, 'module': 'Q1M2', 'mem_cells': 128, 'acquisition_rate': 1.1}\n"
+     ]
+    },
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "constantDark: BadPixelsDark\n",
+      "Request:  Noise with paramters: {'bias_voltage': 300, 'module': 'Q1M2', 'mem_cells': 128, 'acquisition_rate': 2.2}\n"
+     ]
+    },
+    {
+     "ename": "KeyboardInterrupt",
+     "evalue": "",
+     "output_type": "error",
+     "traceback": [
+      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+      "\u001b[0;31mKeyboardInterrupt\u001b[0m                         Traceback (most recent call last)",
+      "\u001b[0;32m<ipython-input-5-a602d73b9ab9>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m     38\u001b[0m                            \u001b[0mtimeout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcal_db_timeout\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     39\u001b[0m                            \u001b[0mmeta_only\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 40\u001b[0;31m                            version_info=True)\n\u001b[0m\u001b[1;32m     41\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     42\u001b[0m         \u001b[0;31m# Request BP constant versions\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+      "\u001b[0;32m/gpfs/exfel/data/scratch/karnem/calibration3/pycalibration/cal_tools/cal_tools/tools.py\u001b[0m in \u001b[0;36mget_from_db\u001b[0;34m(device, constant, condition, empty_constant, cal_db_interface, creation_time, verbosity, timeout, ntries, meta_only, version_info)\u001b[0m\n\u001b[1;32m    512\u001b[0m                 r = metadata.retrieve(this_interface, timeout=timeout,\n\u001b[1;32m    513\u001b[0m                                       \u001b[0mwhen\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mwhen\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmeta_only\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmeta_only\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 514\u001b[0;31m                                       version_info=version_info)\n\u001b[0m\u001b[1;32m    515\u001b[0m                 \u001b[0;32mif\u001b[0m \u001b[0mversion_info\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    516\u001b[0m                     \u001b[0;32mreturn\u001b[0m \u001b[0mr\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+      "\u001b[0;32m~/.local/lib/python3.6/site-packages/iCalibrationDB/meta_data.py\u001b[0m in \u001b[0;36mretrieve\u001b[0;34m(self, receiver, when, silent, timeout, meta_only, version_info)\u001b[0m\n\u001b[1;32m    285\u001b[0m             \u001b[0msock\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconnect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mreceiver\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    286\u001b[0m             \u001b[0msock\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msend_pyobj\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 287\u001b[0;31m             \u001b[0mresp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msock\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrecv_pyobj\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    288\u001b[0m         \u001b[0;32mfinally\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    289\u001b[0m             \u001b[0;32mdel\u001b[0m \u001b[0msock\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+      "\u001b[0;32m/software/anaconda3/5.2/lib/python3.6/site-packages/zmq/sugar/socket.py\u001b[0m in \u001b[0;36mrecv_pyobj\u001b[0;34m(self, flags)\u001b[0m\n\u001b[1;32m    620\u001b[0m             \u001b[0;32mfor\u001b[0m \u001b[0many\u001b[0m \u001b[0mof\u001b[0m \u001b[0mthe\u001b[0m \u001b[0mreasons\u001b[0m \u001b[0;34m:\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;31m`\u001b[0m\u001b[0;34m~\u001b[0m\u001b[0mSocket\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrecv\u001b[0m\u001b[0;31m`\u001b[0m \u001b[0mmight\u001b[0m \u001b[0mfail\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    621\u001b[0m         \"\"\"\n\u001b[0;32m--> 622\u001b[0;31m         \u001b[0mmsg\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrecv\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mflags\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    623\u001b[0m         \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_deserialize\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmsg\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpickle\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mloads\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    624\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
+      "\u001b[0;32mzmq/backend/cython/socket.pyx\u001b[0m in \u001b[0;36mzmq.backend.cython.socket.Socket.recv\u001b[0;34m()\u001b[0m\n",
+      "\u001b[0;32mzmq/backend/cython/socket.pyx\u001b[0m in \u001b[0;36mzmq.backend.cython.socket.Socket.recv\u001b[0;34m()\u001b[0m\n",
+      "\u001b[0;32mzmq/backend/cython/socket.pyx\u001b[0m in \u001b[0;36mzmq.backend.cython.socket._recv_copy\u001b[0;34m()\u001b[0m\n",
+      "\u001b[0;32m/software/anaconda3/5.2/lib/python3.6/site-packages/zmq/backend/cython/checkrc.pxd\u001b[0m in \u001b[0;36mzmq.backend.cython.checkrc._check_rc\u001b[0;34m()\u001b[0m\n",
+      "\u001b[0;31mKeyboardInterrupt\u001b[0m: "
+     ]
+    }
+   ],
    "source": [
     "# Retrieve list of meta-data\n",
     "constant_versions = []\n",
@@ -591,6 +693,7 @@
     "                    rdata['MeanBP'][rdata['MeanBP'] < 0.1] = np.nan\n",
     "\n",
     "            if 'NBP' in rdata:\n",
+    "                rdata['NBP'] = rdata['NBP'].astype(float)\n",
     "                rdata[\"NBP\"][rdata[\"NBP\"] == (spShape[0] * spShape[1])] = np.nan\n",
     "                rdata[\"NBP\"] = rdata[\"NBP\"] / (spShape[0] * spShape[1]) * 100\n",
     "\n",
diff --git a/notebooks/FastCCD/PlotFromCalDB_FastCCD_NBC.ipynb b/notebooks/FastCCD/PlotFromCalDB_FastCCD_NBC.ipynb
index b0b88ecd6..e2b9a436f 100644
--- a/notebooks/FastCCD/PlotFromCalDB_FastCCD_NBC.ipynb
+++ b/notebooks/FastCCD/PlotFromCalDB_FastCCD_NBC.ipynb
@@ -443,6 +443,7 @@
     "                    rdata['MeanBP'][rdata['MeanBP'] < 0.1] = np.nan\n",
     "                    \n",
     "            if 'NBP' in rdata:\n",
+    "                rdata['NBP'] = rdata['NBP'].astype(float)\n",
     "                rdata[\"NBP\"][rdata[\"NBP\"] == (spShape[0] * spShape[1])] = np.nan\n",
     "                rdata[\"NBP\"] = rdata[\"NBP\"] / spShape[0] / spShape[1] * 100\n",
     "\n",
diff --git a/notebooks/LPD/PlotFromCalDB_LPD_NBC.ipynb b/notebooks/LPD/PlotFromCalDB_LPD_NBC.ipynb
index d30fc84ba..d6eba9461 100644
--- a/notebooks/LPD/PlotFromCalDB_LPD_NBC.ipynb
+++ b/notebooks/LPD/PlotFromCalDB_LPD_NBC.ipynb
@@ -578,6 +578,7 @@
     "                    rdata['MeanBP'][rdata['MeanBP'] < 0.1] = np.nan\n",
     "\n",
     "            if 'NBP' in rdata:\n",
+    "                rdata['NBP'] = rdata['NBP'].astype(float)\n",
     "                rdata[\"NBP\"][rdata[\"NBP\"] == (spShape[0] * spShape[1])] = np.nan\n",
     "                rdata[\"NBP\"] = rdata[\"NBP\"] / (spShape[0] * spShape[1]) * 100\n",
     "\n",
-- 
GitLab