-
Notifications
You must be signed in to change notification settings - Fork 180
JP-3923: Hide benign runtime warnings #9490
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
Conversation
eb98ebc to
9835ed4
Compare
emolter
left a comment
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.
Maybe a controversial question, but are there any cases anywhere in the pipelien where the numpy RuntimeWarnings for "divide by zero" and "invalid value encountered in divide" and similar are useful?
can we just globally ignore them?
|
Thanks for cleaning up after me! You can also revisit the unit tests I touched in #9381 , especially where I inserted blind ignore with More importantly, are we sure they are always okay to ignore. Or should we instead clean up the input data or throw exceptions instead? If we keep the ignore but user desires to see these warnings sometimes, we can also consider re-routing the warning to log file instead as pytest warning catching does not care about xref #1397 |
9835ed4 to
4ab77c1
Compare
eadbabc to
cea0f1e
Compare
Thanks for pointing this out -- I removed a couple filters from unit tests and added a couple more to the code instead.
The ones I looked at are all related to numerical handling for arrays that may contain both valid and invalid data points. The default behavior in these cases is the expected behavior and there's no need to warn for it: NaN should be returned when there are no good values to average, division by zero should return NaN, etc. We fully expect that there will be some NaN values in our data! The one exception in the warnings addressed here, in my opinion, is that NIRSpec values are sometimes prone to floating point overflow, due to the combination of the precision we use for storing data and the calibration scale factor used in the flat reference files. But still, the numpy behavior is correct within the constraints -- if the value is too small to propagate, it sets it to zero; if it's too large, it sets it to infinity -- and either way, there's no need to warn the user that a few values in a large array did not propagate, every time we run the NIRSpec pipeline.
I don't think there's any more value in these messages as log warnings than as runtime warnings. I can see David's point that they can be useful in development, so we probably should not globally ignore them, but I don't see a good reason to show unavoidable benign warnings to users. |
|
There is uncaught warning now in Once that is dealt with, technically this LGTM, but I'll leave the actual approval to algorithm experts. Thanks! |
That's because I moved the warning filter to the companion PR in stcal (spacetelescope/stcal#371), which is already required to pass regression tests. I can modify the pyproject.toml temporarily to point to my stcal branch so CI will pass. |
aeb4f1f to
50ba524
Compare
tapastro
left a comment
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.
Looks good to me - honestly surprised at how few catches were required to clean up the repo!
|
Thanks for reviewing! The stcal PR will need to be approved and merged before this one can go in -- I'll modify the pyproject.toml now to point to stcal main. |
c3a4e08 to
6f304b2
Compare
Resolves JP-3923
Requires spacetelescope/stcal#371
Add filters for runtime warnings that appear in JWST regression tests. Default behavior for the numerical errors encountered is expected; the generated warnings are not necessary or useful to the user.
Tasks
Build 12.0(use the latest build if not sure)no-changelog-entry-needed)changes/:echo "changed something" > changes/<PR#>.<changetype>.rst(see changelog readme for instructions)docs/pageokify_regteststo update the truth files