Skip to content

Conversation

@emolter
Copy link
Collaborator

@emolter emolter commented Aug 7, 2025

Resolves JP-4070

Closes #9694

This PR fixes an issue with the grism to detector WCS transform being used by the wfss_contam step, which was leading to multiple problems with the shapes of the spectral traces, including highly curved spectral traces in order -1 for NIRISS.

This comment explains the specific problem that is solved here.

Since I was working on understanding the WCS better, I also went ahead and updated the testing suite to mock the WCSs instead of getting them from file; there are therefore a few small changes to tests that aren't strictly related to the code changes.

Tasks

  • If you have a specific reviewer in mind, tag them.
  • add a build milestone, i.e. Build 12.0 (use the latest build if not sure)
  • Does this PR change user-facing code / API? (if not, label with no-changelog-entry-needed)
    • write news fragment(s) in changes/: echo "changed something" > changes/<PR#>.<changetype>.rst (see changelog readme for instructions)
    • update or add relevant tests
    • update relevant docstrings and / or docs/ page
    • start a regression test and include a link to the running job (click here for instructions)
      • Do truth files need to be updated ("okified")?
        • after the reviewer has approved these changes, run okify_regtests to update the truth files
  • if a JIRA ticket exists, make sure it is resolved properly

@emolter
Copy link
Collaborator Author

emolter commented Aug 7, 2025

initial round of regtests to see if the changes to the WCS in extract_2d break anything: https://github.com/spacetelescope/RegressionTests/actions/runs/16811629854

@emolter emolter added this to the Build 12.1 milestone Aug 7, 2025
@codecov
Copy link

codecov bot commented Aug 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.54%. Comparing base (6f198d4) to head (5e5d8fe).
⚠️ Report is 223 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9728      +/-   ##
==========================================
- Coverage   82.54%   82.54%   -0.01%     
==========================================
  Files         366      366              
  Lines       37248    37246       -2     
==========================================
- Hits        30748    30745       -3     
- Misses       6500     6501       +1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@emolter
Copy link
Collaborator Author

emolter commented Aug 7, 2025

new regtests after fixing small issue with old-style WCS transforms:
https://github.com/spacetelescope/RegressionTests/actions/runs/16813664328

The failures of the wfss_contam regtests are expected.

@emolter emolter marked this pull request as ready for review August 8, 2025 02:09
@emolter emolter requested review from a team as code owners August 8, 2025 02:09
@emolter emolter requested a review from nden August 8, 2025 02:09
Copy link
Collaborator

@melanieclarke melanieclarke left a comment

Choose a reason for hiding this comment

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

The general approach for the WCS looks good to me, and the code updates look reasonable at a surface level. I'd like @tapastro to review for a more WFSS-knowledgeable perspective, though.

Are there docs on the NIRISS WCS anywhere that should be updated for the new intermediate frame?

@emolter
Copy link
Collaborator Author

emolter commented Aug 8, 2025

I missed Nadia's comment that she would like to see an in-line comment about why there's a new frame added, so I will update that. I don't see anything in the readthedocs of assign_wcs or extract_2d that's incorrect now. Is there a place where we specifically document what the WCS pipelines look like for certain modes?

Maybe I could just add one sentence to the docstring of extract_grism_objects?

@melanieclarke
Copy link
Collaborator

Is there a place where we specifically document what the WCS pipelines look like for certain modes?

I don't think so. There's some information in the assign_wcs docs with varying levels of detail for some modes, but it would be nice if we had a separate page to address all the WCS pipelines, since it's complicated and important. Perhaps we could add it as part of addressing JP-3959?

Maybe I could just add one sentence to the docstring of extract_grism_objects?

Better than nothing!

@emolter
Copy link
Collaborator Author

emolter commented Aug 8, 2025

Let me know how 8869fc5 looks.

@emolter
Copy link
Collaborator Author

emolter commented Aug 19, 2025

@tapastro I got some feedback from @gnoir0t on the JIRA ticket that he tested this and it seems to resolve issues with the order -1 and order +1 trace shapes for NIRISS. Along with my conversations with @NorPirzkal I think this has now been tested pretty well for both instruments and we can move ahead with the code review and try to get it merged. (of course this is probably the last message I'll send before vacation so take your time)

@emolter
Copy link
Collaborator Author

emolter commented Sep 2, 2025

@tapastro @melanieclarke let me know how this looking from the code side. The INS teams are happy with it at this stage

Copy link
Contributor

@tapastro tapastro left a comment

Choose a reason for hiding this comment

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

Code looks good, documentation looks good.

Agreed that our WCS objects should probably be better documented in a global sense, and describing the new frame/transform would go there, once the pages are built.

@tapastro tapastro merged commit b770c57 into spacetelescope:main Sep 2, 2025
28 checks passed
@emolter emolter deleted the JP-4070-standalone branch September 2, 2025 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WFSS contamination produces curved -1 order traces

4 participants