Skip to content

Conversation

@emolter
Copy link
Collaborator

@emolter emolter commented Oct 13, 2025

Resolves JP-4151

Closes #9910 along with spacetelescope/stdatamodels#602

This PR adds an s_region attribute to the output x1dints files coming from calwebb_tso3. Hopefully this allows these products to be found in MAST queries by target ID or location.

This PR handles this in the very simplest way, by just updating the s_region of the output to be the same as the s_region of the first input file. I don't know of any tso observations where input files should have different sky footprints, but hopefully the code will fail gracefully in that case.

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 Oct 13, 2025

https://github.com/spacetelescope/RegressionTests/actions/runs/18472624596 pointing to stdatamodels spacetelescope/stdatamodels#602

All changes are expected: S_REGION header keywords are added to TSO3 x1dints products.

@emolter emolter requested a review from melanieclarke October 13, 2025 16:28
@codecov
Copy link

codecov bot commented Oct 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.47%. Comparing base (38c180a) to head (2dc5920).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9927      +/-   ##
==========================================
+ Coverage   85.45%   85.47%   +0.01%     
==========================================
  Files         366      366              
  Lines       37845    37881      +36     
==========================================
+ Hits        32341    32377      +36     
  Misses       5504     5504              

☔ 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 emolter added this to the Build 12.3 milestone Oct 13, 2025
@emolter emolter marked this pull request as ready for review October 14, 2025 17:44
@emolter emolter requested review from a team as code owners October 14, 2025 17:44
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.

Looks good, thanks! Just a couple minor suggestions.

For the question about picking the first S_REGION - it looks to me like it might be technically possible to get an S_REGION that is not identical in the input calints files, since it is assigned from the WCS by exposure, in this function:

def compute_footprint_spectral(model):

Combining multiple spectral targets in tso3 wouldn't make sense though, so I would think that any input S_REGION should be close enough for the purpose. I suggest we move forward with this solution and revise later if we turn up significant exceptions.

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.

I tested locally on a NIRSpec BOTS association with multiple segments and NRS1 and 2 detectors (jw01118-o005_20250917t232840_tso3_00001_asn.json). For this association, all the input S_REGIONS are the same. The output x1dints file has 6 extensions, one for each of 3 segments and 2 detectors. The S_REGION is recorded only in the first spectrum, and matches the S_REGION from all the input files.

I know the choice to record in the first only is consistent with the WFSS implementation, but it still seems a bit unintuitive to me -- it would be more natural to record it in either the primary HDU, or else in every EXTRACT_1D extension. Perhaps we should file a follow up ticket to add S_REGION to all the x1d/x1dints extensions?

Either way, I think this PR is fine as is, and we can leave any further S_REGION improvements for the future.

Can you please re-run regression tests after the stdatamodels PR gets merged, just in case?

@emolter
Copy link
Collaborator Author

emolter commented Oct 23, 2025

Can do RE regtests.

I totally agree, it's not intuitive to me either. I don't recall exactly why the choice was made, besides that there's no SCI extension. But given that we're not directly calling the wcsinfo subschema, I don't see any issue with just storing it in the primary. To me, the primary header makes more sense because it's supposed to represent (at least for WFSS data) the total region over which sources were extracted. And plus then the same value wouldn't be stored hundreds of times.

But we can discuss on the ticket.

@emolter
Copy link
Collaborator Author

emolter commented Oct 23, 2025

https://github.com/spacetelescope/RegressionTests/actions/runs/18761792709

these all look as expected and are ready for okify

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.

Thanks for getting this fixed!

@melanieclarke melanieclarke merged commit 8069d54 into spacetelescope:main Oct 24, 2025
28 checks passed
@emolter emolter deleted the JP-4151 branch October 24, 2025 13:59
@emolter emolter removed this from the Build 12.3 milestone Oct 24, 2025
@emolter emolter added this to the Build 12.1.1 milestone Oct 24, 2025
@tapastro
Copy link
Contributor

@meeseeksdev backport to release/1.20.x

meeseeksmachine pushed a commit to meeseeksmachine/jwst that referenced this pull request Oct 28, 2025
tapastro pushed a commit to tapastro/jwst that referenced this pull request Oct 30, 2025
tapastro pushed a commit that referenced this pull request Oct 31, 2025
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.

No TSO L3 products in MAST JWST Search when object name specified

3 participants