diff --git a/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb b/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb index 0d87e13fe67e81cc6e0a05c08babc11696c4d8fd..466589430365012f41e2ffc290f69e241cd3edbe 100644 --- a/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb +++ b/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb @@ -218,10 +218,10 @@ " const_data[mod][cname] = np.copy(\n", " cf[f\"{mdata['dataset']}/data\"])\n", "else:\n", - " constant_names = [\n", - " \"Offset10Hz\", \"BadPixelsDark10Hz\",\n", - " \"BadPixelsFF10Hz\", \"RelativeGain10Hz\",\n", - " ]\n", + " constant_names = [\"Offset10Hz\", \"BadPixelsDark10Hz\"]\n", + " if relative_gain:\n", + " constant_names += [\"BadPixelsFF10Hz\", \"RelativeGain10Hz\"]\n", + "\n", " const_data = jf_cal.ndarray_map(calibrations=constant_names)" ] }, @@ -240,15 +240,13 @@ "\n", " if missing_dark_constants:\n", " warning(\n", - " f\"Dark constants {missing_dark_constants} are not available to correct {mod}. \"\n", - " f\"Module {mod} won't be corrected.\")\n", + " f\"Dark constants {missing_dark_constants} are not available to correct {mod}.\"\n", + " f\" Module {mod} won't be corrected.\")\n", " karabo_da.remove(mod)\n", "\n", - " if missing_gain_constants:\n", - " warning(f\"Gain constants {missing_gain_constants} were not retrieved for {mod}. \")\n", - " if \"RelativeGain10Hz\" in missing_gain_constants:\n", - " relative_gain = False\n", - " warning(\"Relative gain correction is disabled.\")\n", + " if relative_gain and missing_gain_constants:\n", + " warning(f\"Gain constants {missing_gain_constants} were not retrieved for {mod}.\"\n", + " \" No Relative gain correction for this module\")\n", "if not karabo_da: # Dark constants are missing for all modules.\n", " raise ValueError(\"Dark constants are missing for all modules.\")" ] @@ -410,7 +408,7 @@ " d -= offset\n", "\n", " # Gain correction\n", - " if relative_gain:\n", + " if relative_gain and gain_map is not None:\n", " if memory_cells > 1:\n", " gain_map_cell = gain_map[m, ...]\n", " else:\n",