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

AL-875: Add memory saving options to compute_weight_threshold sigma_clip call #312

Merged
merged 4 commits into from
Oct 30, 2024

Conversation

emolter
Copy link
Collaborator

@emolter emolter commented Oct 18, 2024

Resolves AL-875

This PR adds memory-saving options to a call to astropy sigma clip within compute_weight_threshold in an attempt to decrease the overall memory usage of outlier detection step (see flamegraphs on JP-3685), which cause that function to modify the input array in-place instead of copying it and allocating extra arrays for masks. Since the output sigma-clipped array is immediately collapsed into its mean, there is no need to retain it as a masked array and the behavior is unchanged.

Note that the "masked=False" option to sigma_clip does not affect that function's processing of input masked arrays, it only specifies whether the output is a masked array with clipped pixels masked, or a simple np.array with clipped pixels removed.

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 regression tests with this branch installed ("git+https://github.com/<fork>/stcal@<branch>")
news fragment change types...
  • changes/<PR#>.apichange.rst: change to public API
  • changes/<PR#>.bugfix.rst: fixes an issue
  • changes/<PR#>.general.rst: infrastructure or miscellaneous change

Copy link

codecov bot commented Oct 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.35%. Comparing base (60bd3b8) to head (22252ff).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #312      +/-   ##
==========================================
+ Coverage   86.21%   86.35%   +0.14%     
==========================================
  Files          47       49       +2     
  Lines        8812     8905      +93     
==========================================
+ Hits         7597     7690      +93     
  Misses       1215     1215              

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

@emolter
Copy link
Collaborator Author

emolter commented Oct 18, 2024

I'm pretty confident this will not change anything downstream, as the unit tests for the changed function appear to be relatively robust, but I started some downstream JWST regression tests here anyway

edit: these failures are unrelated

@emolter emolter marked this pull request as ready for review October 18, 2024 19:27
@emolter emolter requested a review from a team as a code owner October 18, 2024 19:27
@emolter emolter requested a review from tapastro October 30, 2024 14:37
Copy link
Collaborator

@mairanteodoro mairanteodoro 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 to me!

@emolter emolter merged commit 5299646 into spacetelescope:main Oct 30, 2024
26 checks passed
@emolter emolter deleted the AL-875 branch October 30, 2024 16:04
@braingram braingram mentioned this pull request Nov 14, 2024
7 tasks
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.

3 participants