8000 JP-2250: Refactor refpix IRS2 to reduce memory usage by hbushouse · Pull Request #6356 · spacetelescope/jwst · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

JP-2250: Refactor refpix IRS2 to reduce memory usage #6356

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

Merged
merged 2 commits into from
Sep 17, 2021

Conversation

hbushouse
Copy link
Collaborator
@hbushouse hbushouse commented Sep 16, 2021

Closes #6282

Resolves JP-2250

Description

This PR refactors the parts of the refpix step used to correct NIRSpec exposures using the IRS2 readout mode, in order to reduce the memory usage. The major change is to the subtract_reference function in irs2_subtract_reference.py to replace all of the repeated loops over "sectors" (regions of the data readout by the 4 different amps) with one big loop that computes and applies the correction to one "sector" at a time, so that you're not always carrying along the data for all 4 sectors all the time. Other more minor changes, such as moving the copy of input_model -> output_model to the end of the step, because only the SCI (data) array is needed for all of the computations, hence you're not carrying along 2 complete copies of the exposure for the entire duration, and making sure to explicitly delete the large objects as soon as they aren't needed anymore.

Also did some general reorganization and clean-up, just to try to make the code more readable and manageable in the future (such as splitting up the previous single monolithic subtract_reference function into several smaller pieces).

For the dataset that initially triggered JP-2250, which uses NINTS=1 and NGROUPS=200, the old version of the step hit a peak memory usage of ~65GB. The new version peaks at around 35GB. Still quite big, but it's a really big exposure!

Checklist

  • Tests
  • Documentation
  • Change log
  • Milestone
  • Label(s)

@hbushouse hbushouse added refpix IRS2 readout NIRSpec IRS2 readout mode labels Sep 16, 2021
@hbushouse hbushouse added this to the Build 7.9 milestone Sep 16, 2021
@codecov
Copy link
codecov bot commented Sep 16, 2021

Codecov Report

Merging #6356 (ae57c67) into master (725c86d) will decrease coverage by 0.27%.
The diff coverage is 63.90%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6356      +/-   ##
==========================================
- Coverage   77.68%   77.40%   -0.28%     
==========================================
  Files         409      409              
  Lines       35099    35274     +175     
==========================================
+ Hits        27265    27304      +39     
- Misses       7834     7970     +136     
Flag Coverage Δ *Carryforward flag
nightly 77.68% <93.57%> (ø) Carriedforward from da286fe
unit 56.11% <12.03%> (+<0.01%) ⬆️

*This pull request uses carry forward flags. Click here to find out more.

Impacted Files Coverage Δ
jwst/refpix/irs2_subtract_reference.py 58.63% <60.13%> (-25.00%) ⬇️
jwst/refpix/refpix_step.py 80.00% <100.00%> (+6.53%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 725c86d...ae57c67. Read the comment docs.

@hbushouse hbushouse merged commit 82d5766 into spacetelescope:master Sep 17, 2021
@hbushouse hbushouse deleted the jp2250 branch September 17, 2021 00:05
loicalbert pushed a commit to talensgj/jwst that referenced this pull request Nov 5, 2021
…6356)

* JP-2250: Refactor refpix IRS2 to reduce memory usage

* add change log entry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IRS2 readout NIRSpec IRS2 readout mode refpix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refpix step uses a LOT of memory for NRS IRS2 exposures
2 participants
0