Skip to content

Commit

Permalink
Merge branch 'main' into np_c_ext
Browse files Browse the repository at this point in the history
  • Loading branch information
hbushouse authored May 20, 2024
2 parents b476a50 + ccd93bb commit 9a44330
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ Changes to API
Bug Fixes
---------

jump
~~~~

- Catch some additional warnings about all-NaN slices. [#258]

ramp_fitting
~~~~~~~~~~~~

Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# Setup C module macros
define_macros = [("NUMPY", "1")]

Check warning on line 18 in setup.py

View check run for this annotation

Codecov / codecov/patch

setup.py#L18

Added line #L18 was not covered by tests

# importing these extension modules is tested in `.github/workflows/build.yml`;
# when adding new modules here, make sure to add them to the `test_command` entry there
extensions = [
Extension(
"stcal.ramp_fitting.ols_cas22._ramp",
Expand Down
2 changes: 1 addition & 1 deletion src/stcal/jump/jump.py
Original file line number Diff line number Diff line change
Expand Up @@ -973,13 +973,13 @@ def find_faint_extended(
all_ellipses = []

first_diffs_masked = np.ma.masked_array(first_diffs, mask=np.isnan(first_diffs))
warnings.filterwarnings("ignore")
if nints > minimum_sigclip_groups:
mean, median, stddev = stats.sigma_clipped_stats(first_diffs_masked, sigma=5, axis=0)
else:
median_diffs = np.nanmedian(first_diffs_masked, axis=(0, 1))
sigma = np.sqrt(np.abs(median_diffs) + read_noise_2 / nframes)

warnings.filterwarnings("ignore")
for intg in range(nints):
# calculate sigma for each pixel
if nints < minimum_sigclip_groups:
Expand Down
2 changes: 2 additions & 0 deletions src/stcal/jump/twopoint_difference.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,9 @@ def find_crs(
first_diffs = np.diff(dat, axis=1)

if total_usable_diffs >= min_diffs_single_pass:
warnings.filterwarnings("ignore", ".*All-NaN slice encountered.*", RuntimeWarning)
median_diffs = np.nanmedian(first_diffs, axis=(0, 1))
warnings.resetwarnings()
# calculate sigma for each pixel
sigma = np.sqrt(np.abs(median_diffs) + read_noise_2 / nframes)
# reset sigma so pixels with 0 read noise are not flagged as jumps
Expand Down

0 comments on commit 9a44330

Please sign in to comment.