-
Notifications
You must be signed in to change notification settings - Fork 33
JP-2326: Fixed incorrect slope calculation #68
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
Conversation
…of a segment.
Codecov Report
@@ Coverage Diff @@
## main #68 +/- ##
==========================================
+ Coverage 94.51% 94.53% +0.02%
==========================================
Files 14 14
Lines 1624 1630 +6
==========================================
+ Hits 1535 1541 +6
Misses 89 89
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, 2 minor points.
src/stcal/ramp_fitting/ols_fit.py
Outdated
@@ -1695,6 +1698,25 @@ def calc_slope(data_sect, gdq_sect, frame_time, opt_res, save_opt, rn_sect, | |||
|
|||
mask_2d[gdq_sect_r != 0] = False # RE-exclude bad group dq values | |||
|
|||
# Ensure that the first group to be fit is the cosmic-ray-affected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is a bit confusing, and could use a little clarification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the comment here. Please take a look at it to see if my edit makes it more clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good
@@ -290,6 +290,79 @@ def test_utils_dq_compress_final(): | |||
assert(not(dq[0, 2] & dqflags["DO_NOT_USE"])) | |||
|
|||
|
|||
def jp_2326_test_setup(): | |||
# Set up ramp data | |||
ramp = np.array([120.133545, 117.85222, 87.38832, 66.90588, 51.392555, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason a ramp with a negative slope is created ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of generating my own test data for the ramp, I used a ramp for a pixel that was failing in a regression test. I used the same science data, DQ data, etc., changing only groupdq[0, 1, 0, 0]
to be set to DO_NOT_USE
in one test and JUMP_DET
in the second test. The test with the group flagged as DO_NOT_USE
should not be used in calculations, while the one flagged as JUMP_DET
should.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I figured it was from a failing test.
src/stcal/ramp_fitting/ols_fit.py
Outdated
@@ -1695,6 +1698,25 @@ def calc_slope(data_sect, gdq_sect, frame_time, opt_res, save_opt, rn_sect, | |||
|
|||
mask_2d[gdq_sect_r != 0] = False # RE-exclude bad group dq values | |||
|
|||
# Ensure that the first group to be fit is the cosmic-ray-affected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good
@@ -290,6 +290,79 @@ def test_utils_dq_compress_final(): | |||
assert(not(dq[0, 2] & dqflags["DO_NOT_USE"])) | |||
|
|||
|
|||
def jp_2326_test_setup(): | |||
# Set up ramp data | |||
ramp = np.array([120.133545, 117.85222, 87.38832, 66.90588, 51.392555, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I figured it was from a failing test.
@kmacdonald-stsci Don't forget to enter a log entry in the jwst CHANGES file. |
When computing a segment for a ramp if a group exists just before the zeroth group of the current segment and it is flagged only
JUMP_DET
it should be added to the beginning of the ramp segment for computation. Previously any flagged groups got added back to the beginning of the ramp segment. The segment mask now excludes any group not flagged with onlyJUMP_DET
.Two tests have been added to ramp fitting unit tests to test the above conditions.
#67