-
Notifications
You must be signed in to change notification settings - Fork 32
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
JP-1950: Bug fix for DQ flags #12
Conversation
…uppression. Also, made changes to fix the bug in JP-1950, where 'shifting' was happening twice.
src/stcal/ramp_fitting/ols_fit.py
Outdated
@@ -1597,10 +1597,8 @@ def calc_slope(data_sect, gdq_sect, frame_time, opt_res, save_opt, rn_sect, | |||
err_2d_array = data_sect[0, :, :] * frame_time | |||
|
|||
# Suppress, then re-enable, harmless arithmetic warnings | |||
''' |
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.
You could use Numpy's errstate
context manager here:
with np.errstate(divide="ignore", invalid="ignore"):
err_2d_array[err_2d_array < 0] = 0
But that's just a more concise way of doing the same thing.
The current error/warning global config for numpy can be grabbed via np.geterr()
.
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.
The question is why is e.g. divide by zero
filtered out. Is there a chance it's going to be raised?
But since this is not related to the current bug being fixed I suggest if necessary it can be changed in another PR.
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 removed the code changes not directly related to the bug in JP-1950.
👍 merging after a change log is added. |
* Updating test cases for the bug fix done in spacetelescope/stcal#12 * bump install_requires and requirements-sdp.txt for stcal 0.2.1
The primary purpose of this PR is to fix the computation of the median of the first differences of a ramp. Because there is one less difference than there are groups a "shift" is needed to make sure the correct data quality flag is applied. This "shifting" was incorrectly done twice, when it should have only been done once.
Fixes JP-1950
Fixes spacetelescope/jwst#3879