Skip to content

Commit d7ca60b

Browse files
committed
Fix tests
1 parent 85f99c6 commit d7ca60b

File tree

2 files changed

+15
-22
lines changed

2 files changed

+15
-22
lines changed

tests/test_ramp_fitting.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,10 +1446,7 @@ def test_new_saturation(algo):
14461446
check = np.array([[2.794573, 2.793989, np.nan]])
14471447
np.testing.assert_allclose(sdata, check, tol, tol)
14481448

1449-
if algo == DEFAULT_OLS:
1450-
check = np.array([[JUMP | SAT, JUMP | SAT, DNU | SAT]])
1451-
else: # LIKELY
1452-
check = np.array([[JUMP | SAT, JUMP | DNU | SAT, DNU | SAT]])
1449+
check = np.array([[JUMP | SAT, JUMP | SAT, DNU | SAT]])
14531450
np.testing.assert_equal(sdq, check)
14541451

14551452
if algo == DEFAULT_OLS:
@@ -1566,10 +1563,7 @@ def test_invalid_integrations(algo):
15661563
check = np.array([[5576.588]])
15671564
np.testing.assert_allclose(sdata, check, tol, tol)
15681565

1569-
if algo == DEFAULT_OLS:
1570-
check = np.array([[JUMP | SAT]])
1571-
else: # LIKELY
1572-
check = np.array([[JUMP | SAT | DNU]])
1566+
check = np.array([[JUMP | SAT]])
15731567
np.testing.assert_equal(sdq, check)
15741568

15751569
if algo == DEFAULT_OLS:

tests/test_saturation.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
"""
66
from enum import IntEnum
7-
import pytest
7+
88
import numpy as np
99

1010
from stcal.saturation.saturation import flag_saturated_pixels
@@ -40,7 +40,6 @@ def test_basic_saturation_flagging():
4040
assert np.all(gdq[0, satindex:, 5, 5] == DQFLAGS["SATURATED"])
4141

4242

43-
@pytest.mark.xfail(reason="stcal PR#321 broke this test")
4443
def test_read_pattern_saturation_flagging():
4544
"""Check that the saturation threshold varies depending on how the reads
4645
are allocated into resultants."""
@@ -76,7 +75,7 @@ def test_read_pattern_saturation_flagging():
7675
)
7776

7877
# Make sure that groups after the third get flagged
79-
assert np.all(gdq[0, 2:, 5, 5] == DQFLAGS["SATURATED"])
78+
assert np.all(gdq[0, 3:, 5, 5] == DQFLAGS["SATURATED"])
8079

8180

8281
def test_read_pattern_saturation_flagging_dnu():
@@ -120,7 +119,7 @@ def test_read_pattern_saturation_flagging_dnu():
120119

121120
def test_group2_saturation_flagging_with_bias():
122121
"""Flag group 2 saturation in frame-averaged data with significant bias.
123-
122+
124123
Saturation in frame-averaged groups may not exceed the saturation threshold
125124
until after the group where a saturating CR occurs. Special rules are used
126125
for the second group of frame-averaged data. Check that the saturation
@@ -142,35 +141,35 @@ def test_group2_saturation_flagging_with_bias():
142141
# Frame 5 in group 2 has a 40000 count CR saturating the pixel
143142
# averaged over 5 frames this only looks like a 8000 count jump in group 2
144143
# but group 3 signal saturates
145-
144+
146145
bias[5, 5] = 15000
147-
146+
148147
data[0, 0, 5, 5] = 18000
149148
data[0, 1, 5, 5] = 31000
150149
data[0, 2, 5, 5] = 68000
151150
data[0, 3, 5, 5] = 73000 # Signal reaches saturation limit
152151
data[0, 4, 5, 5] = 78000
153-
154-
152+
153+
155154
# Add another pixel with bias of 15000, but no source flux
156155
# pixel counts are 15000 > sat_thresh/5, but should not be flagged as
157156
# saturated.
158157
bias[15, 15] = 15000
159-
158+
160159
data[0, :, 15, 15] = 15000
161160

162161
# Set saturation value in the saturation model
163162
satvalue = 60000
164163
sat_thresh[5, 5] = satvalue
165164
sat_thresh[15, 15] = satvalue
166-
165+
167166

168167
# set read_pattern to have 5 reads per group.
169168
read_pattern = [
170-
[1, 2, 3, 4, 5],
171-
[6, 7, 8, 9, 10],
172-
[11, 12, 13, 14, 15],
173-
[16, 17, 18, 19, 20],
169+
[1, 2, 3, 4, 5],
170+
[6, 7, 8, 9, 10],
171+
[11, 12, 13, 14, 15],
172+
[16, 17, 18, 19, 20],
174173
[21, 22, 23, 24, 25]
175174
]
176175

0 commit comments

Comments
 (0)