Skip to content

Commit

Permalink
Do not attempt to package forced sources that were not run
Browse files Browse the repository at this point in the history
  • Loading branch information
isullivan committed Oct 24, 2024
1 parent 6075d39 commit 27f6df3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion python/lsst/ap/association/diaPipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,11 @@ def run(self,
diaForcedSources = self.runForcedMeasurement(
diaCalResult.diaObjectCat, diaCalResult.updatedDiaObjects, exposure, diffIm, idGenerator
)

forcedSourceHistoryThreshold = self.diaForcedSource.config.historyThreshold
else:
# alertPackager needs correct columns
diaForcedSources = makeEmptyForcedSourceTable(self.schema)
forcedSourceHistoryThreshold = 0

# Write results to Alert Production Database (APDB)
self.writeToApdb(diaCalResult.updatedDiaObjects, associatedDiaSources, diaForcedSources)
Expand Down Expand Up @@ -533,6 +534,7 @@ def run(self,
exposure,
template,
doRunForcedMeasurement=self.config.doRunForcedMeasurement,
forcedSourceHistoryThreshold=forcedSourceHistoryThreshold,
)

# For historical reasons, apdbMarker is a Config even if it's not meant to be read.
Expand Down
6 changes: 5 additions & 1 deletion python/lsst/ap/association/packageAlerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ def run(self,
calexp,
template,
doRunForcedMeasurement=True,
forcedSourceHistoryThreshold=0,
):
"""Package DiaSources/Object and exposure data into Avro alerts.
Expand Down Expand Up @@ -246,6 +247,9 @@ def run(self,
This should only be turned off for debugging purposes.
Added to allow disabling forced sources for performance
reasons during the ops rehearsal.
forcedSourceHistoryThreshold : `int`, optional
Minimum number of detections of a diaObject required
to run forced photometry. Set to 1 to include all diaObjects.
"""
alerts = []
self._patchDiaSources(diaSourceCat)
Expand Down Expand Up @@ -276,7 +280,7 @@ def run(self,
objSourceHistory = diaSrcHistory.loc[srcIndex[0]]
else:
objSourceHistory = None
if doRunForcedMeasurement and not diaForcedSources.empty:
if doRunForcedMeasurement and diaObject["nDiaSources"] >= forcedSourceHistoryThreshold:
objDiaForcedSources = diaForcedSources.loc[srcIndex[0]]
else:
# Send empty table with correct columns
Expand Down

0 comments on commit 27f6df3

Please sign in to comment.