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

JP-3730: Re-enable saving of blot models during outlier detection #8758

Merged
merged 6 commits into from
Sep 9, 2024

Conversation

emolter
Copy link
Collaborator

@emolter emolter commented Sep 5, 2024

Resolves JP-3730

Closes #8750

Recent work refactoring the memory management within the outlier detection step had disabled the creation of blot files as optional intermediate-stage outputs. This PR reverts this removal, allowing these blot models to be saved when save_intermediate_results is True.

Checklist for PR authors (skip items if you don't have permissions or they are not applicable)

  • added entry in CHANGES.rst within the relevant release section
  • updated or added relevant tests
  • updated relevant documentation
  • added relevant milestone
  • added relevant label(s)
  • ran regression tests, post a link to the Jenkins job below.
    How to run regression tests on a PR
  • All comments are resolved
  • Make sure the JIRA ticket is resolved properly

@emolter
Copy link
Collaborator Author

emolter commented Sep 5, 2024

Copy link

codecov bot commented Sep 5, 2024

Codecov Report

Attention: Patch coverage is 88.23529% with 2 lines in your changes missing coverage. Please review.

Project coverage is 60.84%. Comparing base (e16c058) to head (8350208).

Files with missing lines Patch % Lines
jwst/outlier_detection/spec.py 0.00% 1 Missing ⚠️
jwst/outlier_detection/utils.py 93.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8758      +/-   ##
==========================================
+ Coverage   60.83%   60.84%   +0.01%     
==========================================
  Files         373      373              
  Lines       38636    38650      +14     
==========================================
+ Hits        23503    23516      +13     
- Misses      15133    15134       +1     

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

@emolter
Copy link
Collaborator Author

emolter commented Sep 6, 2024

Regression test failures match the 4 failed tests from last night's run on main, so they aren't caused by this PR.

@emolter emolter marked this pull request as ready for review September 6, 2024 12:57
@emolter emolter requested a review from a team as a code owner September 6, 2024 12:57
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 think this looks right, but handling needs to be added to the spectral mode as well, since resampling is also done there. I can test with real data when that's done.

jwst/outlier_detection/imaging.py Outdated Show resolved Hide resolved
jwst/outlier_detection/utils.py Outdated Show resolved Hide resolved
jwst/outlier_detection/utils.py Outdated Show resolved Hide resolved
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.

These changes look good to me.

Testing on some spectral data I have around (jw02361-o010_20240207t162649_spec3_00001_asn.json), the blot files look like they are written out appropriately.

However, thinking about it some more, I think we should really just save the SCI array instead of copying the entire input model and setting DQ and ERR to zero. As is, the variance arrays are included but left unchanged, and there are several other unrelated arrays that don't need to be in the blot product (flatfield, pathloss, photom, etc.).

Can we change this to make the blot product closer to the median and outlier_s2d products, and just write out the SCI array?

@emolter
Copy link
Collaborator Author

emolter commented Sep 9, 2024

@melanieclarke the most recent change to the _make_blot_model() helper function should contain the change you suggest. I tested it on some imaging data- the only extensions are now PRIMARY, SCI, and ASDF, and the data look the same as they did before the change.

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.

Okay, everything looks good to me. Testing again on my spectral data set, only the sci array is written and metadata is updated, save location and file names look right. I also checked a random imaging data set from the regtest data and that looks right too. Thanks!

@melanieclarke melanieclarke merged commit 0e86465 into spacetelescope:master Sep 9, 2024
29 checks passed
@emolter emolter deleted the JP-3730 branch September 9, 2024 19:33
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.

Reenable creation of blot files
2 participants