From 874646bd4ee69447937a7edd213e4745b9571195 Mon Sep 17 00:00:00 2001
From: Steffen Hauf <xcal@max-exfl016.desy.de>
Date: Thu, 8 Aug 2019 17:06:11 +0200
Subject: [PATCH] Allow to query versions, fixes to AGIPD

---
 cal_tools/cal_tools/agipdlib.py               |  47 +-
 cal_tools/cal_tools/tools.py                  |  27 +-
 .../AGIPD/AGIPD_Correct_and_Verify.ipynb      | 584 +++++++++++++++---
 ...Jungfrau_Gain_Correct_and_Verify_NBC.ipynb |  56 +-
 ...Jungfrau_dark_analysis_all_gains_NBC.ipynb |  33 +-
 5 files changed, 595 insertions(+), 152 deletions(-)

diff --git a/cal_tools/cal_tools/agipdlib.py b/cal_tools/cal_tools/agipdlib.py
index 36d2d4044..dad5499d4 100644
--- a/cal_tools/cal_tools/agipdlib.py
+++ b/cal_tools/cal_tools/agipdlib.py
@@ -76,7 +76,8 @@ class AgipdCorrections:
                  cal_det_instance="AGIPD1M1", karabo_data_mode=False,
                  force_hg_if_below=None, force_mg_if_below=None,
                  mask_noisy_adc=False, adjust_mg_baseline=False,
-                 acquisition_rate=None):
+                 acquisition_rate=None, dont_zero_nans=False,
+                 dont_zero_orange=False):
         """
         Initialize an AgipdCorrections Class
 
@@ -148,6 +149,9 @@ class AgipdCorrections:
         self.adjust_mg_baseline = adjust_mg_baseline
         self.mg_bl_adjust = 0
         self.acquisition_rate = acquisition_rate
+        self.dont_zero_nans = dont_zero_nans
+        self.dont_zero_orange = dont_zero_orange
+        self.valid_indices = None
 
     def get_iteration_range(self):
         """Returns a range expression over which to iterate in chunks
@@ -999,14 +1003,16 @@ class AgipdCorrections:
 
         # create a bad pixel mask for the data
         # we add any non-finite values to the mask
-        bidx = ~np.isfinite(im)
-        im[bidx] = 0
-        msk[bidx] |= BadPixels.VALUE_IS_NAN.value
+        if not self.dont_zero_nans:
+            bidx = ~np.isfinite(im)
+            im[bidx] = 0
+            msk[bidx] |= BadPixels.VALUE_IS_NAN.value
 
         # and such with have unrealistically high and low pixel values
-        bidx = (im < -1e7) | (im > 1e7)
-        im[bidx] = 0
-        msk[bidx] |= BadPixels.VALUE_OUT_OF_RANGE.value
+        if not self.dont_zero_orange:
+            bidx = (im < -1e7) | (im > 1e7)
+            im[bidx] = 0
+            msk[bidx] |= BadPixels.VALUE_OUT_OF_RANGE.value
 
         # include pixels with zero standard deviation in the dataset into
         # the mask
@@ -1070,7 +1076,7 @@ class AgipdCorrections:
         """ Return the indices of valid data
         """
         agipd_base = self.idx_base
-        print(agipd_base)
+
         if self.index_v == 2:
             count = np.squeeze(self.infile[agipd_base + "image/count"])
             first = np.squeeze(self.infile[agipd_base + "image/first"])
@@ -1082,9 +1088,21 @@ class AgipdCorrections:
             lowok = (idxtrains > medianTrain - 1e4)
             highok = (idxtrains < medianTrain + 1e4)
             valid &= lowok & highok
+            
+            uq, fidxv, cntsv = np.unique(idxtrains,
+                                         return_index=True,
+                                         return_counts=True)
+            valid &= cntsv == 1  # filter out double trains
             self.valid = valid
             last_index = int(first[valid][-1] + count[valid][-1])
             first_index = int(first[valid][0])
+            
+            # do actual validity filtering:
+            validc, validf = count[valid], first[valid]
+            valid_indices = np.concatenate([np.arange(validf[i],
+                                             validf[i]+validc[i]) 
+                                             for i in range(validf.size)], axis=0)
+            self.valid_indices = np.squeeze(valid_indices).astype(np.int32)
 
         elif self.index_v == 1:
             status = np.squeeze(self.infile[agipd_base + "image/status"])
@@ -1119,8 +1137,11 @@ class AgipdCorrections:
         last_index = self.last_index
         max_cells = self.max_cells
         agipd_base = self.agipd_base
-        allcells = self.infile[agipd_base + "image/cellId"]
-        allcells = np.squeeze(allcells[first_index:last_index, ...])
+        allcells = np.squeeze(self.infile[agipd_base + "image/cellId"])
+        if self.valid_indices is not None:
+            allcells = allcells[self.valid_indices]
+        else:
+            allcells = allcells[first_index:last_index]
 
         single_image = self.infile[agipd_base + "image/data"][first_index, ...]
         single_image = np.array(single_image)
@@ -1129,7 +1150,10 @@ class AgipdCorrections:
         if np.count_nonzero(can_calibrate) == 0:
             return
         allcells = allcells[can_calibrate]
-        firange = np.arange(first_index, last_index)
+        if self.valid_indices is not None:
+            firange = np.arange(first_index, last_index)
+        else:
+            firange = self.valid_indices
         firange = firange[can_calibrate]
 
         self.oshape = (firange.size if not self.il_mode else firange.size // 2,
@@ -1152,6 +1176,7 @@ class AgipdCorrections:
         if self.il_mode:
             firange = firange[0::2]
         alltrains = self.infile[agipd_base + "image/trainId"]
+        
         alltrains = np.squeeze(
             alltrains[first_index:last_index, ...])
 
diff --git a/cal_tools/cal_tools/tools.py b/cal_tools/cal_tools/tools.py
index 363dd51c8..0e9c4be6e 100644
--- a/cal_tools/cal_tools/tools.py
+++ b/cal_tools/cal_tools/tools.py
@@ -297,9 +297,9 @@ def make_titlepage(sphinx_path, project, data_path, version):
         title_tmp = Template(file_.read())
 
     with open("{}/titlepage.tex.txt".format(sphinx_path), "w+") as mf:
-        mf.write(dedent(title_tmp.render(project=project,
-                                         data_path=data_path,
-                                         version=version)))
+        mf.write(dedent(title_tmp.render(project=tex_escape(project),
+                                         data_path=tex_escape(data_path),
+                                         version=tex_escape(version))))
 
 
 def finalize(joblist, finaljob, run_path, out_path, project, calibration,
@@ -454,7 +454,8 @@ already_printed = {}
 
 def get_from_db(device, constant, condition, empty_constant,
                 cal_db_interface, creation_time=None,
-                verbosity=1, timeout=30000, ntries=120, meta_only=True):
+                verbosity=1, timeout=30000, ntries=120, meta_only=True,
+                version_info=False):
     """
     Return calibration constants and metadata requested from CalDB
 
@@ -474,6 +475,12 @@ def get_from_db(device, constant, condition, empty_constant,
     from iCalibrationDB import ConstantMetaData, Versions
     import zmq
 
+    meta_only=True
+    timeout=1200000
+    
+    if version_info:
+        meta_only = False
+    
     if device:
         metadata = ConstantMetaData()
         metadata.calibration_constant = constant
@@ -486,17 +493,25 @@ def get_from_db(device, constant, condition, empty_constant,
                 start=creation_time)
 
         while ntries > 0:
+            
             this_interface = get_random_db_interface(cal_db_interface)
             try:
-                metadata.retrieve(this_interface, timeout=timeout,
-                                  meta_only=meta_only)
+                print("Retrieving from {} for {}".format(this_interface, device))
+                
+                r = metadata.retrieve(this_interface, timeout=timeout,
+                                      meta_only=meta_only, version_info=version_info)
+                
+                if version_info:
+                    return r
                 break
             except zmq.error.Again:
                 ntries -= 1
+                sleep(np.random.randint(30))
             except Exception as e:
                 if verbosity > 0:
                     print(e)
                 ntries = 0
+                break
 
         if ntries > 0:
             if verbosity > 0:
diff --git a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
index 5d6524115..051c37fd8 100644
--- a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
+++ b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
@@ -13,30 +13,29 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 1,
    "metadata": {
     "ExecuteTime": {
      "end_time": "2019-02-21T11:30:06.730220Z",
      "start_time": "2019-02-21T11:30:06.658286Z"
-    },
-    "collapsed": true
+    }
    },
    "outputs": [],
    "source": [
-    "in_folder = \"/gpfs/exfel/exp/SPB/201901/p002480/raw/\" # the folder to read data from, required\n",
-    "run = 11 # runs to process, required\n",
-    "out_folder =  \"/gpfs/exfel/exp/SPB/201901/p002480/proc/\"  # the folder to output to, required\n",
-    "calfile =  \"/gpfs/exfel/data/scratch/haufs/agipd_on_demand/agipd_store.h5\" # path to calibration file. Leave empty if all data should come from DB\n",
+    "in_folder = \"/gpfs/exfel/exp/MID/201931/p900090/raw/\" # the folder to read data from, required\n",
+    "run = 5 # runs to process, required\n",
+    "out_folder =  \"/gpfs/exfel/exp/MID/201931/p900090/proc/\"  # the folder to output to, required\n",
+    "calfile =  \"/gpfs/exfel/data/scratch/haufs/agipd_on_demand/agipd_store_mid.h5\" # path to calibration file. Leave empty if all data should come from DB\n",
     "sequences =  [-1] # sequences to correct, set to -1 for all, range allowed\n",
     "mem_cells = 0 # number of memory cells used, set to 0 to automatically infer\n",
     "interlaced = False # whether data is in interlaced layout\n",
     "overwrite = True # set to True if existing data should be overwritten\n",
     "no_relative_gain = False # do not do relative gain correction\n",
-    "cluster_profile = \"noDB5\"\n",
+    "cluster_profile = \"noDB\"\n",
     "max_pulses = 500\n",
     "local_input = False\n",
     "bias_voltage = 300\n",
-    "cal_db_interface = \"tcp://max-exfl016:8020#8025\" # the database interface to use\n",
+    "cal_db_interface = \"tcp://max-exfl016:8015#8045\" # the database interface to use\n",
     "use_dir_creation_date = True # use the creation data of the input dir for database queries\n",
     "sequences_per_node = 2 # number of sequence files per cluster node if run as slurm job, set to 0 to not run SLURM parallel\n",
     "photon_energy = 9.2 # photon energy in keV\n",
@@ -53,12 +52,14 @@
     "max_cells_db = 0 # set to a value different than 0 to use this value for DB queries\n",
     "chunk_size_idim = 1  # chunking size of imaging dimension, adjust if user software is sensitive to this.\n",
     "creation_date_offset = \"00:00:00\" # add an offset to creation date, e.g. to get different constants\n",
-    "instrument = \"SPB\"  # the instrument the detector is installed at, required\n",
+    "instrument = \"MID\"  # the instrument the detector is installed at, required\n",
     "force_hg_if_below = 1000 # set to a value other than 0 to force a pixel into high gain if it's high gain offset subtracted value is below this threshold\n",
     "force_mg_if_below = 1000 # set to a value other than 0 to force a pixel into medium gain if it's medium gain offset subtracted value is below this threshold\n",
     "mask_noisy_adc = 0.25 # set to a value other than 0 and below 1 to mask entire ADC if fraction of noisy pixels is above\n",
     "adjust_mg_baseline = False # adjust medium gain baseline to match highest high gain value\n",
     "acq_rate = 0. # the detector acquisition rate, use 0 to try to auto-determine\n",
+    "dont_zero_nans = False # do not zero NaN values in corrected data\n",
+    "dont_zero_orange = False # do not zero very negative and very large values\n",
     "\n",
     "def balance_sequences(in_folder, run, sequences, sequences_per_node):\n",
     "    import glob\n",
@@ -84,15 +85,26 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 2,
    "metadata": {
     "ExecuteTime": {
      "end_time": "2019-02-21T11:30:07.086286Z",
      "start_time": "2019-02-21T11:30:06.929722Z"
-    },
-    "collapsed": false
+    }
    },
-   "outputs": [],
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "Connecting to profile noDB\n",
+      "Using 2019-07-19 08:16:33.773894 as creation time\n",
+      "Working in IL Mode: False. Actual cells in use are: 0\n",
+      "Outputting to /gpfs/exfel/exp/MID/201931/p900090/proc//r0005\n",
+      "Detector in use is MID_DET_AGIPD1M-1\n"
+     ]
+    }
+   ],
    "source": [
     "import sys\n",
     "from collections import OrderedDict\n",
@@ -176,13 +188,12 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 3,
    "metadata": {
     "ExecuteTime": {
      "end_time": "2019-02-21T11:30:07.263445Z",
      "start_time": "2019-02-21T11:30:07.217070Z"
-    },
-    "collapsed": true
+    }
    },
    "outputs": [],
    "source": [
@@ -236,13 +247,12 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 4,
    "metadata": {
     "ExecuteTime": {
      "end_time": "2019-02-21T11:30:07.974174Z",
      "start_time": "2019-02-21T11:30:07.914832Z"
-    },
-    "collapsed": true
+    }
    },
    "outputs": [],
    "source": [
@@ -303,15 +313,407 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 5,
    "metadata": {
     "ExecuteTime": {
      "end_time": "2019-02-21T11:30:08.870802Z",
      "start_time": "2019-02-21T11:30:08.826285Z"
-    },
-    "collapsed": false
+    }
    },
-   "outputs": [],
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "Processing a total of 368 sequence files in chunks of 32\n"
+     ]
+    },
+    {
+     "data": {
+      "text/latex": [
+       "\\begin{tabular}{rlrl}\n",
+       "\\hline\n",
+       "   \\# & module   &   \\# module & file                                                                      \\\\\n",
+       "\\hline\n",
+       "   0 & Q1M1     &          0 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00000.h5 \\\\\n",
+       "   1 &          &          1 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00001.h5 \\\\\n",
+       "   2 &          &          2 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00002.h5 \\\\\n",
+       "   3 &          &          3 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00003.h5 \\\\\n",
+       "   4 &          &          4 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00004.h5 \\\\\n",
+       "   5 &          &          5 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00005.h5 \\\\\n",
+       "   6 &          &          6 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00006.h5 \\\\\n",
+       "   7 &          &          7 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00007.h5 \\\\\n",
+       "   8 &          &          8 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00008.h5 \\\\\n",
+       "   9 &          &          9 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00009.h5 \\\\\n",
+       "  10 &          &         10 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00010.h5 \\\\\n",
+       "  11 &          &         11 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00011.h5 \\\\\n",
+       "  12 &          &         12 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00012.h5 \\\\\n",
+       "  13 &          &         13 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00013.h5 \\\\\n",
+       "  14 &          &         14 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00014.h5 \\\\\n",
+       "  15 &          &         15 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00015.h5 \\\\\n",
+       "  16 &          &         16 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00016.h5 \\\\\n",
+       "  17 &          &         17 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00017.h5 \\\\\n",
+       "  18 &          &         18 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00018.h5 \\\\\n",
+       "  19 &          &         19 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00019.h5 \\\\\n",
+       "  20 &          &         20 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00020.h5 \\\\\n",
+       "  21 &          &         21 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00021.h5 \\\\\n",
+       "  22 &          &         22 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD00-S00022.h5 \\\\\n",
+       "  23 & Q1M2     &          0 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00000.h5 \\\\\n",
+       "  24 &          &          1 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00001.h5 \\\\\n",
+       "  25 &          &          2 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00002.h5 \\\\\n",
+       "  26 &          &          3 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00003.h5 \\\\\n",
+       "  27 &          &          4 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00004.h5 \\\\\n",
+       "  28 &          &          5 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00005.h5 \\\\\n",
+       "  29 &          &          6 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00006.h5 \\\\\n",
+       "  30 &          &          7 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00007.h5 \\\\\n",
+       "  31 &          &          8 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00008.h5 \\\\\n",
+       "  32 &          &          9 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00009.h5 \\\\\n",
+       "  33 &          &         10 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00010.h5 \\\\\n",
+       "  34 &          &         11 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00011.h5 \\\\\n",
+       "  35 &          &         12 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00012.h5 \\\\\n",
+       "  36 &          &         13 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00013.h5 \\\\\n",
+       "  37 &          &         14 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00014.h5 \\\\\n",
+       "  38 &          &         15 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00015.h5 \\\\\n",
+       "  39 &          &         16 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00016.h5 \\\\\n",
+       "  40 &          &         17 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00017.h5 \\\\\n",
+       "  41 &          &         18 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00018.h5 \\\\\n",
+       "  42 &          &         19 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00019.h5 \\\\\n",
+       "  43 &          &         20 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00020.h5 \\\\\n",
+       "  44 &          &         21 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00021.h5 \\\\\n",
+       "  45 &          &         22 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD01-S00022.h5 \\\\\n",
+       "  46 & Q1M3     &          0 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00000.h5 \\\\\n",
+       "  47 &          &          1 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00001.h5 \\\\\n",
+       "  48 &          &          2 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00002.h5 \\\\\n",
+       "  49 &          &          3 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00003.h5 \\\\\n",
+       "  50 &          &          4 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00004.h5 \\\\\n",
+       "  51 &          &          5 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00005.h5 \\\\\n",
+       "  52 &          &          6 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00006.h5 \\\\\n",
+       "  53 &          &          7 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00007.h5 \\\\\n",
+       "  54 &          &          8 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00008.h5 \\\\\n",
+       "  55 &          &          9 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00009.h5 \\\\\n",
+       "  56 &          &         10 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00010.h5 \\\\\n",
+       "  57 &          &         11 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00011.h5 \\\\\n",
+       "  58 &          &         12 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00012.h5 \\\\\n",
+       "  59 &          &         13 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00013.h5 \\\\\n",
+       "  60 &          &         14 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00014.h5 \\\\\n",
+       "  61 &          &         15 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00015.h5 \\\\\n",
+       "  62 &          &         16 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00016.h5 \\\\\n",
+       "  63 &          &         17 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00017.h5 \\\\\n",
+       "  64 &          &         18 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00018.h5 \\\\\n",
+       "  65 &          &         19 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00019.h5 \\\\\n",
+       "  66 &          &         20 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00020.h5 \\\\\n",
+       "  67 &          &         21 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00021.h5 \\\\\n",
+       "  68 &          &         22 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD02-S00022.h5 \\\\\n",
+       "  69 & Q1M4     &          0 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00000.h5 \\\\\n",
+       "  70 &          &          1 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00001.h5 \\\\\n",
+       "  71 &          &          2 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00002.h5 \\\\\n",
+       "  72 &          &          3 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00003.h5 \\\\\n",
+       "  73 &          &          4 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00004.h5 \\\\\n",
+       "  74 &          &          5 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00005.h5 \\\\\n",
+       "  75 &          &          6 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00006.h5 \\\\\n",
+       "  76 &          &          7 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00007.h5 \\\\\n",
+       "  77 &          &          8 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00008.h5 \\\\\n",
+       "  78 &          &          9 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00009.h5 \\\\\n",
+       "  79 &          &         10 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00010.h5 \\\\\n",
+       "  80 &          &         11 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00011.h5 \\\\\n",
+       "  81 &          &         12 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00012.h5 \\\\\n",
+       "  82 &          &         13 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00013.h5 \\\\\n",
+       "  83 &          &         14 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00014.h5 \\\\\n",
+       "  84 &          &         15 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00015.h5 \\\\\n",
+       "  85 &          &         16 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00016.h5 \\\\\n",
+       "  86 &          &         17 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00017.h5 \\\\\n",
+       "  87 &          &         18 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00018.h5 \\\\\n",
+       "  88 &          &         19 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00019.h5 \\\\\n",
+       "  89 &          &         20 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00020.h5 \\\\\n",
+       "  90 &          &         21 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00021.h5 \\\\\n",
+       "  91 &          &         22 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD03-S00022.h5 \\\\\n",
+       "  92 & Q2M1     &          0 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00000.h5 \\\\\n",
+       "  93 &          &          1 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00001.h5 \\\\\n",
+       "  94 &          &          2 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00002.h5 \\\\\n",
+       "  95 &          &          3 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00003.h5 \\\\\n",
+       "  96 &          &          4 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00004.h5 \\\\\n",
+       "  97 &          &          5 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00005.h5 \\\\\n",
+       "  98 &          &          6 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00006.h5 \\\\\n",
+       "  99 &          &          7 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00007.h5 \\\\\n",
+       " 100 &          &          8 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00008.h5 \\\\\n",
+       " 101 &          &          9 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00009.h5 \\\\\n",
+       " 102 &          &         10 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00010.h5 \\\\\n",
+       " 103 &          &         11 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00011.h5 \\\\\n",
+       " 104 &          &         12 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00012.h5 \\\\\n",
+       " 105 &          &         13 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00013.h5 \\\\\n",
+       " 106 &          &         14 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00014.h5 \\\\\n",
+       " 107 &          &         15 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00015.h5 \\\\\n",
+       " 108 &          &         16 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00016.h5 \\\\\n",
+       " 109 &          &         17 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00017.h5 \\\\\n",
+       " 110 &          &         18 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00018.h5 \\\\\n",
+       " 111 &          &         19 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00019.h5 \\\\\n",
+       " 112 &          &         20 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00020.h5 \\\\\n",
+       " 113 &          &         21 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00021.h5 \\\\\n",
+       " 114 &          &         22 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD04-S00022.h5 \\\\\n",
+       " 115 & Q2M2     &          0 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00000.h5 \\\\\n",
+       " 116 &          &          1 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00001.h5 \\\\\n",
+       " 117 &          &          2 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00002.h5 \\\\\n",
+       " 118 &          &          3 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00003.h5 \\\\\n",
+       " 119 &          &          4 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00004.h5 \\\\\n",
+       " 120 &          &          5 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00005.h5 \\\\\n",
+       " 121 &          &          6 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00006.h5 \\\\\n",
+       " 122 &          &          7 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00007.h5 \\\\\n",
+       " 123 &          &          8 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00008.h5 \\\\\n",
+       " 124 &          &          9 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00009.h5 \\\\\n",
+       " 125 &          &         10 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00010.h5 \\\\\n",
+       " 126 &          &         11 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00011.h5 \\\\\n",
+       " 127 &          &         12 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00012.h5 \\\\\n",
+       " 128 &          &         13 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00013.h5 \\\\\n",
+       " 129 &          &         14 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00014.h5 \\\\\n",
+       " 130 &          &         15 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00015.h5 \\\\\n",
+       " 131 &          &         16 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00016.h5 \\\\\n",
+       " 132 &          &         17 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00017.h5 \\\\\n",
+       " 133 &          &         18 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00018.h5 \\\\\n",
+       " 134 &          &         19 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00019.h5 \\\\\n",
+       " 135 &          &         20 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00020.h5 \\\\\n",
+       " 136 &          &         21 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00021.h5 \\\\\n",
+       " 137 &          &         22 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD05-S00022.h5 \\\\\n",
+       " 138 & Q2M3     &          0 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00000.h5 \\\\\n",
+       " 139 &          &          1 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00001.h5 \\\\\n",
+       " 140 &          &          2 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00002.h5 \\\\\n",
+       " 141 &          &          3 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00003.h5 \\\\\n",
+       " 142 &          &          4 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00004.h5 \\\\\n",
+       " 143 &          &          5 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00005.h5 \\\\\n",
+       " 144 &          &          6 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00006.h5 \\\\\n",
+       " 145 &          &          7 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00007.h5 \\\\\n",
+       " 146 &          &          8 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00008.h5 \\\\\n",
+       " 147 &          &          9 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00009.h5 \\\\\n",
+       " 148 &          &         10 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00010.h5 \\\\\n",
+       " 149 &          &         11 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00011.h5 \\\\\n",
+       " 150 &          &         12 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00012.h5 \\\\\n",
+       " 151 &          &         13 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00013.h5 \\\\\n",
+       " 152 &          &         14 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00014.h5 \\\\\n",
+       " 153 &          &         15 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00015.h5 \\\\\n",
+       " 154 &          &         16 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00016.h5 \\\\\n",
+       " 155 &          &         17 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00017.h5 \\\\\n",
+       " 156 &          &         18 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00018.h5 \\\\\n",
+       " 157 &          &         19 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00019.h5 \\\\\n",
+       " 158 &          &         20 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00020.h5 \\\\\n",
+       " 159 &          &         21 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00021.h5 \\\\\n",
+       " 160 &          &         22 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD06-S00022.h5 \\\\\n",
+       " 161 & Q2M4     &          0 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00000.h5 \\\\\n",
+       " 162 &          &          1 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00001.h5 \\\\\n",
+       " 163 &          &          2 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00002.h5 \\\\\n",
+       " 164 &          &          3 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00003.h5 \\\\\n",
+       " 165 &          &          4 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00004.h5 \\\\\n",
+       " 166 &          &          5 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00005.h5 \\\\\n",
+       " 167 &          &          6 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00006.h5 \\\\\n",
+       " 168 &          &          7 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00007.h5 \\\\\n",
+       " 169 &          &          8 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00008.h5 \\\\\n",
+       " 170 &          &          9 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00009.h5 \\\\\n",
+       " 171 &          &         10 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00010.h5 \\\\\n",
+       " 172 &          &         11 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00011.h5 \\\\\n",
+       " 173 &          &         12 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00012.h5 \\\\\n",
+       " 174 &          &         13 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00013.h5 \\\\\n",
+       " 175 &          &         14 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00014.h5 \\\\\n",
+       " 176 &          &         15 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00015.h5 \\\\\n",
+       " 177 &          &         16 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00016.h5 \\\\\n",
+       " 178 &          &         17 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00017.h5 \\\\\n",
+       " 179 &          &         18 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00018.h5 \\\\\n",
+       " 180 &          &         19 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00019.h5 \\\\\n",
+       " 181 &          &         20 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00020.h5 \\\\\n",
+       " 182 &          &         21 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00021.h5 \\\\\n",
+       " 183 &          &         22 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD07-S00022.h5 \\\\\n",
+       " 184 & Q3M1     &          0 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00000.h5 \\\\\n",
+       " 185 &          &          1 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00001.h5 \\\\\n",
+       " 186 &          &          2 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00002.h5 \\\\\n",
+       " 187 &          &          3 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00003.h5 \\\\\n",
+       " 188 &          &          4 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00004.h5 \\\\\n",
+       " 189 &          &          5 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00005.h5 \\\\\n",
+       " 190 &          &          6 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00006.h5 \\\\\n",
+       " 191 &          &          7 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00007.h5 \\\\\n",
+       " 192 &          &          8 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00008.h5 \\\\\n",
+       " 193 &          &          9 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00009.h5 \\\\\n",
+       " 194 &          &         10 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00010.h5 \\\\\n",
+       " 195 &          &         11 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00011.h5 \\\\\n",
+       " 196 &          &         12 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00012.h5 \\\\\n",
+       " 197 &          &         13 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00013.h5 \\\\\n",
+       " 198 &          &         14 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00014.h5 \\\\\n",
+       " 199 &          &         15 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00015.h5 \\\\\n",
+       " 200 &          &         16 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00016.h5 \\\\\n",
+       " 201 &          &         17 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00017.h5 \\\\\n",
+       " 202 &          &         18 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00018.h5 \\\\\n",
+       " 203 &          &         19 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00019.h5 \\\\\n",
+       " 204 &          &         20 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00020.h5 \\\\\n",
+       " 205 &          &         21 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00021.h5 \\\\\n",
+       " 206 &          &         22 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD08-S00022.h5 \\\\\n",
+       " 207 & Q3M2     &          0 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00000.h5 \\\\\n",
+       " 208 &          &          1 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00001.h5 \\\\\n",
+       " 209 &          &          2 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00002.h5 \\\\\n",
+       " 210 &          &          3 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00003.h5 \\\\\n",
+       " 211 &          &          4 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00004.h5 \\\\\n",
+       " 212 &          &          5 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00005.h5 \\\\\n",
+       " 213 &          &          6 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00006.h5 \\\\\n",
+       " 214 &          &          7 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00007.h5 \\\\\n",
+       " 215 &          &          8 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00008.h5 \\\\\n",
+       " 216 &          &          9 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00009.h5 \\\\\n",
+       " 217 &          &         10 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00010.h5 \\\\\n",
+       " 218 &          &         11 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00011.h5 \\\\\n",
+       " 219 &          &         12 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00012.h5 \\\\\n",
+       " 220 &          &         13 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00013.h5 \\\\\n",
+       " 221 &          &         14 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00014.h5 \\\\\n",
+       " 222 &          &         15 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00015.h5 \\\\\n",
+       " 223 &          &         16 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00016.h5 \\\\\n",
+       " 224 &          &         17 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00017.h5 \\\\\n",
+       " 225 &          &         18 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00018.h5 \\\\\n",
+       " 226 &          &         19 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00019.h5 \\\\\n",
+       " 227 &          &         20 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00020.h5 \\\\\n",
+       " 228 &          &         21 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00021.h5 \\\\\n",
+       " 229 &          &         22 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD09-S00022.h5 \\\\\n",
+       " 230 & Q3M3     &          0 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00000.h5 \\\\\n",
+       " 231 &          &          1 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00001.h5 \\\\\n",
+       " 232 &          &          2 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00002.h5 \\\\\n",
+       " 233 &          &          3 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00003.h5 \\\\\n",
+       " 234 &          &          4 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00004.h5 \\\\\n",
+       " 235 &          &          5 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00005.h5 \\\\\n",
+       " 236 &          &          6 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00006.h5 \\\\\n",
+       " 237 &          &          7 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00007.h5 \\\\\n",
+       " 238 &          &          8 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00008.h5 \\\\\n",
+       " 239 &          &          9 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00009.h5 \\\\\n",
+       " 240 &          &         10 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00010.h5 \\\\\n",
+       " 241 &          &         11 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00011.h5 \\\\\n",
+       " 242 &          &         12 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00012.h5 \\\\\n",
+       " 243 &          &         13 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00013.h5 \\\\\n",
+       " 244 &          &         14 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00014.h5 \\\\\n",
+       " 245 &          &         15 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00015.h5 \\\\\n",
+       " 246 &          &         16 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00016.h5 \\\\\n",
+       " 247 &          &         17 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00017.h5 \\\\\n",
+       " 248 &          &         18 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00018.h5 \\\\\n",
+       " 249 &          &         19 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00019.h5 \\\\\n",
+       " 250 &          &         20 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00020.h5 \\\\\n",
+       " 251 &          &         21 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00021.h5 \\\\\n",
+       " 252 &          &         22 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD10-S00022.h5 \\\\\n",
+       " 253 & Q3M4     &          0 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00000.h5 \\\\\n",
+       " 254 &          &          1 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00001.h5 \\\\\n",
+       " 255 &          &          2 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00002.h5 \\\\\n",
+       " 256 &          &          3 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00003.h5 \\\\\n",
+       " 257 &          &          4 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00004.h5 \\\\\n",
+       " 258 &          &          5 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00005.h5 \\\\\n",
+       " 259 &          &          6 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00006.h5 \\\\\n",
+       " 260 &          &          7 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00007.h5 \\\\\n",
+       " 261 &          &          8 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00008.h5 \\\\\n",
+       " 262 &          &          9 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00009.h5 \\\\\n",
+       " 263 &          &         10 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00010.h5 \\\\\n",
+       " 264 &          &         11 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00011.h5 \\\\\n",
+       " 265 &          &         12 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00012.h5 \\\\\n",
+       " 266 &          &         13 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00013.h5 \\\\\n",
+       " 267 &          &         14 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00014.h5 \\\\\n",
+       " 268 &          &         15 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00015.h5 \\\\\n",
+       " 269 &          &         16 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00016.h5 \\\\\n",
+       " 270 &          &         17 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00017.h5 \\\\\n",
+       " 271 &          &         18 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00018.h5 \\\\\n",
+       " 272 &          &         19 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00019.h5 \\\\\n",
+       " 273 &          &         20 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00020.h5 \\\\\n",
+       " 274 &          &         21 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00021.h5 \\\\\n",
+       " 275 &          &         22 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD11-S00022.h5 \\\\\n",
+       " 276 & Q4M1     &          0 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00000.h5 \\\\\n",
+       " 277 &          &          1 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00001.h5 \\\\\n",
+       " 278 &          &          2 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00002.h5 \\\\\n",
+       " 279 &          &          3 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00003.h5 \\\\\n",
+       " 280 &          &          4 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00004.h5 \\\\\n",
+       " 281 &          &          5 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00005.h5 \\\\\n",
+       " 282 &          &          6 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00006.h5 \\\\\n",
+       " 283 &          &          7 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00007.h5 \\\\\n",
+       " 284 &          &          8 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00008.h5 \\\\\n",
+       " 285 &          &          9 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00009.h5 \\\\\n",
+       " 286 &          &         10 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00010.h5 \\\\\n",
+       " 287 &          &         11 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00011.h5 \\\\\n",
+       " 288 &          &         12 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00012.h5 \\\\\n",
+       " 289 &          &         13 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00013.h5 \\\\\n",
+       " 290 &          &         14 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00014.h5 \\\\\n",
+       " 291 &          &         15 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00015.h5 \\\\\n",
+       " 292 &          &         16 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00016.h5 \\\\\n",
+       " 293 &          &         17 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00017.h5 \\\\\n",
+       " 294 &          &         18 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00018.h5 \\\\\n",
+       " 295 &          &         19 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00019.h5 \\\\\n",
+       " 296 &          &         20 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00020.h5 \\\\\n",
+       " 297 &          &         21 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00021.h5 \\\\\n",
+       " 298 &          &         22 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD12-S00022.h5 \\\\\n",
+       " 299 & Q4M2     &          0 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00000.h5 \\\\\n",
+       " 300 &          &          1 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00001.h5 \\\\\n",
+       " 301 &          &          2 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00002.h5 \\\\\n",
+       " 302 &          &          3 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00003.h5 \\\\\n",
+       " 303 &          &          4 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00004.h5 \\\\\n",
+       " 304 &          &          5 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00005.h5 \\\\\n",
+       " 305 &          &          6 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00006.h5 \\\\\n",
+       " 306 &          &          7 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00007.h5 \\\\\n",
+       " 307 &          &          8 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00008.h5 \\\\\n",
+       " 308 &          &          9 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00009.h5 \\\\\n",
+       " 309 &          &         10 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00010.h5 \\\\\n",
+       " 310 &          &         11 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00011.h5 \\\\\n",
+       " 311 &          &         12 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00012.h5 \\\\\n",
+       " 312 &          &         13 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00013.h5 \\\\\n",
+       " 313 &          &         14 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00014.h5 \\\\\n",
+       " 314 &          &         15 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00015.h5 \\\\\n",
+       " 315 &          &         16 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00016.h5 \\\\\n",
+       " 316 &          &         17 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00017.h5 \\\\\n",
+       " 317 &          &         18 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00018.h5 \\\\\n",
+       " 318 &          &         19 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00019.h5 \\\\\n",
+       " 319 &          &         20 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00020.h5 \\\\\n",
+       " 320 &          &         21 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00021.h5 \\\\\n",
+       " 321 &          &         22 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD13-S00022.h5 \\\\\n",
+       " 322 & Q4M3     &          0 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00000.h5 \\\\\n",
+       " 323 &          &          1 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00001.h5 \\\\\n",
+       " 324 &          &          2 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00002.h5 \\\\\n",
+       " 325 &          &          3 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00003.h5 \\\\\n",
+       " 326 &          &          4 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00004.h5 \\\\\n",
+       " 327 &          &          5 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00005.h5 \\\\\n",
+       " 328 &          &          6 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00006.h5 \\\\\n",
+       " 329 &          &          7 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00007.h5 \\\\\n",
+       " 330 &          &          8 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00008.h5 \\\\\n",
+       " 331 &          &          9 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00009.h5 \\\\\n",
+       " 332 &          &         10 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00010.h5 \\\\\n",
+       " 333 &          &         11 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00011.h5 \\\\\n",
+       " 334 &          &         12 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00012.h5 \\\\\n",
+       " 335 &          &         13 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00013.h5 \\\\\n",
+       " 336 &          &         14 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00014.h5 \\\\\n",
+       " 337 &          &         15 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00015.h5 \\\\\n",
+       " 338 &          &         16 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00016.h5 \\\\\n",
+       " 339 &          &         17 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00017.h5 \\\\\n",
+       " 340 &          &         18 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00018.h5 \\\\\n",
+       " 341 &          &         19 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00019.h5 \\\\\n",
+       " 342 &          &         20 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00020.h5 \\\\\n",
+       " 343 &          &         21 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00021.h5 \\\\\n",
+       " 344 &          &         22 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD14-S00022.h5 \\\\\n",
+       " 345 & Q4M4     &          0 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00000.h5 \\\\\n",
+       " 346 &          &          1 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00001.h5 \\\\\n",
+       " 347 &          &          2 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00002.h5 \\\\\n",
+       " 348 &          &          3 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00003.h5 \\\\\n",
+       " 349 &          &          4 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00004.h5 \\\\\n",
+       " 350 &          &          5 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00005.h5 \\\\\n",
+       " 351 &          &          6 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00006.h5 \\\\\n",
+       " 352 &          &          7 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00007.h5 \\\\\n",
+       " 353 &          &          8 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00008.h5 \\\\\n",
+       " 354 &          &          9 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00009.h5 \\\\\n",
+       " 355 &          &         10 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00010.h5 \\\\\n",
+       " 356 &          &         11 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00011.h5 \\\\\n",
+       " 357 &          &         12 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00012.h5 \\\\\n",
+       " 358 &          &         13 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00013.h5 \\\\\n",
+       " 359 &          &         14 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00014.h5 \\\\\n",
+       " 360 &          &         15 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00015.h5 \\\\\n",
+       " 361 &          &         16 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00016.h5 \\\\\n",
+       " 362 &          &         17 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00017.h5 \\\\\n",
+       " 363 &          &         18 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00018.h5 \\\\\n",
+       " 364 &          &         19 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00019.h5 \\\\\n",
+       " 365 &          &         20 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00020.h5 \\\\\n",
+       " 366 &          &         21 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00021.h5 \\\\\n",
+       " 367 &          &         22 & /gpfs/exfel/exp/MID/201931/p900090/raw//r0005/RAW-R0005-AGIPD15-S00022.h5 \\\\\n",
+       "\\hline\n",
+       "\\end{tabular}"
+      ],
+      "text/plain": [
+       "<IPython.core.display.Latex object>"
+      ]
+     },
+     "metadata": {},
+     "output_type": "display_data"
+    }
+   ],
    "source": [
     "import copy\n",
     "from IPython.display import HTML, display, Markdown, Latex\n",
@@ -337,15 +739,63 @@
   },
   {
    "cell_type": "code",
-   "execution_count": null,
+   "execution_count": 6,
    "metadata": {
     "ExecuteTime": {
      "end_time": "2019-02-21T11:30:16.057429Z",
      "start_time": "2019-02-21T11:30:10.082114Z"
-    },
-    "collapsed": false
+    }
    },
-   "outputs": [],
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "Running 32 tasks parallel\n",
+      "foo\n",
+      "Have input\n",
+      "Set memory cells to 250\n",
+      "Set acquistion rate cells to 4.5 MHz\n",
+      "Retrieving from tcp://max-exfl016:8022 for AGIPD_SIV1_AGIPDV11_M337: 00303000100000\n",
+      "Offset was injected on: 2019-07-19 01:14:42+02:00\n",
+      "Retrieving from tcp://max-exfl016:8034 for AGIPD_SIV1_AGIPDV11_M337: 00303000100000\n",
+      "Noise was injected on: 2019-07-19 01:14:42+02:00\n",
+      "Retrieving from tcp://max-exfl016:8034 for AGIPD_SIV1_AGIPDV11_M337: 00303000100000\n",
+      "BadPixelsDark was injected on: 2019-07-19 01:14:42+02:00\n",
+      "Retrieving from tcp://max-exfl016:8034 for AGIPD_SIV1_AGIPDV11_M337: 00303000100000\n",
+      "ThresholdsDark was injected on: 2019-07-19 01:14:42+02:00\n",
+      "Offet medians are [4844. 7332. 7579.]\n",
+      "Threshold medians are [6455.25 7125.   5848.   7053.   7196.  ]\n",
+      "2019-07-19 01:14:42+02:00\n",
+      "After reading from file: \n",
+      "Offet medians are [4844.         7122.10742188 7579.        ]\n",
+      "Gain medians are [  0.99791807  35.87737    160.88506   ]\n",
+      "Threshold medians are [6455.25 7125.   5848.   7053.   7196.  ]\n",
+      "Initialized constants\n",
+      "Iterated\n",
+      "Iterated\n",
+      "Iterated\n",
+      "Iterated\n",
+      "Iterated\n",
+      "Iterated\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-6-ef2b971fe04b>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m    199\u001b[0m         \u001b[0;31m#r = view.map_sync(p, inp)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    200\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 201\u001b[0;31m         \u001b[0mr\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mlist\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmap\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mp\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minp\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    202\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    203\u001b[0m         \u001b[0minp\u001b[0m \u001b[0;34m=\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[0;32m<ipython-input-6-ef2b971fe04b>\u001b[0m in \u001b[0;36mcorrect_module\u001b[0;34m(max_cells, do_rel_gain, index_v, CHUNK_SIZE, total_sequences, sequences_qm, bins_gain_vs_signal, bins_signal_low_range, bins_signal_high_range, bins_dig_gain_vs_signal, max_pulses, dbparms, fileparms, nodb, chunk_size_idim, special_opts, il_mode, loc, dinstance, force_hg_if_below, force_mg_if_below, mask_noisy_adc, adjust_mg_baseline, acq_rate, dont_zero_nans, dont_zero_orange, inp)\u001b[0m\n\u001b[1;32m    121\u001b[0m         \u001b[0;32mfor\u001b[0m \u001b[0mirange\u001b[0m \u001b[0;32min\u001b[0m \u001b[0magipd_corr\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_iteration_range\u001b[0m\u001b[0;34m(\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[1;32m    122\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 123\u001b[0;31m             \u001b[0magipd_corr\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcorrect_agipd\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mirange\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    124\u001b[0m             \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Iterated\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    125\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
+      "\u001b[0;32m~/calibration_webservice_deployed/cal_tools/cal_tools/agipdlib.py\u001b[0m in \u001b[0;36mcorrect_agipd\u001b[0;34m(self, irange)\u001b[0m\n\u001b[1;32m    931\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    932\u001b[0m         \u001b[0;31m# also choose the correct bad pixel mask\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 933\u001b[0;31m         \u001b[0mmsk\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mchoose\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mgain\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mtmask\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m...\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtmask\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m...\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtmask\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m...\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m2\u001b[0m\u001b[0;34m]\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    934\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    935\u001b[0m         \u001b[0;31m# scale raw gain for use in the identifying snowy pixels\u001b[0m\u001b[0;34m\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/numpy/core/fromnumeric.py\u001b[0m in \u001b[0;36mchoose\u001b[0;34m(a, choices, out, mode)\u001b[0m\n\u001b[1;32m    377\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    378\u001b[0m     \"\"\"\n\u001b[0;32m--> 379\u001b[0;31m     \u001b[0;32mreturn\u001b[0m \u001b[0m_wrapfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ma\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'choose'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mchoices\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mout\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmode\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmode\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    380\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    381\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
+      "\u001b[0;32m/software/anaconda3/5.2/lib/python3.6/site-packages/numpy/core/fromnumeric.py\u001b[0m in \u001b[0;36m_wrapfunc\u001b[0;34m(obj, method, *args, **kwds)\u001b[0m\n\u001b[1;32m     50\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_wrapfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mobj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmethod\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwds\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[1;32m     51\u001b[0m     \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 52\u001b[0;31m         \u001b[0;32mreturn\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mobj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmethod\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwds\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     53\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     54\u001b[0m     \u001b[0;31m# An AttributeError occurs if the object does not have\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+      "\u001b[0;31mKeyboardInterrupt\u001b[0m: "
+     ]
+    }
+   ],
    "source": [
     "import copy\n",
     "from functools import partial\n",
@@ -353,7 +803,8 @@
     "                   bins_gain_vs_signal, bins_signal_low_range, bins_signal_high_range,\n",
     "                   bins_dig_gain_vs_signal, max_pulses, dbparms, fileparms, nodb, chunk_size_idim,\n",
     "                   special_opts, il_mode, loc, dinstance, force_hg_if_below, force_mg_if_below,\n",
-    "                   mask_noisy_adc, adjust_mg_baseline, acq_rate, inp):\n",
+    "                   mask_noisy_adc, adjust_mg_baseline, acq_rate, dont_zero_nans, dont_zero_orange,\n",
+    "                   inp):\n",
     "    print(\"foo\")\n",
     "    import numpy as np\n",
     "    import copy\n",
@@ -445,7 +896,8 @@
     "                                      h5_index_path=\"INDEX/{}/DET/{{}}CH0:xtdf/\".format(loc),\n",
     "                                      cal_det_instance=dinstance, force_hg_if_below=force_hg_if_below,\n",
     "                                      force_mg_if_below=force_mg_if_below, mask_noisy_adc=mask_noisy_adc,\n",
-    "                                      adjust_mg_baseline=adjust_mg_baseline, acquisition_rate=acq_rate)\n",
+    "                                      adjust_mg_baseline=adjust_mg_baseline, acquisition_rate=acq_rate,\n",
+    "                                      dont_zero_nans=dont_zero_nans, dont_zero_orange=dont_zero_orange)\n",
     "        \n",
     "        blc_noise, blc_noise_threshold, blc_hist, match_asics, corr_asic_diag, melt_snow = special_opts\n",
     "        agipd_corr.baseline_corr_using_noise = blc_noise\n",
@@ -466,7 +918,7 @@
     "        print(\"Initialized constants\")\n",
     "        \n",
     "        for irange in agipd_corr.get_iteration_range():\n",
-    "            \n",
+    "           \n",
     "            agipd_corr.correct_agipd(irange)\n",
     "            print(\"Iterated\")\n",
     "            \n",
@@ -541,7 +993,7 @@
     "                    sequences_qm, bins_gain_vs_signal, bins_signal_low_range, bins_signal_high_range,\n",
     "                    bins_dig_gain_vs_signal, max_pulses, dbparms, fileparms, nodb, chunk_size_idim,\n",
     "                    special_opts, il_mode, loc, dinstance, force_hg_if_below, force_mg_if_below,\n",
-    "                    mask_noisy_adc, adjust_mg_baseline, acq_rate)\n",
+    "                    mask_noisy_adc, adjust_mg_baseline, acq_rate, dont_zero_nans, dont_zero_orange)\n",
     "         \n",
     "        r = view.map_sync(p, inp)\n",
     "        \n",
@@ -571,9 +1023,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "\n",
@@ -590,8 +1040,7 @@
     "ExecuteTime": {
      "end_time": "2019-02-18T17:28:51.765030Z",
      "start_time": "2019-02-18T17:28:51.714783Z"
-    },
-    "collapsed": true
+    }
    },
    "outputs": [],
    "source": [
@@ -636,8 +1085,7 @@
     "ExecuteTime": {
      "end_time": "2019-02-18T17:28:52.857960Z",
      "start_time": "2019-02-18T17:28:51.767217Z"
-    },
-    "collapsed": false
+    }
    },
    "outputs": [],
    "source": [
@@ -651,8 +1099,7 @@
     "ExecuteTime": {
      "end_time": "2019-02-18T17:28:53.690522Z",
      "start_time": "2019-02-18T17:28:52.860143Z"
-    },
-    "collapsed": false
+    }
    },
    "outputs": [],
    "source": [
@@ -687,8 +1134,7 @@
     "ExecuteTime": {
      "end_time": "2019-02-18T17:28:54.370559Z",
      "start_time": "2019-02-18T17:28:53.691959Z"
-    },
-    "collapsed": false
+    }
    },
    "outputs": [],
    "source": [
@@ -702,8 +1148,7 @@
     "ExecuteTime": {
      "end_time": "2019-02-18T17:31:51.668096Z",
      "start_time": "2019-02-18T17:31:51.529158Z"
-    },
-    "collapsed": false
+    }
    },
    "outputs": [],
    "source": [
@@ -730,7 +1175,6 @@
      "end_time": "2019-02-18T17:28:57.327702Z",
      "start_time": "2019-02-18T17:28:54.377061Z"
     },
-    "collapsed": false,
     "scrolled": false
    },
    "outputs": [],
@@ -748,8 +1192,7 @@
     "ExecuteTime": {
      "end_time": "2019-02-18T17:29:20.634480Z",
      "start_time": "2019-02-18T17:28:57.329231Z"
-    },
-    "collapsed": true
+    }
    },
    "outputs": [],
    "source": [
@@ -802,8 +1245,7 @@
     "ExecuteTime": {
      "end_time": "2019-02-18T17:29:27.025667Z",
      "start_time": "2019-02-18T17:29:20.642029Z"
-    },
-    "collapsed": true
+    }
    },
    "outputs": [],
    "source": [
@@ -835,8 +1277,7 @@
     "ExecuteTime": {
      "end_time": "2019-02-18T17:29:33.226396Z",
      "start_time": "2019-02-18T17:29:27.027758Z"
-    },
-    "collapsed": false
+    }
    },
    "outputs": [],
    "source": [
@@ -866,8 +1307,7 @@
     "ExecuteTime": {
      "end_time": "2019-02-18T17:29:33.761015Z",
      "start_time": "2019-02-18T17:29:33.227922Z"
-    },
-    "collapsed": false
+    }
    },
    "outputs": [],
    "source": [
@@ -887,8 +1327,7 @@
     "ExecuteTime": {
      "end_time": "2019-02-18T17:29:35.903487Z",
      "start_time": "2019-02-18T17:29:33.762568Z"
-    },
-    "collapsed": false
+    }
    },
    "outputs": [],
    "source": [
@@ -913,8 +1352,7 @@
     "ExecuteTime": {
      "end_time": "2019-02-18T17:29:39.369686Z",
      "start_time": "2019-02-18T17:29:35.905152Z"
-    },
-    "collapsed": false
+    }
    },
    "outputs": [],
    "source": [
@@ -934,8 +1372,7 @@
     "ExecuteTime": {
      "end_time": "2019-02-18T17:29:49.217848Z",
      "start_time": "2019-02-18T17:29:39.371232Z"
-    },
-    "collapsed": false
+    }
    },
    "outputs": [],
    "source": [
@@ -952,8 +1389,7 @@
     "ExecuteTime": {
      "end_time": "2019-02-18T17:29:49.222484Z",
      "start_time": "2019-02-18T17:29:49.219933Z"
-    },
-    "collapsed": true
+    }
    },
    "outputs": [],
    "source": [
@@ -976,8 +1412,7 @@
     "ExecuteTime": {
      "end_time": "2019-02-18T17:29:49.641675Z",
      "start_time": "2019-02-18T17:29:49.224167Z"
-    },
-    "collapsed": false
+    }
    },
    "outputs": [],
    "source": [
@@ -1006,8 +1441,7 @@
     "ExecuteTime": {
      "end_time": "2019-02-18T17:29:49.651913Z",
      "start_time": "2019-02-18T17:29:49.643556Z"
-    },
-    "collapsed": false
+    }
    },
    "outputs": [],
    "source": [
@@ -1036,8 +1470,7 @@
     "ExecuteTime": {
      "end_time": "2019-02-18T17:29:50.086169Z",
      "start_time": "2019-02-18T17:29:49.653391Z"
-    },
-    "collapsed": false
+    }
    },
    "outputs": [],
    "source": [
@@ -1064,8 +1497,7 @@
     "ExecuteTime": {
      "end_time": "2019-02-18T17:29:51.686562Z",
      "start_time": "2019-02-18T17:29:50.088883Z"
-    },
-    "collapsed": false
+    }
    },
    "outputs": [],
    "source": [
@@ -1090,8 +1522,7 @@
     "ExecuteTime": {
      "end_time": "2019-02-18T17:29:53.662423Z",
      "start_time": "2019-02-18T17:29:51.688376Z"
-    },
-    "collapsed": false
+    }
    },
    "outputs": [],
    "source": [
@@ -1109,8 +1540,7 @@
     "ExecuteTime": {
      "end_time": "2019-02-18T17:29:55.483270Z",
      "start_time": "2019-02-18T17:29:53.664226Z"
-    },
-    "collapsed": false
+    }
    },
    "outputs": [],
    "source": [
@@ -1127,9 +1557,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": true
-   },
+   "metadata": {},
    "outputs": [],
    "source": []
   }
@@ -1150,7 +1578,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.6.6"
+   "version": "3.6.7"
   }
  },
  "nbformat": 4,
diff --git a/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb b/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb
index f3e593039..018361629 100644
--- a/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb
+++ b/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb
@@ -14,9 +14,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "in_folder = \"/gpfs/exfel/exp/FXE/201802/p002271/ra\" # the folder to read data from, required\n",
@@ -42,6 +40,7 @@
     "gmapfile = \"/gpfs/exfel/data/scratch/xcal/jfgain/gainMaps_M233.h5\" #temporary gain calibration file, not in the DB; leave empty if using DB\n",
     "memcells = 1 # number of memory cells\n",
     "karabo_id = \"FXE_XAD_JF1M\" # karabo prefix of Jungfrau devices\n",
+    "karabo_id_control = \"\"  # if control is on a different ID, set to empty string for using the same as for data\n",
     "receiver_id = \"RECEIVER\" # inset for receiver devices\n",
     "control_id = \"CONTROL\" # inset for control devices\n",
     "db_module = \"Jungfrau_M233\" # ID of module in calibration database\n",
@@ -158,22 +157,23 @@
     "    creation_time = get_dir_creation_date(in_folder, run)\n",
     "    print(\"Using {} as creation time\".format(creation_time))\n",
     "    \n",
-    "cal_timeout = 600000 #ms"
+    "cal_timeout = 600000 #ms\n",
+    "\n",
+    "if karabo_id_control == \"\":\n",
+    "    karabo_id_control = karabo_id"
    ]
   },
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "import h5py\n",
     "if not manual_slow_data:\n",
     "    with h5py.File(fp_path_contr.format(0), 'r') as f:\n",
-    "        integration_time = int(f['/RUN/{}/DET/{}/exposureTime/value'.format(karabo_id, control_id)][()]*1e6)\n",
-    "        bias_voltage = int(np.squeeze(f['/RUN/{}/DET/{}/vHighVoltage/value'.format(karabo_id, control_id)])[0])\n",
+    "        integration_time = int(f['/RUN/{}/DET/{}/exposureTime/value'.format(karabo_id_control, control_id)][()]*1e6)\n",
+    "        bias_voltage = int(np.squeeze(f['/RUN/{}/DET/{}/vHighVoltage/value'.format(karabo_id_control, control_id)])[0])\n",
     "print(\"Integration time is {} us\".format(integration_time))\n",
     "print(\"Bias voltage is {} V\".format(bias_voltage))"
    ]
@@ -214,9 +214,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "import copy\n",
@@ -459,9 +457,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "h, ex, ey = np.histogram2d(rim_data.flatten(), gim_data.flatten(),\n",
@@ -481,9 +477,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "fig = plt.figure(figsize=(20,10))\n",
@@ -506,9 +500,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "fig = plt.figure(figsize=(20,10))\n",
@@ -531,9 +523,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "fig = plt.figure(figsize=(20,10))\n",
@@ -554,9 +544,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "fig = plt.figure(figsize=(20,10))\n",
@@ -583,9 +571,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "fig = plt.figure(figsize=(20,10))\n",
@@ -606,9 +592,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "from cal_tools.enums import BadPixels\n",
@@ -632,9 +616,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "fig = plt.figure(figsize=(20,10))\n",
@@ -669,7 +651,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.6.6"
+   "version": "3.6.7"
   }
  },
  "nbformat": 4,
diff --git a/notebooks/Jungfrau/Jungfrau_dark_analysis_all_gains_NBC.ipynb b/notebooks/Jungfrau/Jungfrau_dark_analysis_all_gains_NBC.ipynb
index a79590ee1..b54e489e5 100644
--- a/notebooks/Jungfrau/Jungfrau_dark_analysis_all_gains_NBC.ipynb
+++ b/notebooks/Jungfrau/Jungfrau_dark_analysis_all_gains_NBC.ipynb
@@ -40,6 +40,7 @@
     "run_med = 0 # run number for G1 dark run, required\n",
     "run_low = 0 # run number for G2 dark run, required\n",
     "karabo_id = \"FXE_XAD_JF500K\"  # karabo prefix of Jungfrau devices\n",
+    "karabo_id_control = \"\"  # if control is on a different ID, set to empty string for using the same as for data\n",
     "receiver_id = \"RECEIVER\" # inset for receiver devices\n",
     "control_id = \"CONTROL\" # inset for control devices\n",
     "db_module = \"Jungfrau_M233\" # ID of module in calibration database\n",
@@ -50,9 +51,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "import warnings\n",
@@ -92,7 +91,10 @@
     "    creation_time = get_dir_creation_date(in_folder, run_high)\n",
     "    print(\"Using {} as creation time\".format(creation_time))\n",
     "    \n",
-    "offset_abs_threshold = [offset_abs_threshold_low, offset_abs_threshold_high]"
+    "offset_abs_threshold = [offset_abs_threshold_low, offset_abs_threshold_high]\n",
+    "\n",
+    "if karabo_id_control == \"\":\n",
+    "    karabo_id_control = karabo_id"
    ]
   },
   {
@@ -110,9 +112,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "import h5py\n",
@@ -126,8 +126,8 @@
     "\n",
     "        if not manual_slow_data:\n",
     "            with h5py.File(fp_path.format(0), 'r') as f:\n",
-    "                integration_time = int(f['/RUN/{}/DET/{}/exposureTime/value'.format(karabo_id, control_id)][()]*1e6)\n",
-    "                bias_voltage = int(np.squeeze(f['/RUN/{}/DET/{}/vHighVoltage/value'.format(karabo_id, control_id)])[0])\n",
+    "                integration_time = int(f['/RUN/{}/DET/{}/exposureTime/value'.format(karabo_id_control, control_id)][()]*1e6)\n",
+    "                bias_voltage = int(np.squeeze(f['/RUN/{}/DET/{}/vHighVoltage/value'.format(karabo_id_control, control_id)])[0])\n",
     "        print(\"Integration time is {} us\".format(integration_time))\n",
     "        print(\"Bias voltage is {} V\".format(bias_voltage))\n",
     "\n",
@@ -176,7 +176,6 @@
    "cell_type": "code",
    "execution_count": null,
    "metadata": {
-    "collapsed": false,
     "scrolled": false
    },
    "outputs": [],
@@ -257,9 +256,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "def print_bp_entry(bp):\n",
@@ -273,9 +270,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "bad_pixels_map = np.zeros(noise_map.shape, np.uint32)\n",
@@ -441,9 +436,7 @@
   {
    "cell_type": "code",
    "execution_count": null,
-   "metadata": {
-    "collapsed": false
-   },
+   "metadata": {},
    "outputs": [],
    "source": [
     "is_log = True\n",
@@ -481,7 +474,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.6.6"
+   "version": "3.6.7"
   }
  },
  "nbformat": 4,
-- 
GitLab