diff --git a/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb b/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb index 37f6eab2042341911ea6a52a2e0a05d6a89488b6..f8d83b318ec5d5666871dc225d4dc103dfc33960 100644 --- a/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb +++ b/notebooks/Jungfrau/Jungfrau_Gain_Correct_and_Verify_NBC.ipynb @@ -249,7 +249,7 @@ " gain_mode=gm,\n", " )\n", " \n", - " jf_consts = CalibrationData.from_condition(\n", + " return CalibrationData.from_condition(\n", " conditions,\n", " calibrations=expected_constants,\n", " detector_name=karabo_id,\n", @@ -260,9 +260,6 @@ " ).require_calibrations(\n", " ['Offset10Hz']\n", " )\n", - " display(jf_consts.summary_table())\n", - "\n", - " return jf_consts, jf_consts.aggregator_names\n", "\n", "def prefer_fixed_gain_constants():\n", " \"\"\"JF corrections in burst mode are only supported when\n", @@ -276,19 +273,16 @@ " \"\"\"\n", " from datetime import datetime\n", "\n", - " from cal_tools.calcat_interface import CalCatError\n", - "\n", - " try:\n", - " jungfrau_consts = jungfrau_cal_mdata(gm=1)\n", - " except CalCatError as e: # TODO: update with CalibrationError class\n", + " jungfrau_consts = jungfrau_cal_mdata(gm=1)\n", + " if not jungfrau_consts.aggregator_names:\n", " warning(\n", - " \"No fixed gain constants found. \"\n", - " \"Looking for dynamic gain constant. \"\n", - " f\"(CalCatError: {e}.\")\n", + " \"No fixed gain offset constants found. \"\n", + " \"Looking for dynamic gain constant.\"\n", + " )\n", " else:\n", - " return jungfrau_consts\n", + " return jungfrau_consts, jungfrau_consts.aggregator_names\n", "\n", - " # In case of CALCATError exception look for dynamic gain constants\n", + " # Look for dynamic gain constants\n", " jungfrau_consts = jungfrau_cal_mdata(gm=0)\n", "\n", " das_with_offset = []\n", @@ -297,7 +291,7 @@ " time_difference = creation_time - datetime.fromisoformat(offset_creation_time)\n", " if abs(time_difference.days) > 3:\n", " warnings.warn(\n", - " f\"No dynamic gain constant retrieved for {mod} with at least\"\n", + " f\"Dynamic gain offset constant for {mod} has more than\"\n", " \" 3 days time difference with the RAW data creation date.\"\n", " \" Please make sure there are available constants.\")\n", " else:\n", @@ -324,7 +318,10 @@ "if prefer_fixed_gain_constants_flag:\n", " jungfrau_consts, das_to_correct = prefer_fixed_gain_constants()\n", "else:\n", - " jungfrau_consts, das_to_correct = jungfrau_cal_mdata(gain_mode)" + " jungfrau_consts, das_to_correct = jungfrau_cal_mdata(gain_mode)\n", + " das_to_correct = jungfrau_consts.aggregator_names\n", + "\n", + "jungfrau_consts.summary_table()" ] }, { @@ -1191,7 +1188,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.10" + "version": "3.11.8" } }, "nbformat": 4,