Skip to content

Commit

Permalink
Only return pair for existing visitInfos
Browse files Browse the repository at this point in the history
  • Loading branch information
jmeyers314 committed Apr 4, 2024
1 parent b80d372 commit 86be05f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 8 additions & 6 deletions python/lsst/ts/wep/task/cutOutDonutsScienceSensorTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@
class CutOutDonutsScienceSensorTaskConnections(
CutOutDonutsBaseTaskConnections, dimensions=("detector", "instrument")
):
def __init__(self, *, config=None):
super().__init__(config=config)
if not config.pairer.target._needsPairTable:
del self.donut_visit_pair_table

visitInfos = ct.Input(
doc="Input exposure to make measurements on",
dimensions=("exposure", "detector", "instrument"),
Expand All @@ -67,6 +62,11 @@ def __init__(self, *, config=None):
name="donut_visit_pair_table",
)

def __init__(self, *, config=None):
super().__init__(config=config)
if not config.pairer.target._needsPairTable:
del self.donut_visit_pair_table


class CutOutDonutsScienceSensorTaskConfig(
CutOutDonutsBaseTaskConfig,
Expand Down Expand Up @@ -122,7 +122,9 @@ def runQuantum(
}

if hasattr(inputRefs, "donut_visit_pair_table"):
pairs = self.pairer.run(butlerQC.get(inputRefs.donut_visit_pair_table))
pairs = self.pairer.run(
visitInfoDict, butlerQC.get(inputRefs.donut_visit_pair_table)
)
else:
pairs = self.pairer.run(visitInfoDict)
for pair in pairs:
Expand Down
4 changes: 3 additions & 1 deletion python/lsst/ts/wep/task/pairTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,14 @@ class TablePairer(pipeBase.Task):

def run(
self,
visitInfos: typing.Dict[int, afwImage.VisitInfo],
pairTable: Table,
) -> typing.List[IntraExtraIdxPair]:
"""
Pair up the intra- and extra-focal exposures.
"""
out = []
for row in pairTable:
out.append(IntraExtraIdxPair(row["intra"], row["extra"]))
if row["intra"] in visitInfos and row["extra"] in visitInfos:
out.append(IntraExtraIdxPair(row["intra"], row["extra"]))
return out

0 comments on commit 86be05f

Please sign in to comment.