8000 JP-2326: Fixed incorrect slope calculation by kmacdonald-stsci · Pull Request #68 · spacetelescope/stcal · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 8 commits into from
Dec 7, 2021

Conversation

kmacdonald-stsci
Copy link
Collaborator

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 only JUMP_DET.

Two tests have been added to ramp fitting unit tests to test the above conditions.

#67

@codecov
Copy link
codecov bot commented Dec 3, 2021

Codecov Report

Merging #68 (76274a9) into main (ad04646) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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              
Impacted Files Coverage Δ
src/stcal/ramp_fitting/ols_fit.py 93.57% <100.00%> (+0.04%) ⬆️

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 ad04646...76274a9. 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, 2 minor points.

@@ -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
Copy link
Contributor

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.

10000
Copy link
Collaborator Author

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.

Copy link
Contributor

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,
Copy link
Contributor

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 ?

Copy link
Collaborator Author
@kmacdonald-stsci kmacdonald-stsci Dec 3, 2021

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.

Copy link
Contributor

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.

@@ -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
Copy link
Contributor

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,
Copy link
Contributor

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.

@nden nden merged commit 9f7cdf0 into spacetelescope:main Dec 7, 2021
@nden
Copy link
Collaborator
nden commented Dec 7, 2021

@kmacdonald-stsci Don't forget to enter a log entry in the jwst CHANGES file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0