-
Notifications
You must be signed in to change notification settings - Fork 76
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
Level 1 and Level 2 data product support in Rampviz #3194
Conversation
af4c1ec
to
225e901
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3194 +/- ##
==========================================
+ Coverage 88.46% 88.48% +0.02%
==========================================
Files 125 125
Lines 18677 18700 +23
==========================================
+ Hits 16522 16547 +25
+ Misses 2155 2153 -2 ☔ View full report in Codecov by Sentry. |
This looks good already as is! My preferences are those of a single user. Please gather more preferences especially from the Roman folks.
|
I noticed in the screen recording that the subset layers (for a subset drawn on level 2) are not showing on the group or diff viewer - is this by design? The previews do appear when selecting them as apertures, so it seems they should be within view. |
You can see this in your video as well @bmorris3 but it's worse/more obvious on my machine - after doing a linked zoom (or actually, after doing anything that needs the viewers to refresh, like resizing the windows) the two default image viewers "bounce" 5-10 times. I don't see this behavior in the RampvizExample notebook on main, so I'm not sure if it's an interaction with the new viewer here, or something else. Screen.Recording.2024-09-18.at.1.31.12.PM.mov |
CHANGES.rst
Outdated
@@ -21,7 +21,7 @@ New Features | |||
|
|||
- The standalone version of jdaviz now uses solara instead of voila, resulting in faster load times. [#2909] | |||
|
|||
- New configuration for ramp/Level 1 data products from Roman WFI and JWST [#3120, #3148, #3167, #3171] | |||
- New configuration for ramp/Level 1 data products from Roman WFI and JWST [#3120, #3148, #3167, #3171, #3194] |
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 this also say Level 2 now?
raise ValueError(f"Expected a ramp with NAXIS=4 (with axes:" | ||
|
||
if hdu.header['NAXIS'] == 2: | ||
# this may be a calibrated Level 2 image: |
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.
If this is a "may", do we need some sort of if
statement here (rather than waiting until later to check for SCI
ext)?
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 challenge I was having in writing this comment concisely and correctly is that a user could always try to load a 2D FITS image that isn't a Level 2 image. There are if
statements within the method that gets called below this line, in the Imviz parser's method _parse_image
. Do you have particular corner cases in mind that we should defend against?
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 don't have a particular corner case in mind, I just wanted to make sure something wasn't missed given the comment. Sounds like it's handled elsewhere.
225e901
to
5a0e861
Compare
I got distracted in the middle of typing this earlier, sorry - could you add a test to check that the new viewer is created after loading level two data? Other than better test coverage I'm ready to approve this. |
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.
LGTM now, thanks for getting the test coverage up a little higher!
@@ -262,6 +262,8 @@ def _get_cube_value(self, image, arr, x, y, viewer): | |||
# cubeviz case: | |||
return arr[int(round(x)), int(round(y)), viewer.state.slices[-1]] | |||
elif image.ndim == 2: | |||
if isinstance(viewer, RampvizImageView): | |||
x, y = y, x |
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.
Just for clarity, swapping here has to do with the ramp cube convention? Also, can the L264 and L265 conditions be combined or is there going to be an additional case in the future that also has a 2 dimensional image?
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.
Full honesty – I'm not sure why the ramp cube coordinates seem to need a transpose here for coordinate info. There are already places in the logic in coords_info
where we index the mouseover pixel by arr[x, y, ...]
or arr[y, x, ...]
, and I'm not positive I understand what's going on there. I wrote it this way to ensure that the L1 and L2 products were in the same orientation in the group/diff viewers and the level-2 viewer, and to ensure that the DQ flags in the mouseover info were overlaid on the correct pixels in the image.
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 keep the RampvizImageView
case separate from ImvizImageView
viewers with image.ndim == 2
because Imviz works fine as is.
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 only saw one part in the code that I think could be clarified with a comment, everything else looks good to me. In testing, the viewer layout felt very natural and I really liked the pixel-hover capability being included an each of the viewers, but especially being included in the L2 viewer. I hadn't come around to testing this on my own yet, that being said, I thought it was really interesting and fun to play around with and is going to be very useful!
This PR introduces adaptations to allow Level 2 data products to be loaded into Rampviz, at the same time as Level 1 products.
The demo video below opens L1 and L2 products for the Carina nebula. The L2 product is opened in an image viewer to the right of the usual Rampviz viewers. I've loaded the L2 product with its DQ extension, so you can see where pixels are flagged. I zoom in on a region where pixels are flagged by jump detection (pink DQ overlay), create a subset, and show that the pixels in the subset indeed have a jump.
rampviz-l2-dq-jump.mov
To reproduce locally, run:
Follow-up/to-dos
level-2
viewer. Should we?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.