Skip to content

Commit

Permalink
Fix skips in twopint_difference tests
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamJamieson committed Aug 11, 2023
1 parent 55f9581 commit f931384
Showing 1 changed file with 42 additions and 28 deletions.
70 changes: 42 additions & 28 deletions tests/test_twopoint_difference.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ def test_5grps_cr2_nframe2(setup_cube):
assert(np.array_equal([0, 4, 4, 0, 0], out_gdq[0, :, 100, 100]))


@pytest.mark.xfail
def test_4grps_twocrs_2nd_4th(setup_cube):
ngroups = 4
data, gdq, nframes, read_noise, rej_threshold = setup_cube(ngroups)
Expand Down Expand Up @@ -611,7 +610,7 @@ def test_6grps_satat6_crat1(setup_cube):
assert (np.array_equal([0, DQFLAGS['JUMP_DET'], 0, 0, 0, DQFLAGS['SATURATED']], out_gdq[0, :, 100, 100]))


@pytest.mark.xfail
@pytest.mark.xfail()
def test_6grps_satat6_crat1_flagadjpixels(setup_cube):
ngroups = 6
# crmag = 1000
Expand Down Expand Up @@ -1019,10 +1018,13 @@ def test_median_func():
arr = np.zeros(4 * 2 * 2).reshape(4, 2, 2)
arr[:, 0, 0] = np.array([-1., -2., np.nan, np.nan])
assert calc_med_first_diffs(arr)[0, 0] == -1
@pytest.mark.skip("Used for local testing")
def test_sigma_clip():


# TODO: The input data for this is missing, need to find it
@pytest.mark.xfail(reason="Missing Input Data")
def test_sigma_clip(tmp_path, data_path):
# hdul = fits.open('TSOjump_sc__refpix.fits')
hdul = fits.open('lrs_TSOjump_sigmaclip5_00_refpix.fits')
hdul = fits.open(data_path / 'lrs_TSOjump_sigmaclip5_00_refpix.fits')
data = hdul['SCI'].data * 4.0
gdq = hdul['GROUPDQ'].data
indata = data[:53, :, :, :]
Expand All @@ -1038,9 +1040,10 @@ def test_sigma_clip():
after_jump_flag_e2=0.0,
after_jump_flag_n2=0,
copy_arrs=True, minimum_groups=3, minimum_sigclip_groups=50,)
fits.writeto("outgdq.fits", gdq, overwrite=True)
@pytest.mark.skip("Used for local testing")
def test_first_grp_flag_issue():
fits.writeto(tmp_path / "outgdq.fits", gdq, overwrite=True)


def test_first_grp_flag_issue(tmp_path):
nints = 8
nrows = 2
ncols = 2
Expand All @@ -1059,9 +1062,10 @@ def test_first_grp_flag_issue():
after_jump_flag_e1=0.0, after_jump_flag_n1=0,
after_jump_flag_e2=0.0, after_jump_flag_n2=0,
copy_arrs=True, minimum_groups=3, minimum_sigclip_groups=50)
fits.writeto("outgdq.fits",gdq, overwrite=True)
@pytest.mark.skip("Used for local testing")
def test_5grp_TSO():
fits.writeto(tmp_path / "outgdq.fits",gdq, overwrite=True)


def test_5grp_TSO(tmp_path):
nints=20
nrows = 2
ncols = 2
Expand All @@ -1082,10 +1086,13 @@ def test_5grp_TSO():
after_jump_flag_e1=0.0, after_jump_flag_n1=0,
after_jump_flag_e2=0.0, after_jump_flag_n2=0,
copy_arrs=True, minimum_groups=3, minimum_sigclip_groups=5000)
fits.writeto("new_gdq.fits", gdq, overwrite=True)
@pytest.mark.skip("Used for local testing")
def test_5grp_realTSO():
hdul = fits.open("obs2508_cutout_jump.fits")
fits.writeto(tmp_path / "new_gdq.fits", gdq, overwrite=True)


# TODO: The input data for this is missing, need to find it
@pytest.mark.xfail(reason="Missing Input Data")
def test_5grp_realTSO(tmp_path, data_path):
hdul = fits.open(data_path / "obs2508_cutout_jump.fits")
gdq = hdul['groupdq'].data
data = hdul['sci'].data
readnoise = 25
Expand All @@ -1096,10 +1103,13 @@ def test_5grp_realTSO():
after_jump_flag_e1=0.0, after_jump_flag_n1=0,
after_jump_flag_e2=0.0, after_jump_flag_n2=0,
copy_arrs=True, minimum_groups=3, minimum_sigclip_groups=15000)
fits.writeto("new_gdq_cutout.fits", gdq, overwrite=True)
@pytest.mark.skip("Used for local testing")
def test_5grp_allTSO():
hdul = fits.open("obs2508_noshower_sigclip_base_00_dark_current.fits")
fits.writeto(tmp_path / "new_gdq_cutout.fits", gdq, overwrite=True)


# TODO: The input data for this is missing, need to find it
@pytest.mark.xfail(reason="Missing Input Data")
def test_5grp_allTSO(tmp_path, data_path):
hdul = fits.open(data_path / "obs2508_noshower_sigclip_base_00_dark_current.fits")
gdq = hdul['groupdq'].data
data = hdul['sci'].data * 5.5
readnoise = 5.5 * 6
Expand All @@ -1110,11 +1120,13 @@ def test_5grp_allTSO():
after_jump_flag_e1=0.0, after_jump_flag_n1=0,
after_jump_flag_e2=0.0, after_jump_flag_n2=0,
copy_arrs=True, minimum_groups=3, minimum_sigclip_groups=15000)
fits.writeto("new_no_sigma_clip_gdq.fits", gdq, overwrite=True)
fits.writeto(tmp_path / "new_no_sigma_clip_gdq.fits", gdq, overwrite=True)


@pytest.mark.skip("Used for local testing")
def test_1059():
hdul = fits.open("data/nircam_1059_00_dark_current.fits")
# TODO: The input data for this is missing, need to find it
@pytest.mark.xfail(reason="Missing Input Data")
def test_1059(tmp_path, data_path):
hdul = fits.open(data_path / "nircam_1059_00_dark_current.fits")
gdq = hdul['groupdq'].data
data = hdul['sci'].data * 5.5
readnoise = 5.5 * 6
Expand All @@ -1125,11 +1137,13 @@ def test_1059():
after_jump_flag_e1=0.0, after_jump_flag_n1=0,
after_jump_flag_e2=0.0, after_jump_flag_n2=0,
copy_arrs=True, minimum_groups=3, minimum_sigclip_groups=15000)
fits.writeto("new_no_sigma_clip_gdq.fits", gdq, overwrite=True)
fits.writeto(tmp_path / "new_no_sigma_clip_gdq.fits", gdq, overwrite=True)


@pytest.mark.skip("Used for local testing")
def test_1952():
hdul = fits.open("data/obs1952_sc_shower_00_dark_current.fits")
# TODO: The input data for this is missing, need to find it
@pytest.mark.xfail(reason="Missing Input Data")
def test_1952(tmp_path, data_path):
hdul = fits.open(data_path / "obs1952_sc_shower_00_dark_current.fits")
gdq = hdul['groupdq'].data
data = hdul['sci'].data * 5.5
readnoise = 5.5 * 6
Expand All @@ -1140,4 +1154,4 @@ def test_1952():
after_jump_flag_e1=100.0 * gain, after_jump_flag_n1=20/2.77,
after_jump_flag_e2=3000.0 * gain, after_jump_flag_n2=1000/2.77,
copy_arrs=True, minimum_groups=3, minimum_sigclip_groups=150)
fits.writeto("new_obs1952_gdq.fits", gdq, overwrite=True)
fits.writeto(tmp_path / "new_obs1952_gdq.fits", gdq, overwrite=True)

0 comments on commit f931384

Please sign in to comment.