Skip to content

Commit

Permalink
Add qualityTables when no donuts pass.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbkalmbach committed Dec 11, 2024
1 parent 8b1ded2 commit 615cc78
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions python/lsst/ts/wep/task/calcZernikesTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,10 @@ def createZkTable(

return zkTable

def empty(self) -> pipeBase.Struct:
"""Return empty results if no donuts are available."""
def empty(self, qualityTable=None) -> pipeBase.Struct:
"""Return empty results if no donuts are available. If
it is a result of no quality donuts we still include the
quality table results instead of an empty quality table."""
qualityTableCols = [
"SN",
"ENTROPY",
Expand All @@ -356,11 +358,15 @@ def empty(self) -> pipeBase.Struct:
"FINAL_SELECT",
"DEFOCAL_TYPE",
]
if qualityTable is None:
donutQualityTable = QTable({name: [] for name in qualityTableCols})
else:
donutQualityTable = qualityTable
return pipeBase.Struct(
outputZernikesRaw=np.atleast_2d(np.full(len(self.nollIndices), np.nan)),
outputZernikesAvg=np.atleast_2d(np.full(len(self.nollIndices), np.nan)),
zernikes=self.initZkTable(),
donutQualityTable=QTable({name: [] for name in qualityTableCols}),
donutQualityTable=donutQualityTable,
)

@timeMethod
Expand Down Expand Up @@ -396,7 +402,7 @@ def run(
or len(selectionIntra.donutStampsSelect) == 0
):
self.log.info("No donut stamps were selected.")
return self.empty()
return self.empty(qualityTable=donutQualityTable)
else:
donutQualityTable = QTable([])

Expand Down

0 comments on commit 615cc78

Please sign in to comment.