sbailey / surveyqa

DESI Survey QA Dashboard
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

silence harmless warnings #50

Closed sbailey closed 5 years ago

sbailey commented 5 years ago

This PR silences 3 harmless warnings:

@ana-lyons, @rdoshi99, or @williyamshoe could you try running with this branch and confirm that you don't get any warnings with whatever versions of numpy and astropy you have installed? I don't need all 3 of you to verify this, but it is good practice to have someone other than the original author double check, and it is useful for all of you to take a look at how to silence warnings that you don't need.

Other info: in this case I silenced specific warnings at the package-level because I wanted to get rid of every case of them without cluttering up the code. This has the negative side effect that importing surveyqa will silence the ERFA and IERS warnings everywhere, including external to surveyqa, which may not be what the user intended if they were using this as a 3rd party dependency to their own code. In this case we are self-contained so I think this is ok. If this was a more general purpose library (like bokeh or numpy or astropy) we would want to only silence warnings at the specific places they occur in our code using something like:

import warnings
from astropy.utils.exceptions import AstropyUserWarning
...
with warnings.catch_warnings():
    warnings.simplefilter('ignore', AstropyUserWarning)
    # the single line of code generating the warning that we want to ignore

# proceed with other code, which could still generate warnings
williyamshoe commented 5 years ago

I've ran this branch on my end, and no warnings were found! I am up-to-date with my versions of numpy and astropy.