@@ -248,49 +248,49 @@ def test_multiple_neighbor_jumps_firstlastbad(setup_inputs):
248
248
assert_array_equal (out_model .groupdq [0 , :, 4 , 4 ], [1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 ])
249
249
250
250
251
- # def test_nirspec_saturated_pix(setup_inputs):
252
- # """
253
- # This test is based on an actual NIRSpec exposure that has some pixels
254
- # flagged as saturated in one or more groups, which the jump step is
255
- # supposed to ignore, but an old version of the code was setting JUMP flags
256
- # for some of the saturated groups. This is to verify that the saturated
257
- # groups are no longer flagged with jumps.
258
- # """
259
- # grouptime = 3.0
260
- # ingain = 1.0
261
- # inreadnoise = 10.7
262
- # ngroups = 7
263
- # nrows = 6
264
- # ncols = 6
265
-
266
- # model, rnoise, gain = setup_inputs(ngroups=ngroups, nints=1, nrows=nrows,
267
- # ncols=ncols, gain=ingain,
268
- # readnoise=inreadnoise, deltatime=grouptime)
269
-
270
- # # Setup the needed input pixel and DQ values
271
- # model.data[0, :, 1, 1] = [639854.75, 4872.451, -17861.791, 14022.15, 22320.176,
272
- # 1116.3828, 1936.9746]
273
- # model.groupdq[0, :, 1, 1] = [0, 0, 0, 0, 0, 2, 2]
274
- # model.data[0, :, 2, 2] = [8.25666812e+05, -1.10471914e+05, 1.95755371e+02, 1.83118457e+03,
275
- # 1.72250879e+03, 1.81733496e+03, 1.65188281e+03]
276
- # # 2 non-sat groups means only 1 non-sat diff, so no jumps should be flagged
277
- # model.groupdq[0, :, 2, 2] = [0, 0, 2, 2, 2, 2, 2]
278
- # model.data[0, :, 3, 3] = [1228767., 46392.234, -3245.6553, 7762.413,
279
- # 37190.76, 266611.62, 5072.4434]
280
- # model.groupdq[0, :, 3, 3] = [0, 0, 0, 0, 0, 0, 2]
281
-
282
- # # run jump detection
283
- # out_model = run_detect_jumps(model, gain, rnoise, rejection_thresh=200.0, three_grp_thresh=200,
284
- # four_grp_thresh=200,
285
- # max_cores=None, max_jump_to_flag_neighbors=200,
286
- # min_jump_to_flag_neighbors=10, flag_4_neighbors=False )
287
-
288
- # # Check the results. There should not be any pixels with DQ values of 6, which
289
- # # is saturated (2) plus jump (4). All the DQ's should be either just 2 or just 4.
290
- # assert_array_equal(out_model.groupdq[0, :, 1, 1], [0, 4, 4, 4, 0, 2, 2])
291
- # # no groups are flagged when theres only 1 non-sat. grp
292
- # assert_array_equal(out_model.groupdq[0, :, 2, 2], [0, 0, 2, 2, 2, 2, 2])
293
- # assert_array_equal(out_model.groupdq[0, :, 3, 3], [0, 4, 4, 0, 0, 4, 2])
251
+ def test_nirspec_saturated_pix (setup_inputs ):
252
+ """
253
+ This test is based on an actual NIRSpec exposure that has some pixels
254
+ flagged as saturated in one or more groups, which the jump step is
255
+ supposed to ignore, but an old version of the code was setting JUMP flags
256
+ for some of the saturated groups. This is to verify that the saturated
257
+ groups are no longer flagged with jumps.
258
+ """
259
+ grouptime = 3.0
260
+ ingain = 1.0
261
+ inreadnoise = 10.7
262
+ ngroups = 7
263
+ nrows = 6
264
+ ncols = 6
265
+
266
+ model , rnoise , gain = setup_inputs (ngroups = ngroups , nints = 1 , nrows = nrows ,
267
+ ncols = ncols , gain = ingain ,
268
+ readnoise = inreadnoise , deltatime = grouptime )
269
+
270
+ # Setup the needed input pixel and DQ values
271
+ model .data [0 , :, 1 , 1 ] = [639854.75 , 4872.451 , - 17861.791 , 14022.15 , 22320.176 ,
272
+ 1116.3828 , 1936.9746 ]
273
+ model .groupdq [0 , :, 1 , 1 ] = [0 , 0 , 0 , 0 , 0 , 2 , 2 ]
274
+ model .data [0 , :, 2 , 2 ] = [8.25666812e+05 , - 1.10471914e+05 , 1.95755371e+02 , 1.83118457e+03 ,
275
+ 1.72250879e+03 , 1.81733496e+03 , 1.65188281e+03 ]
276
+ # 2 non-sat groups means only 1 non-sat diff, so no jumps should be flagged
277
+ model .groupdq [0 , :, 2 , 2 ] = [0 , 0 , 2 , 2 , 2 , 2 , 2 ]
278
+ model .data [0 , :, 3 , 3 ] = [1228767. , 46392.234 , - 3245.6553 , 7762.413 ,
279
+ 37190.76 , 266611.62 , 5072.4434 ]
280
+ model .groupdq [0 , :, 3 , 3 ] = [0 , 0 , 0 , 0 , 0 , 0 , 2 ]
281
+
282
+ # run jump detection
283
+ out_model = run_detect_jumps (model , gain , rnoise , rejection_thresh = 200.0 , three_grp_thresh = 200 ,
284
+ four_grp_thresh = 200 ,
285
+ max_cores = None , max_jump_to_flag_neighbors = 200 ,
286
+ min_jump_to_flag_neighbors = 10 , flag_4_neighbors = True )
287
+
288
+ # Check the results. There should not be any pixels with DQ values of 6, which
289
+ # is saturated (2) plus jump (4). All the DQ's should be either just 2 or just 4.
290
+ assert_array_equal (out_model .groupdq [0 , :, 1 , 1 ], [0 , 4 , 4 , 4 , 0 , 2 , 2 ])
291
+ # assert that no groups are flagged when theres only 1 non-sat. grp
292
+ assert_array_equal (out_model .groupdq [0 , :, 2 , 2 ], [0 , 0 , 2 , 2 , 2 , 2 , 2 ])
293
+ assert_array_equal (out_model .groupdq [0 , :, 3 , 3 ], [0 , 4 , 4 , 0 , 0 , 4 , 2 ])
294
294
295
295
296
296
@pytest .mark .skip (reason = 'multiprocessing temporarily disabled' )
0 commit comments