-
Notifications
You must be signed in to change notification settings - Fork 76
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
BUG: Fix specviz2d loader with ext keyword #2830
Conversation
@@ -89,6 +91,37 @@ def test_2d_parser_no_unit(specviz2d_helper, mos_spectrum2d): | |||
assert label_mouseover.icon == 'b' | |||
|
|||
|
|||
def test_2d_parser_hdulist_ext(tmp_path, specviz2d_helper, mos_spectrum2d_as_hdulist): |
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 goes through a similar logic route as Cami's problematic case but does not give the exact traceback, probably because I am trying to fake it. But I don't feel like downloading even more data for the test suite and none of the existing remote data tests are triggering Cami's error. 🤷♀️
It loads the requested extension for NIRISS, NIRCam, and NIRSpec (thank you!), but when hovering on the 2D spectrum no information is reported in the top bar and plot options either does not update the 2D spectrum viewer or is extremely slow. |
Hmm yeah, I guess fixing one case broke another because this parser is so overloaded. Thanks for checking. Turning back into draft. |
but should pass with this patch
abd4924
to
1040ad0
Compare
The mouseover is something else. When you load
And calling
|
When I try to construct the WCS from that file and extension directly as such, it gives me from astropy import units as u
from astropy.io import fits
from astropy.wcs import WCS
from specutils import Spectrum1D
filename = "jw01895001002_04101_00003_nrcalong_cal.fits"
ext = 8
pf = fits.open(filename)
w = WCS(pf[ext].header)
flux = pf[ext].data * u.Unit(pf[ext].header["BUNIT"])
sp = Spectrum1D(flux=flux, wcs=w) |
but that should not crash the mouseover display.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2830 +/- ##
==========================================
+ Coverage 88.92% 88.94% +0.01%
==========================================
Files 111 111
Lines 17005 17006 +1
==========================================
+ Hits 15122 15126 +4
+ Misses 1883 1880 -3 ☔ View full report in Codecov by Sentry. |
Now the hovering works and plot options also works fine! When hovering on the 2D spectrum, the indicator does not get propagated to the 1D spectrum, although it gets propagated to the 2D spectrum when hovering on the 1D spectrum. |
Re: #2830 (comment) -- Not sure what the expected behavior should be. I am just trying to fix the immediate bug here. I can ask other devs. Thanks for the quick feedback! |
The hover is designed and expected to work in both directions, yes. Screen.Recording.2024-04-25.at.7.58.42.AM.mov |
To answer your questions from tag-up this morning.
@kecnry , yes.
@camipacifici , that is because for NIRISS, it grabs wavelength from the corresponding WAVELENGTH extension. This seems to be very specific to NIRISS and the logic is buried deep inside Mosviz parser here:
jdaviz/jdaviz/configs/mosviz/plugins/parsers.py Lines 889 to 901 in 4423ceb
This logic is inaccessible by Specviz2d. |
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.
Thank you, looks good to me.
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.
Thanks for the reviews! |
Description
This pull request is to address user finding the app crashing when providing
ext
for Specviz2d loader.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.