Skip to content

Conversation

@melanieclarke
Copy link
Contributor

@melanieclarke melanieclarke commented Aug 12, 2025

Partially resolves JP-3887

Corresponding jwst PR is: spacetelescope/jwst#9736

This PR adds time dependence coefficient tables to all photom models, except MirMrsPhotomModel, which already has time coefficient extensions that need a different form from the others. MirImgPhotomModel also had a time coefficients table, but needs to move to the new format to allow more flexibility.

3 optional tables are added to each model: timecoeff_linear, timecoeff_exponential, and timecoeff_powerlaw. Any, all, or none may be present, and the photom code will compose the correction from the appropriate functional forms.

I also added some validation code for all photom models (except MIRI MRS) to verify that if present, the timecoeff extensions match the phot_table rows.

Tasks

  • update or add relevant tests
  • update relevant docstrings and / or docs/ page
  • Does this PR change any API used downstream? (if not, label with no-changelog-entry-needed)
    • write news fragment(s) in changes/: echo "changed something" > changes/<PR#>.<changetype>.rst (see below for change types)
    • run jwst regression tests with this branch installed ("git+https://github.com/<fork>/stdatamodels@<branch>")
news fragment change types...
  • changes/<PR#>.feature.rst: new feature
  • changes/<PR#>.bugfix.rst: fixes an issue
  • changes/<PR#>.doc.rst: documentation change
  • changes/<PR#>.removal.rst: deprecation or removal of public API
  • changes/<PR#>.misc.rst: infrastructure or miscellaneous change

@melanieclarke melanieclarke changed the title Add photometric time dependence tables JP-3887: Add photometric time dependence tables Aug 12, 2025
@codecov
Copy link

codecov bot commented Aug 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.14%. Comparing base (76e5e14) to head (1ab79ec).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #555      +/-   ##
==========================================
+ Coverage   90.10%   90.14%   +0.04%     
==========================================
  Files         110      110              
  Lines        5317     5339      +22     
==========================================
+ Hits         4791     4813      +22     
  Misses        526      526              

☔ 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
Contributor Author

melanieclarke commented Aug 12, 2025

Regression tests here with spacetelescope/jwst#9736:
https://github.com/spacetelescope/RegressionTests/actions/runs/16892547832

Tests show one very small change to the background level value for one input file. This appears to be precision related, from minor changes to the way the time dependence is calculated for MIRI imaging photom corrections: the background level fit in skymatch is sensitive to very small changes in the data. There is otherwise no impact to the output data.

Downstream jwst tests are failing because the tests attempt to access the old "timecoeff" extension directly in a MIRI imaging photom model, so merging this PR will need to be coordinated with the jwst PR.

@melanieclarke
Copy link
Contributor Author

Rerunning regression tests after adding MIRI MRS changes:
https://github.com/spacetelescope/RegressionTests/actions/runs/17137431976

Copy link
Contributor

@emolter emolter left a comment

Choose a reason for hiding this comment

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

All my questions have been answered but I'd feel more comfortable if this had a second reviewer. I guess that'd be @tapastro in this case

Copy link
Collaborator

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

Looks good, with one suggestion on validation.

timecoeff = ["timecoeff_linear", "timecoeff_exponential", "timecoeff_powerlaw"]
for extension in timecoeff:
message = f"Model.phot_table and Model.{extension} do not match"
if self.hasattr("phot_table") and self.hasattr(extension):
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is probably an unlikely case, but I think a model with no phot_table extension would pass validation due to it failing this if statement. If we're going to attempt validation, it probably needs an explicit check for the phot_table before this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I can add that. I thought about adding that check and decided to allow an empty photom file, since only the check on the time coeff tables was requested. But you're right that it's definitely not a useful photom file without the phot_table, so we might as well check for it while we're validating.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See 1ab79ec

Copy link
Collaborator

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

👍

@melanieclarke
Copy link
Contributor Author

Thanks for reviewing!

This PR will need to be coordinated with merging spacetelescope/jwst#9736. When that one is approved, I will:

  • bypass requirements and merge this PR
  • update pyproject.toml in the jwst PR to point to stdatamodels main
  • merge the jwst PR

@melanieclarke melanieclarke merged commit 7e5165a into spacetelescope:main Sep 9, 2025
15 of 17 checks passed
@melanieclarke melanieclarke deleted the jp-3887 branch September 9, 2025 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants