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-479: Preparing ramp fit code for removal from JWST and moved to STCAL #6010

Merged
merged 25 commits into from
May 11, 2021

Conversation

kmacdonald-stsci
Copy link
Contributor

@kmacdonald-stsci kmacdonald-stsci commented May 5, 2021

Closes #

Resolves JP-

Description

This PR addresses preparing JWST ramp fit to be moved to STCAL. JWST dependencies have been almost entirely eliminated. In particular, data models are no longer returned from ramp_fit. Tuples of arrays that can easily be used to create data models in step code are now used. The only JWST dependencies that still exist are DQ flags. I have structured the code so that this dependency can easily be removed. The only other dependency that will need to change are path dependencies. I have included path dependency changes in this code as comments.

GLS and multiprocessing code have been commented out as not needed for the moment.

With these changes, all ramp fitting unit tests pass, as well as all regression tests, except for a known failure related to jwst/regtest/test_nirspec_verify.py::test_verify_detector1[rate]. A small number of pixels fail, but they are the same failures that currently fail in master.

Checklist

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

…than data models. Changed the standard ramp fit tests to match this input.
… simple numpy arrays. Removed reference to jwst.reffile_utils from ramp fit processing code and moved it to ramp fit step code.
…ple of arrays. All tests and regression tests have passed.
…l references to datamodels can now be removed. All tests, including regression tests, pass.
@kmacdonald-stsci kmacdonald-stsci changed the title AL-479 AL-479: Preparing ramp fit code for removal from JWST and moved to STCAL May 5, 2021
@codecov
Copy link

codecov bot commented May 5, 2021

Codecov Report

Merging #6010 (5e97782) into master (14749b0) will decrease coverage by 0.32%.
The diff coverage is 90.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6010      +/-   ##
==========================================
- Coverage   77.91%   77.58%   -0.33%     
==========================================
  Files         404      404              
  Lines       35418    37227    +1809     
==========================================
+ Hits        27595    28882    +1287     
- Misses       7823     8345     +522     
Flag Coverage Δ *Carryforward flag
nightly 77.91% <86.20%> (ø) Carriedforward from 2202337
unit 57.04% <92.00%> (+0.75%) ⬆️

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

Impacted Files Coverage Δ
jwst/ramp_fitting/ols_fit.py 89.71% <78.94%> (+5.67%) ⬆️
jwst/ramp_fitting/ramp_fit_step.py 90.59% <90.69%> (+0.12%) ⬆️
jwst/ramp_fitting/utils.py 92.40% <97.43%> (-1.85%) ⬇️
jwst/ramp_fitting/gls_fit.py 59.68% <100.00%> (ø)
jwst/ramp_fitting/ramp_fit.py 100.00% <100.00%> (ø)
jwst/pipeline/calwebb_spec2.py 77.61% <0.00%> (-18.43%) ⬇️
jwst/cube_build/ifu_cube.py 57.31% <0.00%> (-14.22%) ⬇️
jwst/cube_build/cube_build_wcs_util.py 68.78% <0.00%> (-6.22%) ⬇️
jwst/cube_build/cube_build_step.py 63.56% <0.00%> (-2.01%) ⬇️
... and 8 more

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 14749b0...5e97782. Read the comment docs.

Copy link
Contributor

@dmggh dmggh 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 so far. Yes, I see that, as you wrote in the description, you have modified 'almost' all of the JWST code (that will be moved to STCAL-ols_fit.py, ramp_fit.py, utils.py ) involving data models to instead use tuples. Some of the functions within these modules that call other functions within these modules still use JWST data models - which I think is what you meant by 'almost'. These data models will also be replaced by tuples, right ?

@kmacdonald-stsci
Copy link
Contributor Author

The model parameter in ramp_fit is assumed to be a data model, specifically a JWST RampModel like data model. It is expected to have certain features, like the data, dq, etc. arrays, as well as the meta object. These variables and variable names are expected to be the same across pipelines.

@nden
Copy link
Collaborator

nden commented May 10, 2021

@dmggh @kmacdonald-stsci Does this need more work or is it ready for final review?

@kmacdonald-stsci
Copy link
Contributor Author

This is ready for final review.

Copy link
Contributor

@dmggh dmggh left a comment

Choose a reason for hiding this comment

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

Aside from the datamodels code you have noted, it looks like the ramp_fit code is ready to be moved from JWST to STCAL.

Copy link
Collaborator

@jdavies-st jdavies-st 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. Just some minor comments below. 👍

Comment on lines 10 to 14
@pytest.fixture(scope="module")
def generate_miri_reffiles(tmpdir_factory):
gainfile = str(tmpdir_factory.mktemp("data").join("gain.fits"))
readnoisefile = str(tmpdir_factory.mktemp("data").join('readnoise.fits'))

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason to have tmpdir_factory here and have it scoped to module? This fixture doesn't write anything out. The mock reffiles are just returned in memory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The noise models are getting written to the temp directory. Only the file names are being returned, not the reference to the models in memory.

@jdavies-st jdavies-st added this to the Build 7.8 milestone May 11, 2021
@jdavies-st
Copy link
Collaborator

This looks good. Ready to merge. Thanks!

@jdavies-st jdavies-st merged commit 5a9aaf8 into spacetelescope:master May 11, 2021
@kmacdonald-stsci kmacdonald-stsci deleted the jwst_rem_dep branch May 12, 2021 12:33
jdavies-st added a commit to jdavies-st/jwst that referenced this pull request Jun 4, 2021
jdavies-st added a commit to jdavies-st/jwst that referenced this pull request Jun 7, 2021
jdavies-st added a commit that referenced this pull request Jun 7, 2021
* Revert "AL-479: Move ramp fit code from JWST to STCAL.  (#6023)"

This reverts commit 85feb11.

* Revert "AL-479: Preparing ramp fit code for removal from JWST and moved to STCAL (#6010)"

This reverts commit 5a9aaf8.

* Turn on ramp_fit multiprocessing tests

* Update CHANGES.rst
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.

4 participants