[AGIPD][CORRECT] Clean up before AGIPD calcalt_interface changes
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
- Replace
use_dir_creation_date
with the possibility of adding acreation_time
- Remove
overwrite
flag. - Remove unused flags and imports.
- Import only the needed functions and methods from cal_tools modules.
- Replace
get_dir_creation_date
withcalcat_creation_time
- Remove the flags hinting at the possibility to use local dark constants.
- 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
Merge request reports
Activity
assigned to @ahmedk
mentioned in merge request !774 (merged)
added New CALCAT interface Waiting for review labels
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
orfrom logging import warning
? For the latter, my prototype usedlogging.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 warninglogging.warning()
if there is nothing the client application can do about the situation, but the event should still be notedPeople 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 usewarnings.warn()
). But heck, in the end as long as the handler supports multiple loggers, it doesn't even matter.
changed milestone to %3.8.0
mentioned in commit 1c5290cc