Skip to content

Commit 4332463

Browse files
committed
Fix failures
1 parent 8d59d57 commit 4332463

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

jwst/dark_current/tests/test_dark_sub.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def test_frame_averaging(setup_nrc_cube, readpatt, ngroups, nframes, groupgap, n
116116
dark.err[:, 10, 10] = np.arange(10, NGROUPS_DARK + 10)
117117

118118
# Run the pipeline's averaging function
119-
with np.errstate(divide="ignore"), warnings.catch_warnings():
119+
with np.errstate(divide="ignore", invalid="ignore"), warnings.catch_warnings():
120120
# These warnings only appear for certain deps combo.
121121
warnings.filterwarnings("ignore", category=RuntimeWarning, message="Mean of empty slice")
122122
avg_dark = average_dark_frames(dark, ngroups, nframes, groupgap)
@@ -136,7 +136,7 @@ def test_frame_averaging(setup_nrc_cube, readpatt, ngroups, nframes, groupgap, n
136136
for newgp, gstart, gend in zip(range(ngroups), gstrt_ind, gend_ind):
137137

138138
# Average the data frames
139-
with np.errstate(divide="ignore"), warnings.catch_warnings():
139+
with np.errstate(divide="ignore", invalid="ignore"), warnings.catch_warnings():
140140
# These warnings only appear for certain deps combo.
141141
warnings.filterwarnings("ignore", category=RuntimeWarning, message="Mean of empty slice")
142142
newframe = np.mean(dark.data[gstart:gend, 10, 10])

jwst/resample/tests/test_resample_step.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -978,8 +978,9 @@ def test_custom_refwcs_resample_imaging(nircam_rate, output_shape2, match,
978978
total_weight = np.sum(weight1)
979979
output_mean_1 = np.nansum(data1 * weight1) / total_weight
980980
output_mean_2 = np.nansum(data2 * weight2) / total_weight
981-
assert_allclose(input_mean * iscale2, output_mean_1)
982-
assert_allclose(input_mean * iscale2, output_mean_2)
981+
# rtol and atol values are from np.isclose default settings.
982+
assert_allclose(input_mean * iscale2, output_mean_1, rtol=1e-5, atol=1e-8)
983+
assert_allclose(input_mean * iscale2, output_mean_2, rtol=1e-5, atol=1e-8)
983984

984985
im.close()
985986
result.close()
@@ -1041,7 +1042,8 @@ def test_custom_refwcs_pixel_shape_imaging(nircam_rate, tmp_path):
10411042
assert_allclose(input_mean * iscale**2, output_mean_2, atol=1e-4)
10421043

10431044
# check that output pixel area is set from input
1044-
assert_allclose(result.meta.photometry.pixelarea_steradians, pixel_area)
1045+
# rtol and atol values are from np.isclose default settings.
1046+
assert_allclose(result.meta.photometry.pixelarea_steradians, pixel_area, rtol=1e-5, atol=1e-8)
10451047

10461048
im.close()
10471049
result.close()
@@ -1224,7 +1226,8 @@ def test_custom_wcs_pscale_resample_miri(miri_cal, ratio):
12241226
output_scale = compute_spectral_pixel_scale(result.meta.wcs, disp_axis=2)
12251227

12261228
# test scales are close to scale specified, regardless of ratio
1227-
assert_allclose(output_scale, input_scale * 0.75)
1229+
# rtol and atol values are from np.allclose default settings.
1230+
assert_allclose(output_scale, input_scale * 0.75, rtol=1e-05, atol=1e-08)
12281231

12291232
result.close()
12301233

@@ -1243,7 +1246,8 @@ def test_custom_wcs_pscale_resample_nirspec(nirspec_cal, ratio):
12431246
output_scale = compute_spectral_pixel_scale(result.slits[0].meta.wcs, disp_axis=1)
12441247

12451248
# test scales are close to scale specified, regardless of ratio
1246-
assert_allclose(output_scale, input_scale * 0.75)
1249+
# rtol and atol values are from np.allclose default settings.
1250+
assert_allclose(output_scale, input_scale * 0.75, rtol=1e-05, atol=1e-08)
12471251

12481252
result.close()
12491253

0 commit comments

Comments
 (0)