Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up files generated by tests #316

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/test_jump.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def test_flag_large_events_withsnowball_noextension():
assert cube[0, 2, 2, 2] == 0 # Saturation was NOT extended due to max_extended_radius=1


def test_find_faint_extended():
def test_find_faint_extended(tmp_path):
nint, ngrps, ncols, nrows = 1, 66, 25, 25
data = np.zeros(shape=(nint, ngrps, nrows, ncols), dtype=np.float32)
gdq = np.zeros_like(data, dtype=np.uint32)
Expand All @@ -366,7 +366,7 @@ def test_find_faint_extended():
rng = np.random.default_rng(12345)
data[0, 1:, 14:20, 15:20] = 6 * gain * 6.0 * np.sqrt(2)
data = data + rng.normal(size=(nint, ngrps, nrows, ncols)) * readnoise
fits.writeto("data.fits", data, overwrite=True)
fits.writeto(tmp_path / "data.fits", data, overwrite=True)
gdq, num_showers = find_faint_extended(
data,
gdq,
Expand All @@ -386,7 +386,7 @@ def test_find_faint_extended():
)
# Check that all the expected samples in group 2 are flagged as jump and
# that they are not flagged outside
fits.writeto("gdq.fits", gdq, overwrite=True)
fits.writeto(tmp_path / "gdq.fits", gdq, overwrite=True)
# assert num_showers == 1
assert np.all(gdq[0, 1, 22, 14:23] == 0)
assert gdq[0, 1, 16, 18] == DQFLAGS['JUMP_DET']
Expand Down
6 changes: 3 additions & 3 deletions tests/test_tweakreg.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def datamodel(wcsobj2, group_id=None):
return MinimalDataWithWCS(wcsobj2, group_id=group_id)


def test_parse_refcat(datamodel):
def test_parse_refcat(datamodel, tmp_path):

wcsobj = datamodel.meta.wcs
correctors = fake_correctors(0.0)
Expand All @@ -216,11 +216,11 @@ def test_parse_refcat(datamodel):
catalog=TEST_CATALOG)

# save refcat to file
cat.write(Path.cwd() / CATALOG_FNAME, format="ascii.ecsv", overwrite=True)
cat.write(tmp_path / CATALOG_FNAME, format="ascii.ecsv", overwrite=True)

# parse refcat from file
epoch = Time(datamodel.meta.observation.date).decimalyear
refcat = _parse_refcat(Path.cwd() / CATALOG_FNAME,
refcat = _parse_refcat(tmp_path / CATALOG_FNAME,
correctors,
datamodel.meta.wcs,
datamodel.meta.wcsinfo,
Expand Down
Loading