From 65f23b21ff63f7088fe49e526caf34156f078f71 Mon Sep 17 00:00:00 2001
From: ahmedk <karim.ahmed@xfel.eu>
Date: Sat, 12 Feb 2022 12:43:38 +0100
Subject: [PATCH] remove set_parameters_manually

---
 .../pnCCD/Characterize_pnCCD_Dark_NBC.ipynb   | 23 ++++++++---------
 notebooks/pnCCD/Correct_pnCCD_NBC.ipynb       | 25 ++++++++-----------
 2 files changed, 20 insertions(+), 28 deletions(-)

diff --git a/notebooks/pnCCD/Characterize_pnCCD_Dark_NBC.ipynb b/notebooks/pnCCD/Characterize_pnCCD_Dark_NBC.ipynb
index cb1e13f64..a8d232b4f 100644
--- a/notebooks/pnCCD/Characterize_pnCCD_Dark_NBC.ipynb
+++ b/notebooks/pnCCD/Characterize_pnCCD_Dark_NBC.ipynb
@@ -45,7 +45,6 @@
     "creation_time = \"\" # To overwrite the measured creation_time. Required Format: YYYY-MM-DD HR:MN:SC.00 e.g. 2019-07-04 11:02:41.00\n",
     "\n",
     "# Parameters used for injecting calibration constants.\n",
-    "set_parameters_manually = False  # Boolean for setting parameter values manually instead of reading control values.\n",
     "fix_temperature_top = 0.  # fix temperature of top pnCCD sensor in K. Set to 0, to use the value from slow data\n",
     "fix_temperature_bot = 0.  # fix temperature of bottom pnCCD sensor in K. Set to 0, to use the value from slow data\n",
     "temp_limits = 5  # temperature limits in which calibration parameters are considered equal\n",
@@ -185,18 +184,16 @@
     "run_dc = RunDirectory(f\"{in_folder}/r{run:04d}\")\n",
     "\n",
     "# extract control data\n",
-    "if not set_parameters_manually:\n",
-    "    ctrl_data = pnccdlib.PnccdCtrl(run_dc, karabo_id)\n",
-    "    \n",
-    "    if bias_voltage == 0:\n",
-    "        bias_voltage = ctrl_data.get_bias_voltage()\n",
-    "    if gain == -1:\n",
-    "        gain = ctrl_data.get_gain()\n",
-    "    if fix_temperature_top == 0:\n",
-    "        fix_temperature_top = ctrl_data.get_fix_temperature_top()\n",
-    "    if fix_temperature_bot == 0:\n",
-    "        fix_temperature_bot = ctrl_data.get_fix_temperature_bot()\n",
-    "\n",
+    "ctrl_data = pnccdlib.PnccdCtrl(run_dc, karabo_id)\n",
+    "\n",
+    "if bias_voltage == 0:\n",
+    "    bias_voltage = ctrl_data.get_bias_voltage()\n",
+    "if gain == -1:\n",
+    "    gain = ctrl_data.get_gain()\n",
+    "if fix_temperature_top == 0:\n",
+    "    fix_temperature_top = ctrl_data.get_fix_temperature_top()\n",
+    "if fix_temperature_bot == 0:\n",
+    "    fix_temperature_bot = ctrl_data.get_fix_temperature_bot()\n",
     "\n",
     "# Printing the Parameters Read from the Data File:\n",
     "display(Markdown('### Detector Parameters'))\n",
diff --git a/notebooks/pnCCD/Correct_pnCCD_NBC.ipynb b/notebooks/pnCCD/Correct_pnCCD_NBC.ipynb
index ed111a76d..e10a3f33a 100644
--- a/notebooks/pnCCD/Correct_pnCCD_NBC.ipynb
+++ b/notebooks/pnCCD/Correct_pnCCD_NBC.ipynb
@@ -37,7 +37,6 @@
     "saturated_threshold = 32000.  # full well capacity in ADU\n",
     "\n",
     "# Conditions for retrieving calibration constants\n",
-    "set_parameters_manually = False  # Boolean for setting parameter values manually instead of reading control values.\n",
     "fix_temperature_top = 0. # fix temperature for top sensor in K, set to 0. to use value from slow data.\n",
     "fix_temperature_bot = 0. # fix temperature for bottom senspr in K, set to 0. to use value from slow data.\n",
     "gain = -1  # the detector's gain setting. Set to -1 to use the value from the slow data.\n",
@@ -186,23 +185,19 @@
     "run_dc = RunDirectory(Path(in_folder) / f\"r{run:04d}\")\n",
     "ctrl_data = pnccdlib.PnccdCtrl(run_dc, karabo_id)\n",
     "\n",
-    "proposal = run_dc.run_metadata()[\"proposalNumber\"]\n",
-    "print(f'Proposal: {proposal}, Run: {run}')\n",
-    "\n",
     "# extract control data\n",
-    "if not set_parameters_manually:\n",
-    "    step_timer.start()\n",
+    "step_timer.start()\n",
     "\n",
-    "    if bias_voltage == 0.:\n",
-    "        bias_voltage = ctrl_data.get_bias_voltage()\n",
-    "    if gain == -1:\n",
-    "        gain = ctrl_data.get_gain()\n",
-    "    if fix_temperature_top == 0:\n",
-    "        fix_temperature_top = ctrl_data.get_fix_temperature_top()\n",
-    "    if fix_temperature_bot == 0:\n",
-    "        fix_temperature_bot = ctrl_data.get_fix_temperature_bot()\n",
+    "if bias_voltage == 0.:\n",
+    "    bias_voltage = ctrl_data.get_bias_voltage()\n",
+    "if gain == -1:\n",
+    "    gain = ctrl_data.get_gain()\n",
+    "if fix_temperature_top == 0:\n",
+    "    fix_temperature_top = ctrl_data.get_fix_temperature_top()\n",
+    "if fix_temperature_bot == 0:\n",
+    "    fix_temperature_bot = ctrl_data.get_fix_temperature_bot()\n",
     "\n",
-    "    step_timer.done_step(\"Reading control parameters.\")\n",
+    "step_timer.done_step(\"Reading control parameters.\")\n",
     "\n",
     "# Printing the Parameters Read from the Data File:\n",
     "display(Markdown('### Detector Parameters'))\n",
-- 
GitLab