Skip to content

Commit

Permalink
validateData(): raise exception if any input AD objects don't have a wcs
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-simpson committed May 10, 2022
1 parent 3db76c1 commit 31d875b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions geminidr/core/primitives_standardize.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,8 @@ def validateData(self, adinputs=None, suffix=None):
timestamp_key = self.timestamp_keys[self.myself()]
log.debug(gt.log_message("primitive", self.myself(), "starting"))

missing_wcs_list = []

for ad in adinputs:
if ad.phu.get(timestamp_key):
log.warning("No changes will be made to {}, since it has "
Expand Down Expand Up @@ -444,9 +446,19 @@ def validateData(self, adinputs=None, suffix=None):
"number of extensions expected in raw {} "
"data.".format(len(ad), ad.filename, inst_name))

# Check for WCS
missing_wcs_list.extend([f"{ad.filename} EXTVER {ext.hdr['EXTVER']}"
for ext in ad if ext.wcs is None])

# Timestamp and update filename
gt.mark_history(ad, primname=self.myself(), keyword=timestamp_key)
ad.update_filename(suffix=suffix, strip=True)

if missing_wcs_list:
msg = "The following extensions did not produce a valid WCS:\n "
msg += '\n '.join(extstr for extstr in missing_wcs_list)
raise ValueError(msg+"\n")

return adinputs

@staticmethod
Expand Down

0 comments on commit 31d875b

Please sign in to comment.