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

Level 1 and Level 2 data product support in Rampviz #3194

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bmorris3
Copy link
Contributor

@bmorris3 bmorris3 commented Sep 12, 2024

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:

from jdaviz import Rampviz

# carina nebula:
level_2 = 'mast:JWST/product/jw02731001004_02103_00005_nrca3_cal.fits'
level_1 = level_2.replace('_cal', '_uncal')

rampviz = Rampviz()
rampviz.load_data(level_1, cache=True)
rampviz.load_data(level_2, ext=("SCI", "DQ"), cache=True)
rampviz.show()

Follow-up/to-dos

  • Should we load the DQ array into the group/diff viewers as well? in some cases this will be helpful, but will require careful adaptations to the data associations used for managing DQ visibility
  • We hope to visualize the L2 result – which is the per-pixel count rate during an integration, or the slope of the ramp cube – in the integration-viewer. L2 files are slopes from ramp fits after, e.g., linearity corrections, and without their intercepts. So we can't perfectly display this visualization from the L2 data themselves. Should we even try?
  • Do we want to support L2 products without L1 products? As of opening this PR, loading L2 without L1 doesn't work properly.
  • L1 files have no WCS, since the WCS solution is computed in the pipeline between L1 and L2. Without an L2 file, our mouseover info on ramp viewers can only show pixel coords. But if we have a matching L2 file loaded, we could show the world coordinates on hover in ramp viewers by getting the world coordinates from the level-2 viewer. Should we?
  • investigate why matched pan/zoom seems to "twitch" a bit in the ramp viewers

Change log entry

  • Is a change log needed? If yes, is it added to 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, maintainer
    should 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.

  • Are two approvals required? Branch protection rule does not check for the second approval. If a second approval is not necessary, please apply the trivial label.
  • Do the proposed changes actually accomplish desired goals? Also manually run the affected example notebooks, if necessary.
  • Do the proposed changes follow the STScI Style Guides?
  • Are tests added/updated as required? If so, do they follow the STScI Style Guides?
  • Are docs added/updated as required? If so, do they follow the STScI Style Guides?
  • Did the CI pass? If not, are the failures related?
  • Is a milestone set? Set this to bugfix milestone if this is a bug fix and needs to be released ASAP; otherwise, set this to the next major release milestone. Bugfix milestone also needs an accompanying backport label.
  • After merge, any internal documentations need updating (e.g., JIRA, Innerspace)?

@github-actions github-actions bot added imviz plugin Label for plugins common to multiple configurations rampviz labels Sep 12, 2024
@bmorris3 bmorris3 added this to the 4.0 milestone Sep 12, 2024
@bmorris3 bmorris3 added the Extra CI Run cron jobs in PR label Sep 12, 2024
Copy link

codecov bot commented Sep 12, 2024

Codecov Report

Attention: Patch coverage is 57.89474% with 16 lines in your changes missing coverage. Please review.

Project coverage is 88.39%. Comparing base (88ff8da) to head (225e901).

Files with missing lines Patch % Lines
jdaviz/configs/rampviz/plugins/parsers.py 31.57% 13 Missing ⚠️
jdaviz/configs/rampviz/helper.py 71.42% 2 Missing ⚠️
...nfigs/default/plugins/data_quality/data_quality.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3194      +/-   ##
==========================================
- Coverage   88.45%   88.39%   -0.07%     
==========================================
  Files         124      124              
  Lines       18389    18404      +15     
==========================================
+ Hits        16266    16268       +2     
- Misses       2123     2136      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@camipacifici
Copy link
Contributor

This looks good already as is! My preferences are those of a single user. Please gather more preferences especially from the Roman folks.

  • Should we load the DQ array into the group/diff viewers as well? in some cases this will be helpful, but will require careful adaptations to the data associations used for managing DQ visibility
    I am thinking that it might be distracting to have the DQ everywhere. I would be ok with DQ just on the L2 product.

  • We hope to visualize the L2 result – which is the per-pixel count rate during an integration, or the slope of the ramp cube – in the integration-viewer. L2 files are slopes from ramp fits after, e.g., linearity corrections, and without their intercepts. So we can't perfectly display this visualization from the L2 data themselves. Should we even try?
    The information is given in the hover, isn't it? It would be confusing to show it together with a non-corrected ramp. I would like the idea of showing the ramps without the intercept, but all the other corrections are probably out of scope.

  • Do we want to support L2 products without L1 products? As of opening this PR, loading L2 without L1 doesn't work properly.
    Imviz can do that. One day they will be combined, won't they? :)

  • L1 files have no WCS, since the WCS solution is computed in the pipeline between L1 and L2. Without an L2 file, our mouseover info on ramp viewers can only show pixel coords. But if we have a matching L2 file loaded, we could show the world coordinates on hover in ramp viewers by getting the world coordinates from the level-2 viewer. Should we?
    No strong opinion. Maybe Roman folks have preferences.

  • investigate why matched pan/zoom seems to "twitch" a bit in the ramp viewers
    Fix this is higher priority.

@kecnry
Copy link
Member

kecnry commented Sep 16, 2024

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.

@rosteen
Copy link
Collaborator

rosteen commented Sep 18, 2024

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

@@ -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]
Copy link
Collaborator

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:
Copy link
Collaborator

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)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Extra CI Run cron jobs in PR imviz plugin Label for plugins common to multiple configurations rampviz
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants