Skip to content

Commit 1516e2a

Browse files
committed
Support partial outputs for detection on the preconvolved diffim
1 parent 3687d24 commit 1516e2a

1 file changed

Lines changed: 18 additions & 9 deletions

File tree

python/lsst/ip/diffim/detectAndMeasure.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,7 @@ class DetectAndMeasureScoreTask(DetectAndMeasureTask):
13681368

13691369
@timeMethod
13701370
def run(self, science, matchedTemplate, difference, scoreExposure, kernelSources,
1371-
idFactory=None):
1371+
idFactory=None, measurementResults=None):
13721372
"""Detect and measure sources on a score image.
13731373
13741374
Parameters
@@ -1388,6 +1388,10 @@ def run(self, science, matchedTemplate, difference, scoreExposure, kernelSources
13881388
Generator object used to assign ids to detected sources in the
13891389
difference image. Ids from this generator are not set until after
13901390
deblending and merging positive/negative peaks.
1391+
measurementResults : `lsst.pipe.base.Struct`, optional
1392+
Result struct that is modified to allow saving of partial outputs
1393+
for some failure conditions. If the task completes successfully,
1394+
this is also returned.
13911395
13921396
Returns
13931397
-------
@@ -1398,6 +1402,8 @@ def run(self, science, matchedTemplate, difference, scoreExposure, kernelSources
13981402
``diaSources`` : `lsst.afw.table.SourceCatalog`
13991403
The catalog of detected sources.
14001404
"""
1405+
if measurementResults is None:
1406+
measurementResults = pipeBase.Struct()
14011407
if idFactory is None:
14021408
idFactory = lsst.meas.base.IdGenerator().make_table_id_factory()
14031409

@@ -1420,17 +1426,20 @@ def run(self, science, matchedTemplate, difference, scoreExposure, kernelSources
14201426
results.positive,
14211427
results.negative)
14221428

1423-
return self.processResults(science, matchedTemplate, difference,
1424-
sources, idFactory, kernelSources,
1425-
positives=positives,
1426-
negatives=negatives)
1429+
self.processResults(science, matchedTemplate, difference,
1430+
sources, idFactory, kernelSources,
1431+
positives=positives,
1432+
negatives=negatives,
1433+
measurementResults=measurementResults)
14271434

14281435
else:
14291436
positives = afwTable.SourceCatalog(self.schema)
14301437
results.positive.makeSources(positives)
14311438
negatives = afwTable.SourceCatalog(self.schema)
14321439
results.negative.makeSources(negatives)
1433-
return self.processResults(science, matchedTemplate, difference,
1434-
results.sources, idFactory, kernelSources,
1435-
positives=positives,
1436-
negatives=negatives)
1440+
self.processResults(science, matchedTemplate, difference,
1441+
results.sources, idFactory, kernelSources,
1442+
positives=positives,
1443+
negatives=negatives,
1444+
measurementResults=measurementResults)
1445+
return measurementResults

0 commit comments

Comments
 (0)