@@ -553,13 +553,13 @@ def test_outlier_step_image_weak_cr_coron(exptype, tsovisit, tmp_cwd):
553
553
554
554
555
555
@pytest .mark .parametrize ("exptype, tsovisit" , exptypes_tso )
556
- def test_outlier_step_weak_cr_tso (exptype , tsovisit ):
556
+ @pytest .mark .parametrize ("rolling_window_width" , [7 , 0 ])
557
+ def test_outlier_step_weak_cr_tso (exptype , tsovisit , rolling_window_width ):
557
558
'''Test outlier detection with rolling median on time-varying source
558
- This test fails if rolling_window_width is set to 100 , i.e., take simple median
559
+ This test fails if rolling_window_width is set to 0 , i.e., take simple median
559
560
'''
560
561
bkg = 1.5
561
562
sig = 0.02
562
- rolling_window_width = 7
563
563
numsci = 50
564
564
signal = 7.0
565
565
im = we_many_sci (
@@ -588,8 +588,13 @@ def test_outlier_step_weak_cr_tso(exptype, tsovisit):
588
588
assert np .all (np .isnan (result .data [i ][dnu ]))
589
589
assert np .allclose (model .data [~ dnu ], result .data [i ][~ dnu ])
590
590
591
- # Verify source is not flagged
592
- assert np .all (result .dq [:, 7 , 7 ] == datamodels .dqflags .pixel ["GOOD" ])
591
+ # Verify source is not flagged for rolling median
592
+ if rolling_window_width == 7 :
593
+ assert np .all (result .dq [:, 7 , 7 ] == datamodels .dqflags .pixel ["GOOD" ])
594
+ # But this fails for simple median
595
+ elif rolling_window_width == 0 :
596
+ with pytest .raises (AssertionError ):
597
+ assert np .all (result .dq [:, 7 , 7 ] == datamodels .dqflags .pixel ["GOOD" ])
593
598
594
599
# Verify CR is flagged
595
600
assert result .dq [cr_timestep , 12 , 12 ] == OUTLIER_DO_NOT_USE
0 commit comments