Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add workaround for Spectrum1D GWCS links #1526

Merged
merged 3 commits into from
Jul 27, 2022

Conversation

rosteen
Copy link
Collaborator

@rosteen rosteen commented Jul 25, 2022

Fixes #1525, although this should be considered a temporary workaround until (hopefully) upstream fixes happen. The root cause of the issue is that Glue's WCSLink looks for a has_celestial attribute on the data.coords object. In the case of a Spectrum1D that's initialized with a spectral_axis array rather than a WCS (and thus creates a lookup table GWCS), glue_astronomy creates a special SpectralCoordinates object for the data.coords that was missing the has_celestial attribute. This caused an AttributeError every time and thus the linking to fall back on pixel links.

Unfortunately, after I locally added has_celestial=False to the SpectralCoordinates, the WCSLink seemed to still fail. So here we fall back on the old explicit manual linking for this case while more debugging happens upstream.

Note that I also took the opportunity here to stop linking the first data to itself, since (I'm pretty sure) it's unnecessary.

@rosteen rosteen force-pushed the fix-specviz-linking branch from f5070cf to b1c0825 Compare July 25, 2022 19:12
@rosteen rosteen added this to the 2.9 milestone Jul 25, 2022
@rosteen rosteen added bug Something isn't working 🔥 Critical specviz labels Jul 25, 2022
Copy link
Member

@kecnry kecnry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed this fixes the case I had to reproduce the original bug. It would be nice to see this fixed upstream, but since this used to work in jdaviz, I vote we get this workaround out as a bugfix in the meantime.

I'm happy to approve once understanding if the raise is intentional (I think we might need it gone for Gaussian Smooth to work correctly). Edit: and hopefully that is the reason CI is very upset and that will pass soon 🤞

@rosteen
Copy link
Collaborator Author

rosteen commented Jul 25, 2022

Still has a test failure, I'll look into it tomorrow. Might just need to update the expected test result.

@rosteen
Copy link
Collaborator Author

rosteen commented Jul 26, 2022

The remaining test failure was an unrelated SSL timeout.

@codecov
Copy link

codecov bot commented Jul 26, 2022

Codecov Report

Merging #1526 (0b1970f) into main (9e20b50) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1526   +/-   ##
=======================================
  Coverage   85.37%   85.37%           
=======================================
  Files          91       91           
  Lines        8624     8631    +7     
=======================================
+ Hits         7363     7369    +6     
- Misses       1261     1262    +1     
Impacted Files Coverage Δ
jdaviz/app.py 92.39% <100.00%> (-0.08%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9e20b50...0b1970f. Read the comment docs.

Comment on lines +1343 to +1344
if len(self.data_collection) > 1:
self._link_new_data()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just trying to wrap my head around the need for all the changes in tests - is avoiding self-linking (alone) responsible for dropping all those links and affecting the indices?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe so, yes. In Cubeviz there were 3 extra links, Specviz 1 extra. Hence the changes.

Copy link
Member

@kecnry kecnry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix, we should try to get this in asap!

Copy link
Contributor

@javerbukh javerbukh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@javerbukh javerbukh merged commit 2e8de52 into spacetelescope:main Jul 27, 2022
@pllim
Copy link
Contributor

pllim commented Aug 1, 2022

this should be considered a temporary workaround until (hopefully) upstream fixes happen

Where is the upstream issue? Thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working 🔥 Critical Ready for final review specviz
Projects
None yet
Development

Successfully merging this pull request may close these issues.

spectral_axis linking broken for shifted spectra
4 participants