Skip to content

Commit

Permalink
draft SSO metric
Browse files Browse the repository at this point in the history
  • Loading branch information
ebellm committed Sep 14, 2022
1 parent ed05c40 commit ab95e79
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pipelines/apCcdVisitQualityCore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
description: |
Tier 1 AP plots and metrics to assess CcdVisit quality
tasks:
analyzeDiaSourceTableCore:
class: lsst.analysis.tools.tasks.DiaSourceTableCcdVisitAnalysisTask
config:
# Add plots and metrics that work when we have some
# plots.label: APlotClass
metrics.numSsObjects: NumSsObjectsMetric
connections.outputName: diaSourceTableCore
#metrics.skyFluxVisitStatisticMetric: SkyFluxStatisticMetric
#metrics.skyFluxVisitStatisticMetric.applyContext: VisitContext
python: |
from lsst.analysis.tools.analysisPlots import *
from lsst.analysis.tools.analysisMetrics import *
from lsst.analysis.tools.contexts import *
1 change: 1 addition & 0 deletions python/lsst/analysis/tools/analysisMetrics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from .analysisMetrics import *
from .apSsoMetrics import *
from .limitingMagnitudeMetric import *
from .metricMeasurementBundle import *
from .photometricRepeatabilityMetrics import *
Expand Down
53 changes: 53 additions & 0 deletions python/lsst/analysis/tools/analysisMetrics/apSsoMetrics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This file is part of analysis_tools.
#
# Developed for the LSST Data Management System.
# This product includes software developed by the LSST Project
# (https://www.lsst.org).
# See the COPYRIGHT file at the top-level directory of this distribution
# for details of code ownership.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
from __future__ import annotations

__all__ = ("NumSsObjectsMetric",)

from ..actions.scalar import CountAction
from ..actions.vector import DownselectVector, ThresholdSelector
from ..interfaces import AnalysisMetric


class NumSsObjectsMetric(AnalysisMetric):
"""Count the number of DIASources that are associated with known
Solar System Objects.
"""

def setDefaults(self):
super().setDefaults()

self.process.buildActions.thresholdSelector = ThresholdSelector()

# select nonzero ssObjectId
self.process.buildActions.thresholdSelector.vectorKey = "ssObjectId"
self.process.buildActions.thresholdSelector.op = "ge"
self.process.buildActions.thresholdSelector.threshold = 1

# the final name in the qualification is used as a key to insert
# the calculation into KeyedData
self.process.filterActions.allSSOs = DownselectVector(
vectorKey="ssObjectId", selector=self.process.buildActions.thresholdSelector
)

self.process.calculateActions.NumSsObjectsMetric = CountAction(vectorKey="allSSOs")

self.produce.units = {"NumSsObjectsMetric": "ct"}
1 change: 1 addition & 0 deletions python/lsst/analysis/tools/tasks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from .associatedSourcesTractAnalysis import *
from .catalogMatch import *
from .diaSourceTableVisitAnalysis import *
from .objectTableTractAnalysis import *
from .sourceTableVisitAnalysis import *

0 comments on commit ab95e79

Please sign in to comment.