Skip to content

WIP JP-4242: Extend trace model to NIRSpec and MIRI slit and slitless modes#10264

Draft
melanieclarke wants to merge 23 commits into
spacetelescope:mainfrom
melanieclarke:jp-4242
Draft

WIP JP-4242: Extend trace model to NIRSpec and MIRI slit and slitless modes#10264
melanieclarke wants to merge 23 commits into
spacetelescope:mainfrom
melanieclarke:jp-4242

Conversation

@melanieclarke
Copy link
Copy Markdown
Collaborator

@melanieclarke melanieclarke commented Feb 17, 2026

Resolves JP-4242

Adds support for NIRSpec MOS, FS, and BOTS modes as well as MIRI LRS slit and slitless modes to the adaptive_trace_model step. Updates resample_spec to allow for oversampled input data.

To use resample_spec to re-downsample the oversampled input, specify the inverse of the oversample factor as the pixel_scale_ratio. For example, use --steps.adaptive_trace_model.oversample=2 with --steps.resample_spec.pixel_scale_ratio=0.5.

Needs stdatamodels changes: spacetelescope/stdatamodels#697

Notes:

  • NIRCam and NIRISS spectral modes are not yet supported. If desired, we can look into adding them in the future.
  • MIRI and NIRSpec TSO modes are supported. For those modes, oversampling is disabled and the trace model is fit to the median image across integrations. For pixel_replace purposes, the 2D trace model might need to be scaled to each integration somehow.
  • Parameters for fitting are tweaked for every mode. The number of spline breakpoints and minimum number of points necessary to fit the data is computed dynamically for NIRSpec MOS and FS, since slit sizes vary widely.
  • The fit_threshold has a different meaning when we're fitting one slit at a time: it uses the S/N within the slit to make the decision. For IFU, it still compares the mean for the slice to the overall mean for the image.

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)
      • if your change breaks step-level or public API (as defined in the docs), also add a changes/<PR#>.breaking.rst news fragment
    • 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

@melanieclarke melanieclarke changed the title JP-4242: Extend trace model to NIRSpec and MIRI slit and slitless modes WIP JP-4242: Extend trace model to NIRSpec and MIRI slit and slitless modes Feb 17, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.47%. Comparing base (a3708db) to head (0bc4b55).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10264      +/-   ##
==========================================
+ Coverage   86.38%   86.47%   +0.08%     
==========================================
  Files         373      373              
  Lines       40068    40260     +192     
==========================================
+ Hits        34614    34816     +202     
+ Misses       5454     5444      -10     

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

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.

1 participant