Skip to content
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

"BAD WCS" error is too verbose #782

Open
pllim opened this issue Jul 29, 2019 · 4 comments
Open

"BAD WCS" error is too verbose #782

pllim opened this issue Jul 29, 2019 · 4 comments
Labels

Comments

@pllim
Copy link
Collaborator

pllim commented Jul 29, 2019

Between

ginga/ginga/util/wcs.py

Lines 68 to 69 in c847163

assert (ra >= 0.0), WCSError("RA (%f) is negative" % (ra))
assert ra < 360.0, WCSError("RA (%f) > 360.0" % (ra))

and

ginga/ginga/AstroImage.py

Lines 811 to 821 in c847163

self.logger.warning("Bad coordinate conversion: %s" % (
str(e)))
ra_txt = dec_txt = 'BAD WCS'
try:
# log traceback, if possible
(type_, value_, tb) = sys.exc_info()
tb_str = "".join(traceback.format_tb(tb))
self.logger.error("Traceback:\n%s" % (tb_str))
except Exception:
tb_str = "Traceback information unavailable."
self.logger.error(tb_str)

I keep seeing traceback info on screen when WCS cannot be computed. This is too verbose to my liking since I see "BAD WCS" on the viewer anyway. I think the code can be refactored to only output traceback when log level is set to debug. However, I cannot find a easy way to do this without refactoring both wcs.py and AstroImage.py. Any thoughts, @ejeschke ?

@ejeschke
Copy link
Owner

I think that WCS errors are kind of in a special category. There are times when you don't care about the WCS and then almost any error messages seem annoying, but when you absolutely care about the WCS you definitely need informative error messages, possibly with a full stack trace (e.g. trying to debug some issue in gwcs).

@ejeschke
Copy link
Owner

Maybe we could handle it via a preference/setting? For the info_xy stuff, it could be turned off, but if we need to debug something we need to be able describe an easy way to turn it on.

@ejeschke
Copy link
Owner

I've never been happy with that info_xy stuff being in AstroImage anyway. Might be a good opportunity to rethink/redo how that is handled.

@pllim
Copy link
Collaborator Author

pllim commented Jul 31, 2019

Well, we have loglevel, so if it emits under DEBUG, then to enable it for debugging, we can pass in --loglevel=10, otherwise it is silenced? I would prefer to get rid of try ... except ... too, as except is expensive when it happens. Maybe there is a way to catch this with if ... else ... instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants