Skip to content

Conversation

@melanieclarke
Copy link
Collaborator

@melanieclarke melanieclarke commented Aug 27, 2025

Resolves JP-4095

Fix a missing velocity correction in the inverse transform for NIRSpec IFU. This seems to fix a round trip error of up to ~0.5 pixel. Example case: jw01251004001_03107_00001_nrs2_rate.fits, with velosys = 20 km/s.

I checked the other modes for similar errors, and found that NIRSpec MOS and FS needs the same handling. I'm not sure if we've noted similar round trip errors for these modes, but checking MOS regression test data jw01345066001_05101_00001_nrs1_rate.fits with velosys -15 km/s, it looks like it improves round trip error from ~.08 pixel to ~.001 pixel in a quick spot check on slit 35.

For the other instruments, where the velocity_correction is used, they appear to be propagating it to the inverse correctly. I did note what looks like a typo in the NIRISS SOSS handling for order 2 and 3 so I fixed it here, but I can move to another PR if it needs separate review.

Edit: typo fix for NIRISS SOSS handling moved to #9747

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

@codecov
Copy link

codecov bot commented Aug 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.15%. Comparing base (6007f30) to head (f8be2e2).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9783   +/-   ##
=======================================
  Coverage   84.14%   84.15%           
=======================================
  Files         366      366           
  Lines       37790    37792    +2     
=======================================
+ Hits        31799    31804    +5     
+ Misses       5991     5988    -3     

☔ 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.

@melanieclarke
Copy link
Collaborator Author

melanieclarke commented Aug 27, 2025

Regression tests:
https://github.com/spacetelescope/RegressionTests/actions/runs/17276924791

It looks like these changes have a minor impact on NIRSpec MOS and IFU products for spec2. The edges of the valid IFU REGIONS change a little bit, I assume because the wavelength inversion has changed a little. For MOS and IFU, MSA flagging is impacted, which modified the DQ plane. The only SCI data affected is when nsclean is run, which I think makes sense, since the masked science regions are changing slightly.

NIRISS products do not seem to be impacted by the typo fix.

@melanieclarke melanieclarke added this to the Build 12.1 milestone Aug 27, 2025
@melanieclarke melanieclarke force-pushed the jp-4095 branch 2 times, most recently from f3eedbf to 0ce3e1f Compare September 2, 2025 17:39
Copy link
Collaborator

@nden nden left a comment

Choose a reason for hiding this comment

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

Mea culpa!
LGTM.

@melanieclarke melanieclarke marked this pull request as ready for review September 15, 2025 17:15
@melanieclarke melanieclarke requested review from a team as code owners September 15, 2025 17:15
@melanieclarke
Copy link
Collaborator Author

NIRSpec is happy with the testing they have done, so I'm moving this out of draft.

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.

New RT set here: https://github.com/spacetelescope/RegressionTests/actions/runs/17835658949

Not sure if outputs have changed to make okifying those more robust, and the MIRI failures don't help with clarity. Otherwise, LGTM

@melanieclarke
Copy link
Collaborator Author

Not sure if outputs have changed to make okifying those more robust, and the MIRI failures don't help with clarity. Otherwise, LGTM

Thanks @tapastro - I can okify from the new one, skipping the MIRI failures. Unless you'd rather wait to merge until RT are clear again?

@tapastro
Copy link
Contributor

Not sure if outputs have changed to make okifying those more robust, and the MIRI failures don't help with clarity. Otherwise, LGTM

Thanks @tapastro - I can okify from the new one, skipping the MIRI failures. Unless you'd rather wait to merge until RT are clear again?

I'm fine with merging and ok'ing the non-MIRI failures.

@melanieclarke melanieclarke merged commit 32b93f5 into spacetelescope:main Sep 18, 2025
37 of 38 checks passed
@melanieclarke melanieclarke deleted the jp-4095 branch September 18, 2025 19:39
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.

4 participants