Skip to content

Commit

Permalink
Merge pull request #182 from lsst/tickets/DM-41024
Browse files Browse the repository at this point in the history
DM-41024: Add trailed source metric
  • Loading branch information
bsmartradio authored Nov 16, 2023
2 parents 683d3bc + 5467b53 commit 97e3405
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions python/lsst/ap/association/diaPipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ class DiaPipelineConnections(
storageClass="DataFrame",
dimensions=("instrument", "visit", "detector"),
)
longTrailedSources = pipeBase.connectionTypes.Output(
doc="Optional output temporarily storing long trailed diaSources.",
dimensions=("instrument", "visit", "detector"),
storageClass="DataFrame",
name="{fakesType}{coaddName}Diff_longTrailedSrc",
)

def __init__(self, *, config=None):
super().__init__(config=config)
Expand All @@ -124,6 +130,8 @@ def __init__(self, *, config=None):
self.outputs.remove("diaObjects")
if not config.doSolarSystemAssociation:
self.inputs.remove("solarSystemObjectTable")
if not config.associator.doTrailedSourceFilter:
self.outputs.remove("longTrailedSources")

def adjustQuantum(self, inputs, outputs, label, dataId):
"""Override to make adjustments to `lsst.daf.butler.DatasetRef` objects
Expand Down Expand Up @@ -369,6 +377,7 @@ def run(self,
# Associate new DiaSources with existing DiaObjects.
assocResults = self.associator.run(diaSourceTable, loaderResult.diaObjects,
exposure_time=diffIm.visitInfo.exposureTime)

if self.config.doSolarSystemAssociation:
ssoAssocResult = self.solarSystemAssociator.run(
assocResults.unAssocDiaSources,
Expand Down Expand Up @@ -504,6 +513,7 @@ def run(self,
associatedDiaSources=associatedDiaSources,
diaForcedSources=diaForcedSources,
diaObjects=diaObjects,
longTrailedSources=assocResults.longTrailedSources
)

def createNewDiaObjects(self, unAssocDiaSources):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_diaPipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ def solarSystemAssociator_run(self, unAssocDiaSources, solarSystemObjectTable, d
def associator_run(self, table, diaObjects, exposure_time=None):
return lsst.pipe.base.Struct(nUpdatedDiaObjects=2, nUnassociatedDiaObjects=3,
matchedDiaSources=MagicMock(spec=pd.DataFrame()),
unAssocDiaSources=MagicMock(spec=pd.DataFrame()))
unAssocDiaSources=MagicMock(spec=pd.DataFrame()),
longTrailedSources=None)

# apdb isn't a subtask, but still needs to be mocked out for correct
# execution in the test environment.
Expand Down

0 comments on commit 97e3405

Please sign in to comment.