Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch exposure pipeline to use ModelLibrary instead of a list of models #1525

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

braingram
Copy link
Collaborator

@braingram braingram commented Nov 15, 2024

This PR updates the exposure pipeline to use a ModelLibrary instead of a list of models. This allows:

  • removing the custom asn parsing in the pipeline
  • the tweakreg (and other step) cal_step status to be correctly marked by stpipe when steps are skipped

Regtests: https://github.com/spacetelescope/RegressionTests/actions/runs/11861738024
show 2 expected failures:

FAILED romancal/regtest/test_wfi_image_pipeline.py::test_processing_pipeline_all_saturated - AssertionError: 
  Diff report for:
      result file: /runner/_work/_temp/pytest_basetemp/popen-gw2/test_processing_pipeline_all_s0/r0000101001001001001_0001_wfi01_ALL_SATURATED_cal.asdf
          model type: RampModel
      truth file: /runner/_work/_temp/pytest_basetemp/popen-gw2/test_processing_pipeline_all_s0/truth/r0000101001001001001_0001_wfi01_ALL_SATURATED_cal.asdf
          model type: RampModel
  
  {'dictionary_item_added': ["root['roman']['meta']['asn']", "root['roman']['meta']['exptype']", "root['roman']['meta']['group_id']"]}
assert False
 +  where False = <romancal.regtest.regtestdata.DiffResult object at 0x7f3c25b39310>.identical
FAILED romancal/regtest/test_wfi_image_pipeline.py::test_pipeline_suffix - AssertionError: 
  Diff report for:
      result file: /runner/_work/_temp/pytest_basetemp/popen-gw2/test_pipeline_suffix0/r0000101001001001001_0001_wfi01_star.asdf
          model type: ImageModel
      truth file: /runner/_work/_temp/pytest_basetemp/popen-gw2/test_pipeline_suffix0/truth/r0000101001001001001_0001_wfi01_star.asdf
          model type: ImageModel
  
  {'dictionary_item_added': ["root['roman']['meta']['asn']", "root['roman']['meta']['exptype']", "root['roman']['meta']['group_id']"],
   'values_changed': {"root['roman']['meta']['cal_step']['tweakreg']": {'new_value': 'SKIPPED',
                                                                        'old_value': 'INCOMPLETE'}}}
assert False

The first is a byproduct of using ModelLibrary. The output files for elp now contain asn information.
The second shows that meta.cal_step.tweakreg is being correctly marked as skipped for test_pipeline_suffix.

Tasks

  • request a review from someone specific, to avoid making the maintainers review every PR
  • add a build milestone, i.e. 24Q4_B15 (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 below for change types)
    • 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
news fragment change types...
  • changes/<PR#>.general.rst: infrastructure or miscellaneous change
  • changes/<PR#>.docs.rst
  • changes/<PR#>.stpipe.rst
  • changes/<PR#>.associations.rst
  • changes/<PR#>.scripts.rst
  • changes/<PR#>.mosaic_pipeline.rst
  • changes/<PR#>.patch_match.rst

steps

  • changes/<PR#>.dq_init.rst
  • changes/<PR#>.saturation.rst
  • changes/<PR#>.refpix.rst
  • changes/<PR#>.linearity.rst
  • changes/<PR#>.dark_current.rst
  • changes/<PR#>.jump_detection.rst
  • changes/<PR#>.ramp_fitting.rst
  • changes/<PR#>.assign_wcs.rst
  • changes/<PR#>.flatfield.rst
  • changes/<PR#>.photom.rst
  • changes/<PR#>.flux.rst
  • changes/<PR#>.source_detection.rst
  • changes/<PR#>.tweakreg.rst
  • changes/<PR#>.skymatch.rst
  • changes/<PR#>.outlier_detection.rst
  • changes/<PR#>.resample.rst
  • changes/<PR#>.source_catalog.rst

@braingram braingram changed the title Switch exposure pipeline to use ModelLibrary instead of a list of models WIP: Switch exposure pipeline to use ModelLibrary instead of a list of models Nov 15, 2024
Copy link

codecov bot commented Nov 15, 2024

Codecov Report

Attention: Patch coverage is 2.94118% with 33 lines in your changes missing coverage. Please review.

Project coverage is 77.00%. Comparing base (281aa55) to head (b12c774).

Files with missing lines Patch % Lines
romancal/pipeline/exposure_pipeline.py 2.94% 33 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1525      +/-   ##
==========================================
+ Coverage   76.68%   77.00%   +0.31%     
==========================================
  Files         120      120              
  Lines        7832     7796      -36     
==========================================
- Hits         6006     6003       -3     
+ Misses       1826     1793      -33     

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


🚨 Try these New Features:

@@ -300,5 +300,5 @@ def test_pipeline_suffix(rtdata, ignore_asdf_paths):
assert model.meta.cal_step.flat_field == "COMPLETE"
assert model.meta.cal_step.photom == "COMPLETE"
assert model.meta.cal_step.source_detection == "COMPLETE"
assert model.meta.cal_step.tweakreg == "INCOMPLETE"
assert model.meta.cal_step.tweakreg == "SKIPPED"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This assert isn't currently reached in the regtests due to the compare_against_truth failing:

FAILED romancal/regtest/test_wfi_image_pipeline.py::test_pipeline_suffix - AssertionError: 
  Diff report for:
      result file: /runner/_work/_temp/pytest_basetemp/popen-gw2/test_pipeline_suffix0/r0000101001001001001_0001_wfi01_star.asdf
          model type: ImageModel
      truth file: /runner/_work/_temp/pytest_basetemp/popen-gw2/test_pipeline_suffix0/truth/r0000101001001001001_0001_wfi01_star.asdf
          model type: ImageModel
  
  {'dictionary_item_added': ["root['roman']['meta']['asn']", "root['roman']['meta']['exptype']", "root['roman']['meta']['group_id']"],
   'values_changed': {"root['roman']['meta']['cal_step']['tweakreg']": {'new_value': 'SKIPPED',
                                                                        'old_value': 'INCOMPLETE'}}}

But when 'okified' this change to the assert will be needed.

@braingram braingram changed the title WIP: Switch exposure pipeline to use ModelLibrary instead of a list of models Switch exposure pipeline to use ModelLibrary instead of a list of models Nov 18, 2024
@github-actions github-actions bot added the dependencies Pull requests that update a dependency file label Nov 18, 2024
@braingram braingram marked this pull request as ready for review November 18, 2024 16:28
@braingram braingram requested a review from a team as a code owner November 18, 2024 16:28
@schlafly
Copy link
Collaborator

Thanks. This looks good.

You also deleted some orphaned fully saturated exposure handling here. I think following your investigation we probably do want to keep and start using that code again, rather than deleting it?
#1523
Maybe just to say that deleting create_fully_saturated_zeroed_image needn't be part of this PR.

@ddavis-stsci , this refactors some of the pipeline handling to use ModelLibrary more uniformly, so you may want to weigh in here.

@braingram
Copy link
Collaborator Author

Converted to draft to attempt to also address #1523 and some other elp cleanup.

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.

2 participants