Skip to content

Commit

Permalink
Reverting code that may not be necessary.
Browse files Browse the repository at this point in the history
  • Loading branch information
kmacdonald-stsci committed May 19, 2021
1 parent 19556f7 commit c254855
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/stcal/ramp_fitting/ols_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,8 @@ def ramp_fit_slopes(input_model, gain_2d, readnoise_2d, save_opt, weighting):
rhi = cubeshape[1]

# Skip data section if it is all NaNs
data_sect = np.float32(data[num_int, :, :, :])
# data_sect = np.float32(data[num_int, :, :, :])
data_sect = data[num_int, :, :, :]
if np.all(np.isnan(data_sect)):
log.error('Current data section is all nans, so not processing the section.')
continue
Expand Down Expand Up @@ -1597,8 +1598,10 @@ 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
'''
warnings.filterwarnings("ignore", ".*invalid value.*", RuntimeWarning)
warnings.filterwarnings("ignore", ".*divide by zero.*", RuntimeWarning)
'''
err_2d_array[err_2d_array < 0] = 0
warnings.resetwarnings()

Expand Down
3 changes: 3 additions & 0 deletions src/stcal/ramp_fitting/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1101,9 +1101,12 @@ def reset_bad_gain(pdq, gain):
for pixels in the gain array that are either non-positive or NaN., 2-D
flag
"""
'''
with warnings.catch_warnings():
warnings.filterwarnings("ignore", "invalid value.*", RuntimeWarning)
wh_g = np.where(gain <= 0.)
'''
wh_g = np.where(gain <= 0.)
if len(wh_g[0]) > 0:
pdq[wh_g] = np.bitwise_or(pdq[wh_g], NO_GAIN_VALUE)
pdq[wh_g] = np.bitwise_or(pdq[wh_g], DO_NOT_USE)
Expand Down

0 comments on commit c254855

Please sign in to comment.