From 4a9528ef37117e695c90a4da352e3956738bb1a1 Mon Sep 17 00:00:00 2001
From: Thomas Kluyver <thomas.kluyver@xfel.eu>
Date: Mon, 3 Apr 2023 16:44:28 +0200
Subject: [PATCH] Assorted cleanup

---
 .../LPDMini/LPD_Mini_Char_Darks_NBC.ipynb     | 31 ++-----------------
 notebooks/LPDMini/LPD_Mini_Correct.ipynb      |  1 -
 src/xfel_calibrate/notebooks.py               |  2 --
 3 files changed, 2 insertions(+), 32 deletions(-)

diff --git a/notebooks/LPDMini/LPD_Mini_Char_Darks_NBC.ipynb b/notebooks/LPDMini/LPD_Mini_Char_Darks_NBC.ipynb
index 122e7579b..f23c36000 100644
--- a/notebooks/LPDMini/LPD_Mini_Char_Darks_NBC.ipynb
+++ b/notebooks/LPDMini/LPD_Mini_Char_Darks_NBC.ipynb
@@ -4,7 +4,7 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "# LPD Offset, Noise and Dead Pixels Characterization #\n",
+    "# LPD Mini Offset, Noise and Dead Pixels Characterization #\n",
     "\n",
     "Author: M. Karnevskiy, S. Hauf\n",
     "\n",
@@ -25,17 +25,12 @@
     "in_folder = \"/gpfs/exfel/exp/FXE/202231/p900316/raw/\" # path to input data, required\n",
     "out_folder = \"/gpfs/exfel/data/scratch/kluyvert/darks-lpdmini\" # path to output to, required\n",
     "metadata_folder = \"\"  # Directory containing calibration_metadata.yml when run by xfel-calibrate\n",
-    "sequence = 0 # sequence files to evaluate\n",
     "run_high = 10 # run number in which high gain data was recorded, required\n",
     "run_med = 11 # run number in which medium gain data was recorded, required\n",
     "run_low = 12 # run number in which low gain data was recorded, required\n",
     "\n",
     "karabo_id = \"FXE_DET_LPD_MINI\" # karabo karabo_id\n",
     "karabo_da = ['-1']  # a list of data aggregators names, Default [-1] for selecting all data aggregators\n",
-    "receiver_id = \"{}CH0\" # inset for receiver devices\n",
-    "path_template = 'RAW-R{:04d}-{}-S{:05d}.h5' # the template to use to access data\n",
-    "h5path = '/INSTRUMENT/{}/DET/{}:xtdf/image' # path in the HDF5 file to images\n",
-    "h5path_idx = '/INDEX/{}/DET/{}:xtdf/image' # path in the HDF5 file to images\n",
     "source_name = \"{}/DET/0CH0:xtdf\"\n",
     "\n",
     "creation_time = \"\"  # Override the timestamp taken from the run (format '2023-03-30 15:04:31')\n",
@@ -52,16 +47,11 @@
     "thresholds_noise_hard = [1, 35] # bad pixel hard threshold\n",
     "skip_first_ntrains = 10 # Number of first trains to skip\n",
     "\n",
-    "# Parameters for plotting\n",
-    "skip_plots = False  # exit after writing corrected files\n",
-    "\n",
-    "instrument = \"FXE\" # instrument name\n",
     "ntrains = 100 # number of trains to use\n",
     "min_trains = 20  # minimum number of trains required for each gain stage\n",
     "high_res_badpix_3d = False # plot bad-pixel summary in high resolution\n",
     "test_for_normality = False # permorm normality test\n",
-    "inject_cell_order = False  # Include memory cell order as part of the detector condition\n",
-    "operation_mode = ''  # Detector operation mode, optional"
+    "inject_cell_order = False  # Include memory cell order as part of the detector condition"
    ]
   },
   {
@@ -131,9 +121,6 @@
     "capacitor_settings = [capacitor_setting]\n",
     "capacitor_settings = ['{}pf'.format(c) for c in capacitor_settings]\n",
     "\n",
-    "h5path = h5path.format(karabo_id, receiver_id)\n",
-    "h5path_idx = h5path_idx.format(karabo_id, receiver_id)\n",
-    "\n",
     "creation_time = calcat_creation_time(in_folder, run_high, creation_time)\n",
     "print(f\"Using {creation_time} as creation time\")\n",
     "\n",
@@ -144,7 +131,6 @@
     "print(\"Proposal: {}\".format(prop))\n",
     "print(\"Memory cells: {}/{}\".format(mem_cells, max_cells))\n",
     "print(\"Runs: {}, {}, {}\".format(run_high, run_med, run_low))\n",
-    "print(\"Sequence: {}\".format(sequence))\n",
     "print(\"Using DB: {}\".format(db_output))\n",
     "print(\"Input: {}\".format(in_folder))\n",
     "print(\"Output: {}\".format(out_folder))\n",
@@ -293,7 +279,6 @@
     "\n",
     "# Should be the same cell order for all modules & all gain stages\n",
     "cellid_pattern_prev = None\n",
-    "cellid_patterns_g = {}\n",
     "\n",
     "gg = 0\n",
     "inp = []\n",
@@ -326,18 +311,6 @@
     "          f\"Number of processed trains per cell: {data.shape[0]}.\")"
    ]
   },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "if skip_plots:\n",
-    "    import sys\n",
-    "    print('Skipping plots')\n",
-    "    sys.exit(0)"
-   ]
-  },
   {
    "cell_type": "code",
    "execution_count": null,
diff --git a/notebooks/LPDMini/LPD_Mini_Correct.ipynb b/notebooks/LPDMini/LPD_Mini_Correct.ipynb
index b141f2788..e66a97ddc 100644
--- a/notebooks/LPDMini/LPD_Mini_Correct.ipynb
+++ b/notebooks/LPDMini/LPD_Mini_Correct.ipynb
@@ -56,7 +56,6 @@
     "overwrite = True  # set to True if existing data should be overwritten\n",
     "chunks_data = 1  # HDF chunk size for pixel data in number of frames.\n",
     "chunks_ids = 32  # HDF chunk size for cellId and pulseId datasets.\n",
-    "create_virtual_cxi_in = ''  # Folder to create virtual CXI files in (for each sequence).\n",
     "\n",
     "# Parallelization options\n",
     "sequences_per_node = 1  # Sequence files to process per node\n",
diff --git a/src/xfel_calibrate/notebooks.py b/src/xfel_calibrate/notebooks.py
index 08eca7f84..f560c44b7 100644
--- a/src/xfel_calibrate/notebooks.py
+++ b/src/xfel_calibrate/notebooks.py
@@ -101,8 +101,6 @@ notebooks = {
     "LPDMINI": {
         "DARK": {
             "notebook": "notebooks/LPDMini/LPD_Mini_Char_Darks_NBC.ipynb",
-            "dep_notebooks": [
-                "notebooks/generic/overallmodules_Darks_Summary_NBC.ipynb"],
             "concurrency": {"parameter": None},
         },
         "CORRECT": {
-- 
GitLab