-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warnings verbosity #1213
base: master
Are you sure you want to change the base?
Warnings verbosity #1213
Conversation
Pull Request Test Coverage Report for Build 11976595227Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
@@ -1,6 +1,50 @@ | |||
__all__ = ("CCLError", "CCLWarning", "CCLDeprecationWarning",) | |||
__all__ = ("CCLError", "CCLWarning", "CCLDeprecationWarning", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Start reviewing here.
@@ -40,8 +84,8 @@ def __hash__(self): | |||
|
|||
@classmethod | |||
def enable(cls): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the deprecation warnings covered by the verbosity filter as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, but let me check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No they are not. Do you think they should?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My gut feeling is yes - they're good to know while building a model but you probably don't want them in an MCMC log.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If they mute them and CCL's deprecation cycle completes, their MCMC will simply stop working, and they won't be able to figure out why. I don't think it's a good idea muting those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, but deprecation warnings have to do with CCL functionality whereas CCLWarnings mostly have to do with numerical stability, so they represent different things. At the very least I'd add a different flag to separate the verbosity level for deprecation-specific warnings. BTW now that v3 is out, is CCLDeprecationWarning
used at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, and also, deprecation warnings should be on my default, contrary to other, informative-only warnings, because that's how you tell people that the API will change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CCLDeprecationWarnings are not used right now. I'll leave them there for the future in any case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They seemed to be used here:
https://github.com/LSSTDESC/CCL/blob/master/pyccl/baryons/baccoemu_baryons.py#L221
and the decorators in
https://github.com/LSSTDESC/CCL/blob/master/pyccl/_core/deprecations.py
But the latter don't seem to be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As developers we can decide what the priority of the different warnings are. If we decide that specific deprecation warnings are sufficiently important, we can just tag them as "high", and they'll go through the filter.
@tilmantroester I've now added the CCLDeprecationWarnings to the list of warnings that can be suppressed if desired.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
We should document this somewhere though and make a point to check any model with |
CCL often throws warnings about things that are relatively benign and should not plague the output of e.g. MCMC runs. This PR implements a granular way to control the verbosity of the warning messages thrown by CCL.
It uses some code by @nikfilippas .
While doing this I fixed a couple of bugs in the documentation.
Most of the changes are cosmetic. Anyone reviewing should start by looking at the changes in
error.py
(the rest is boilerplate)