Skip to content
Snippets Groups Projects

calcat_interface2: Fix require_calibrations() when none of a given calibration type found

Merged Thomas Kluyver requested to merge fix/require-calibrations into master
1 unresolved thread

Description

When no offset constants are found for a given detector, .require_calibrations() was raising a KeyError, when we expect it to deselect all modules and return an empty CalibrationData object. We have seen this for both LPD & JUNGFRAU.

How Has This Been Tested?

xfel-calibrate jungfrau CORRECT \
  --karabo-da JNGFR01 --receiver-template JNGFR01 \
  --karabo-id MID_EXP_JF500K1 --run 300 \
  --in-folder /gpfs/exfel/exp/MID/202302/p004451/raw \
  --out-folder /gpfs/exfel/data/scratch/kluyvert/jf-corr-p4451-r300

Now fails with an error from the notebook:

Exception: Could not find offset constants for any modules, will not correct data.

A separate fix is likely needed in the JUNGFRAU correction notebook for the fallback to dynamic gain constants, as it's currently catching the wrong error.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the code style of this project.

Reviewers

@schmidtp

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • added 1 commit

    • f3cf6d4f - Fix fallback to dynamic gain constants in burst mode

    Compare with previous version

  • I have also now updated the notebook code to fall back to dynamic gain constants for burst-mode data. The run I'm testing with (p4451 r300) still doesn't find any constants - maybe because it's from last year but has a non-default exposure timeout, which was only added as a condition more recently. But I see the warning message before it errors out with no constants:

    WARNING:root:No fixed gain offset constants found. Looking for dynamic gain constant.
    
    ...
    
    Exception: Could not find offset constants for any modules, will not correct data.
    Edited by Thomas Kluyver
276 273 " \"\"\"\n",
277 274 " from datetime import datetime\n",
278 275 "\n",
279 " from cal_tools.calcat_interface import CalCatError\n",
280 "\n",
281 " try:\n",
282 " jungfrau_consts = jungfrau_cal_mdata(gm=1)\n",
283 " except CalCatError as e: # TODO: update with CalibrationError class\n",
276 " jungfrau_consts = jungfrau_cal_mdata(gm=1)\n",
277 " if not jungfrau_consts.aggregator_names:\n",
  • added 1 commit

    • a33d66a7 - CalibrationData.__bool__ to check if any constants present

    Compare with previous version

  • LGTM, thanks!

  • Philipp Schmidt changed milestone to %3.16.0

    changed milestone to %3.16.0

  • Thomas Kluyver mentioned in commit ac3a2137

    mentioned in commit ac3a2137

  • Thomas Kluyver mentioned in merge request !1129 (merged)

    mentioned in merge request !1129 (merged)

  • Please register or sign in to reply
    Loading