@@ -553,13 +553,13 @@ def test_outlier_step_image_weak_cr_coron(exptype, tsovisit, tmp_cwd):
553553
554554
555555@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 ):
557558 '''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
559560 '''
560561 bkg = 1.5
561562 sig = 0.02
562- rolling_window_width = 7
563563 numsci = 50
564564 signal = 7.0
565565 im = we_many_sci (
@@ -588,8 +588,13 @@ def test_outlier_step_weak_cr_tso(exptype, tsovisit):
588588 assert np .all (np .isnan (result .data [i ][dnu ]))
589589 assert np .allclose (model .data [~ dnu ], result .data [i ][~ dnu ])
590590
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" ])
593598
594599 # Verify CR is flagged
595600 assert result .dq [cr_timestep , 12 , 12 ] == OUTLIER_DO_NOT_USE
0 commit comments