Skip to content

Commit

Permalink
BUG make sure to delete files properly and test for errors
Browse files Browse the repository at this point in the history
  • Loading branch information
beckermr committed May 26, 2023
1 parent c32e2b4 commit e48f541
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
23 changes: 13 additions & 10 deletions eastlake/steps/delete_meds.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,18 @@ def execute(self, stash, new_params=None):
if tilename in self.config["save_tilenames"]:
continue

# Get meds filenames
meds_files = stash.get_filepaths("meds_files", tilename)
for m in meds_files:
self.logger.error("removing meds file %s" % m)
os.remove(m)

meds_files = stash.get_filepaths("pizza_cutter_meds_files", tilename)
for m in meds_files:
self.logger.error("removing pizza-cutter meds file %s" % m)
os.remove(m)
meds_files = stash.get_filepaths("meds_files", tilename, keyerror=False)
if meds_files is not None:
for m in meds_files:
if os.path.isfile(m):
self.logger.error("removing meds file %s" % m)
os.remove(m)

meds_files = stash.get_filepaths("pizza_cutter_meds_files", tilename, keyerror=False)
if meds_files is not None:
for m in meds_files:
if os.path.isfile(m):
self.logger.error("removing pizza-cutter meds file %s" % m)
os.remove(m)

return 0, stash
1 change: 1 addition & 0 deletions eastlake/steps/delete_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def execute(self, stash, new_params=None):
if (seg_file is not None):
if os.path.isfile(seg_file):
self.logger.error("removing file %s" % seg_file)
os.remove(seg_file)

# Also check for bkg and bkg-rms files
bkg_file = coadd_file.replace(".fits", "bkg.fits")
Expand Down

0 comments on commit e48f541

Please sign in to comment.