From 05134d77b10a7cab004862b4810d312c5da6e3c1 Mon Sep 17 00:00:00 2001 From: ahmedk <karim.ahmed@xfel.eu> Date: Tue, 2 May 2023 12:50:18 +0200 Subject: [PATCH] FIX remove notebook changes --- notebooks/pnCCD/Correct_pnCCD_NBC.ipynb | 31 ++++++++++++++----------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/notebooks/pnCCD/Correct_pnCCD_NBC.ipynb b/notebooks/pnCCD/Correct_pnCCD_NBC.ipynb index bed27da78..6fa624889 100644 --- a/notebooks/pnCCD/Correct_pnCCD_NBC.ipynb +++ b/notebooks/pnCCD/Correct_pnCCD_NBC.ipynb @@ -324,9 +324,10 @@ " client=rest_cfg.calibration_client(),\n", ")\n", "\n", - "pnccd_metadata = pnccd_cal.metadata(calibrations=constant_names)\n", - "\n", - "metadata = pnccd_metadata[karabo_da]\n", + "try:\n", + " pnccd_metadata = pnccd_cal.metadata(calibrations=constant_names)\n", + "except CalCatError as e:\n", + " warning(e)\n", "\n", "mod_to_pdu = pnccd_cal.mod_to_pdu\n", "ccvs_url = \"https://in.xfel.eu/calibration/calibration_constant_versions/\"\n", @@ -336,30 +337,34 @@ " display(Markdown(\n", " f\"- [{cname}]({ccvs_url}/{c_mdata['ccv_id']}): {c_mdata['begin_validity_at']}\"))\n", "\n", + "constants = pnccd_cal.ndarray_map(metadata=pnccd_metadata).get(karabo_da, {})\n", + "\n", "# Validate the constants availability and raise/warn correspondingly. \n", "missing_dark_constants = set(\n", - " c for c in [\"OffsetCCD\", \"NoiseCCD\", \"BadPixelsDarkCCD\"] if c not in metadata.keys())\n", + " c for c in [\"OffsetCCD\", \"NoiseCCD\", \"BadPixelsDarkCCD\"] if c not in constants.keys())\n", "\n", "if missing_dark_constants:\n", " raise KeyError(\n", " f\"Dark constants {missing_dark_constants} are not available for correction.\")\n", "\n", - "if corr_bools.get('relgain') and \"RelativeGainCCD\" not in metadata.keys():\n", + "if corr_bools.get('relgain') and \"RelativeGainCCD\" not in constants.keys():\n", " warning(\"RelativeGainEPix100 is not found in the calibration database.\")\n", " corr_bools['relgain'] = False\n", - "\n", + "step_timer.done_step(\"Constants retrieval\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ "# Record constant details in YAML metadata\n", "write_constants_fragment(\n", " out_folder=(metadata_folder or out_folder),\n", " det_metadata=pnccd_metadata,\n", " caldb_root=pnccd_cal.caldb_root,\n", - " )\n", - "\n", - "# load constants arrays after storing fragment YAML file\n", - "# and validating constants availability.\n", - "constants = pnccd_cal.ndarray_map(metadata=pnccd_metadata).get(karabo_da, {})\n", - "\n", - "step_timer.done_step(\"Constants retrieval\")" + " )" ] }, { -- GitLab