-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding metrics on associated and unassociated sources, as well as pipeline to create a bar graph comparing associated and unassociated sources. Rename demoMetric Lint fix Typo Fix Formatting Fix Add __all__ and updated docstrings Formatting fixes Small fix Removed repeated Unique Action Updated docstring
- Loading branch information
1 parent
1a58e5a
commit a17f3de
Showing
9 changed files
with
132 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
description: | | ||
Pipeline to create metrics for associated and unassociated sources from diaObject tables | ||
tasks: | ||
analyzeDiaObjectTableSources: | ||
class: lsst.analysis.tools.tasks.DiaObjectTableAssociatedSourcesTask | ||
config: | ||
connections.outputName: sourcesOutput | ||
bands: ['g'] | ||
metrics.sourceMetrics: CountSources | ||
plots.analysisPlots: SourcesPlot | ||
python: | | ||
from lsst.analysis.tools.analysisMetrics import * | ||
from lsst.analysis.tools.analysisPlots import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
python/lsst/analysis/tools/analysisMetrics/sourceMetrics.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 lsst.analysis.tools.actions.scalar import CountAction, FracThreshold | ||
|
||
from ..analysisParts.baseSources import BaseSources | ||
from ..interfaces import AnalysisMetric | ||
|
||
__all__ = ("CountSources",) | ||
|
||
|
||
class CountSources(AnalysisMetric, BaseSources): | ||
"""Counts associated and unassociated sources as | ||
well as their percentage of the total sources.""" | ||
|
||
def setDefaults(self): | ||
super().setDefaults() | ||
|
||
self.process.calculateActions.associatedPercent = FracThreshold( | ||
op="gt", threshold=1.0, vectorKey="nDiaSources" | ||
) | ||
self.process.calculateActions.unassociatedPercent = FracThreshold( | ||
op="le", threshold=1.0, vectorKey="nDiaSources" | ||
) | ||
|
||
self.process.calculateActions.associatedCount = CountAction(vectorKey="associatedVector") | ||
self.process.calculateActions.unassociatedCount = CountAction(vectorKey="unassociatedVector") | ||
|
||
self.produce.units = { | ||
"associatedPercent": "count", | ||
"unassociatedPercent": "count", | ||
"associatedCount": "count", | ||
"unassociatedCount": "count", | ||
"uniqueSources": "count", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
python/lsst/analysis/tools/tasks/diaObjectTableAssocAnalysis.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from __future__ import annotations | ||
|
||
from lsst.pipe.base import connectionTypes as ct | ||
|
||
from .base import AnalysisBaseConfig, AnalysisBaseConnections, AnalysisPipelineTask | ||
|
||
__all__ = [ | ||
"DiaObjectTableAnalysisConnections", | ||
"DiaObjectTableAnalysisConfig", | ||
"DiaObjectTableAssociatedSourcesTask", | ||
] | ||
|
||
|
||
class DiaObjectTableAnalysisConnections( | ||
AnalysisBaseConnections, | ||
dimensions=("visit", "band"), | ||
defaultTemplates={"coaddName": "deep", "fakesType": ""}, | ||
): | ||
|
||
data = ct.Input( | ||
doc="CcdVisit-based DiaObject table to load from the butler", | ||
name="{fakesType}{coaddName}Diff_diaObject", | ||
storageClass="DataFrame", | ||
dimensions=("visit", "band", "detector"), | ||
deferLoad=True, | ||
) | ||
|
||
|
||
class DiaObjectTableAnalysisConfig(AnalysisBaseConfig, pipelineConnections=DiaObjectTableAnalysisConnections): | ||
pass | ||
|
||
|
||
class DiaObjectTableAssociatedSourcesTask(AnalysisPipelineTask): | ||
ConfigClass = DiaObjectTableAnalysisConfig | ||
_DefaultName = "DiaObjectTableAssociatedSources" |