Skip to content
Snippets Groups Projects

[AGIPD][CORRECT] Clean up before AGIPD calcalt_interface changes

Merged Karim Ahmed requested to merge fix/small_agipd_corr_improvements into master
1 unresolved thread

These are small changes that I thought of adding before updating the notebooks for calcat_interface changes.

Related to https://git.xfel.eu/calibration/planning/-/issues/150

Description

  1. Replace use_dir_creation_date with the possibility of adding a creation_time
  2. Remove overwrite flag.
  3. Remove unused flags and imports.
  4. Import only the needed functions and methods from cal_tools modules.
  5. Replace get_dir_creation_date with calcat_creation_time
  6. Remove the flags hinting at the possibility to use local dark constants.
  7. Remove the calfile flag.

How Has This Been Tested?

Relevant Documents (optional)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Refactor (refactoring code with no functionality changes)

Checklist:

Reviewers

Edited by Karim Ahmed

Merge request reports

Checking pipeline status.

Approval is optional

Merged by Karim AhmedKarim Ahmed 2 years ago (Jan 11, 2023 1:42pm UTC)

Merge details

  • Changes merged into master with 1c5290cc.
  • Deleted the source branch.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
127 126 "import math\n",
128 127 "import multiprocessing\n",
129 128 "import re\n",
130 "import traceback\n",
131 129 "import warnings\n",
132 130 "from datetime import timedelta\n",
133 "from logging import warn\n",
131 "from logging import warning\n",
  • In hindsight I wonder now, should we use from warnings import warn or from logging import warning? For the latter, my prototype used logging.captureWarnings. It would have the additional benefit we capture "other" warnings as well.

    @kluyvert Are you aware of a canonical opinion on this one?

  • The Python logging howto suggests:

    warnings.warn() in library code if the issue is avoidable and the client application should be modified to eliminate the warning

    logging.warning() if there is nothing the client application can do about the situation, but the event should still be noted

    People don't exactly agree on this, though.

    From a practical perspective, the warnings module offers some possibilities that logging doesn't, like turning warnings into exceptions or displaying only the first instance of each warning. And warnings are visible by default, whereas logging has to be set up to show anything. But if you're using the logging framework anyway, then log.warning() associates them with a particular logger (normally associated with a module), which allows for better filtering.

  • From the Python logging howto, indeed logging.warning seems to be the right choice. I'm not yet sure we can make use of multiple loggers given for notebooks, it'll be set up magically and they're using the default logger anyway (or the warning one if we'd use warnings.warn()). But heck, in the end as long as the handler supports multiple loggers, it doesn't even matter.

  • Please register or sign in to reply
  • Thanks, LGTM. Don't hold it off for the philosophical question I asked about warnings.

  • Philipp Schmidt changed milestone to %3.8.0

    changed milestone to %3.8.0

  • Thank you for the review!

  • merged

  • Karim Ahmed mentioned in commit 1c5290cc

    mentioned in commit 1c5290cc

  • Please register or sign in to reply
    Loading