Skip to content

Commit

Permalink
measureCoaddSources: fix error from empty matches
Browse files Browse the repository at this point in the history
We can't generate a proper denormalised match list from no matches,
because we don't have the schemas (which come from the matches);
so lsst.meas.astrom.denormalizeMatches raises RuntimeError if
there are no matches. We need to catch this case before calling
denormalizeMatches. We generate a dummy denormalized matches file
to keep the Gen3 butler happy (it's expecting an output of some
kind).
  • Loading branch information
PaulPrice committed Jul 10, 2019
1 parent 63f6f39 commit b8b8738
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions python/lsst/pipe/tasks/multiBand.py
Original file line number Diff line number Diff line change
Expand Up @@ -1100,8 +1100,16 @@ def run(self, exposure, sources, skyInfo, exposureId, ccdInputs=None, visitCatal
matches.table.setMetadata(matchResult.matchMeta)
results.matchResult = matches
if self.config.doWriteMatchesDenormalized:
results.denormMatches = denormalizeMatches(matchResult.matches,
matchResult.matchMeta)
if matchResult.matches:
denormMatches = denormalizeMatches(matchResult.matches, matchResult.matchMeta)
else:
self.log.warn("No matches, so generating dummy denormalized matches file")
denormMatches = afwTable.BaseCatalog(afwTable.Schema())
denormMatches.setMetadata(PropertyList())
denormMatches.getMetadata().add("COMMENT",
"This catalog is empty because no matches were found.")
results.denormMatches = denormMatches
results.denormMatches = denormMatches

results.outputSources = sources
return results
Expand Down

0 comments on commit b8b8738

Please sign in to comment.