-
Notifications
You must be signed in to change notification settings - Fork 75
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
Fix cubeviz test broken by glue 1.19 #2812
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2812 +/- ##
==========================================
- Coverage 88.82% 88.79% -0.03%
==========================================
Files 111 110 -1
Lines 16879 16614 -265
==========================================
- Hits 14993 14753 -240
+ Misses 1886 1861 -25 ☔ View full report in Codecov by Sentry. |
eqv = u.spectral_density(spec_limits*spec.spectral_axis.unit) | ||
try: | ||
spec = data.get_object(cls=Spectrum1D) | ||
except Exception: |
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.
is the bare exception here safe or could it get us until trouble in any way? Can we do something to check in advance instead or check for a specific expected exception?
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.
The original traceback is very confusing so I don't know what is the exact exception to catch here. In general, I think falling back to not using spectral axis should be okay when Spectrum1D conversion fails?
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.
so the consequence of the exception being triggered (and returning an empty list) is just that that data entry will not show any valid units to convert?
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.
Let's ask @javerbukh since I am not very sure where the output goes. Either that or it only uses basic equivalencies that might succeed or not.
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.
This is used when data with a different spectral axis unit from the display data is visualized simultaneously with the display data in a viewer. For example data 1 with um
is loaded and data 2 with AA
is added, to_unit
will convert the data from data 2 so that it matches the units of data 1. An empty list may result in the data not being visualized at all, so we should check that that actually happens and add a snackbar or other message so the user understands why the data was not added.
That said, if spec = data.get_object(cls=Spectrum1D)
is throwing an error, something else seems to be broken and this should just temporarily get us around that issue.
TLDR: This looks like a good temporary fix but we should track the larger issue of why this is throwing an exception.
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'm just worried that any future bug within get_object
will be very hard to track down with this blanket exception 🤔
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.
Should I close this without merge then, and someone else can pick it up next sprint for a proper fix?
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.
seems to be RuntimeError
... but I'll look into if we can feasilby predict in advance instead of relying on try/except
@rosteen , for completeness, with a fresh env and forcing But sounds like we're doing a proper fix, so I am closing this PR without merge. Thanks, all! |
Here is a snippet of the traceback before the
I would argue that either glue-astronomy or specutils should be able to catch that this is an incompatible WCS and raise a useful exception that we can catch here (although a If everyone else is okay with it, I think we should get this PR in as it was but with |
When astropy/astropy#16298 is resolved (no ETA), the That said... @rosteen , do you know why |
and why is |
Re: #2812 (comment) I think that is why Tom R opened the astropy issue. |
I had thought that the issue here was that we were trying to send non-spectral data through the Spectrum1D translator from Jdaviz, since we only check for a |
The WCS does suggest that it is a cube with a spectral axis - so maybe this is actually just a specutils bug in this case? And we just weren't ever sending this test data through unit conversion before and so didn't notice it was failing here until the glue changes forced the code to go through this logic for non-unit-conversion reasons? |
This is coming up more and more though - maybe we should just merge (including backporting) with either the RuntimeError or catch-all Exception and investigate further after? |
Just speaking for the test case, I think the problem is that it is a actual spectral cube but |
Description
I think the test passed now but the test case described in #2805 (comment) is still broken. I got the image to display but both mouseover and slice are not working, so I think there might be more things broken than #2811 here but I don't know how to fix them.
Fixes #2811
Change log entry
CHANGES.rst
? If you want to avoid merge conflicts,list the proposed change log here for review and add to
CHANGES.rst
before merge. If no, maintainershould add a
no-changelog-entry-needed
label.Checklist for package maintainer(s)
This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.
trivial
label.