Skip to content

Commit

Permalink
Bitwise or for combining flags
Browse files Browse the repository at this point in the history
  • Loading branch information
melanieclarke committed Dec 13, 2024
1 parent 6d2f834 commit 9f590c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/stcal/jump/twopoint_difference.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def find_crs(
return gdq, row_below_gdq, row_above_gdq, 0, dummy
else:
# set 'saturated' or 'do not use' pixels to nan in data
dat[np.where(np.bitwise_and(gdq, dnu_flag + sat_flag))] = np.nan
dat[np.where(np.bitwise_and(gdq, dnu_flag | sat_flag))] = np.nan

# calculate the differences between adjacent groups (first diffs)
# use mask on data, so the results will have sat/donotuse groups masked
Expand Down Expand Up @@ -210,7 +210,7 @@ def find_crs(
jump_mask = np.logical_and(clipped_diffs.mask, np.logical_not(first_diffs_masked.mask))
jump_mask[np.bitwise_and(jump_mask, gdq[:, 1:, :, :] == sat_flag)] = False
jump_mask[np.bitwise_and(jump_mask, gdq[:, 1:, :, :] == dnu_flag)] = False
jump_mask[np.bitwise_and(jump_mask, gdq[:, 1:, :, :] == (dnu_flag + sat_flag))] = False
jump_mask[np.bitwise_and(jump_mask, gdq[:, 1:, :, :] == (dnu_flag | sat_flag))] = False

Check warning on line 213 in src/stcal/jump/twopoint_difference.py

View check run for this annotation

Codecov / codecov/patch

src/stcal/jump/twopoint_difference.py#L213

Added line #L213 was not covered by tests
gdq[:, 1:, :, :] = np.bitwise_or(gdq[:, 1:, :, :], jump_mask *
np.uint8(dqflags["JUMP_DET"]))
# if grp is all jump set to do not use
Expand Down

0 comments on commit 9f590c4

Please sign in to comment.