Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions python/lsst/analysis/tools/actions/vector/selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,8 +616,11 @@ class ParentObjectSelector(FlagSelector):

def setDefaults(self):
# This selects all of the parents
# parentObjectId excludes subParents.
# This works because FlagSelector identifies False as 0.
self.selectWhenFalse = [
"sky_object",
"parentObjectId",
]


Expand Down
24 changes: 23 additions & 1 deletion python/lsst/analysis/tools/atools/deblenderMetric.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@

__all__ = ("ParentDeblenderMetrics", "SkippedDeblenderMetrics", "BlendMetrics", "IsolatedDeblenderMetrics")

from ..actions.scalar.scalarActions import CountAction, MeanAction, SumAction
from ..actions.scalar.scalarActions import CountAction, DivideScalar, MeanAction, SumAction
from ..actions.vector.mathActions import AddVector, SubtractVector
from ..actions.vector.selectors import (
ChildObjectSelector,
FlagSelector,
ParentObjectSelector,
ThresholdSelector,
)
from ..actions.vector.vectorActions import LoadVector
from ..interfaces import AnalysisTool


Expand All @@ -41,22 +43,42 @@ def setDefaults(self):
# Only select parents
self.prep.selectors.parentSelector = ParentObjectSelector()

# Subtract the number of children+isolated from the number of peaks
# to get the number of peakDropouts. Ideally, this should be zero.
self.process.buildActions.peakDropouts = SubtractVector()
self.process.buildActions.peakDropouts.actionA = LoadVector(vectorKey="deblend_nPeaks")
self.process.buildActions.peakDropouts.actionB = AddVector(
actionA=LoadVector(vectorKey="deblend_nChild"),
actionB=LoadVector(vectorKey="deblend_skipped_isolatedParent"),
)

# Statistics for parent blends
self.process.calculateActions.numParents = CountAction(vectorKey="parentObjectId")
self.process.calculateActions.numDeblendFailed = SumAction(vectorKey="deblend_failed")
self.process.calculateActions.numIncompleteData = SumAction(vectorKey="deblend_incompleteData")

# Total number of detected peaks
self.process.calculateActions.numDetectedPeaks = SumAction(vectorKey="deblend_nPeaks")

# Total number of deblended children
self.process.calculateActions.numDeblendedChildren = SumAction(vectorKey="deblend_nChild")

# Total number of peak dropouts
self.process.calculateActions.numPeakDropouts = SumAction(vectorKey="peakDropouts")

# Total number of peak dropouts as proportion of total number of peaks
self.process.calculateActions.propPeakDropouts = DivideScalar()
self.process.calculateActions.propPeakDropouts.actionA = SumAction(vectorKey="peakDropouts")
self.process.calculateActions.propPeakDropouts.actionB = SumAction(vectorKey="deblend_nPeaks")

self.produce.metric.units = {
"numParents": "",
"numDeblendFailed": "",
"numIncompleteData": "",
"numDetectedPeaks": "",
"numDeblendedChildren": "",
"numPeakDropouts": "",
"propPeakDropouts": "",
}


Expand Down
Loading