Coverage for python/lsst/analysis/tools/atools/skyObject.py: 20%
56 statements
« prev ^ index » next coverage.py v7.4.4, created at 2024-03-26 04:09 -0700
« prev ^ index » next coverage.py v7.4.4, created at 2024-03-26 04:09 -0700
1# This file is part of analysis_tools.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (https://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <https://www.gnu.org/licenses/>.
21from __future__ import annotations
23__all__ = ("SkyObjectSkyPlot", "SkyObjectHistPlot")
25from ..actions.plot.histPlot import HistPanel, HistPlot
26from ..actions.plot.skyPlot import SkyPlot
27from ..actions.vector import CalcSn, LoadVector
28from ..actions.vector.selectors import SkyObjectSelector, SnSelector
29from ..interfaces import AnalysisTool
32class SkyObjectSkyPlot(AnalysisTool):
33 def setDefaults(self):
34 super().setDefaults()
35 self.prep.selectors.skyObjectSelector = SkyObjectSelector()
37 # TODO: Can we make these defaults somewhere?
38 self.process.buildActions.x = LoadVector()
39 self.process.buildActions.x.vectorKey = "coord_ra"
40 self.process.buildActions.y = LoadVector()
41 self.process.buildActions.y.vectorKey = "coord_dec"
42 self.process.buildActions.z = LoadVector()
43 self.process.buildActions.z.vectorKey = "{band}_ap09Flux"
44 self.process.buildActions.statMask = SnSelector()
45 self.process.buildActions.statMask.threshold = -1e12
46 self.process.buildActions.statMask.fluxType = "{band}_psfFlux"
48 self.produce.plot = SkyPlot()
49 self.produce.plot.plotTypes = ["any"]
50 self.produce.plot.plotName = "skyObject_{band}"
51 self.produce.plot.xAxisLabel = "R.A. (degrees)"
52 self.produce.plot.yAxisLabel = "Dec. (degrees)"
53 self.produce.plot.zAxisLabel = "Sky Object ap09Flux (nJy)"
54 self.produce.plot.plotOutlines = False
55 self.produce.plot.fixAroundZero = True
58class SkyObjectHistPlot(AnalysisTool):
59 def setDefaults(self):
60 super().setDefaults()
61 self.prep.selectors.skyObjectSelector = SkyObjectSelector()
63 self.process.buildActions.hist_psf_flux = LoadVector(vectorKey="{band}_psfFlux")
64 self.process.buildActions.hist_ap09_flux = LoadVector(vectorKey="{band}_ap09Flux")
65 self.process.buildActions.hist_gaap1p0_flux = LoadVector(vectorKey="{band}_gaap1p0Flux")
66 self.process.buildActions.hist_psf_sn = CalcSn(fluxType="{band}_psfFlux")
67 self.process.buildActions.hist_ap09_sn = CalcSn(fluxType="{band}_ap09Flux")
68 self.process.buildActions.hist_gaap1p0_sn = CalcSn(fluxType="{band}_gaap1p0Flux")
70 self.produce.plot = HistPlot()
72 self.produce.plot.panels["panel_flux"] = HistPanel()
73 self.produce.plot.panels["panel_flux"].label = "Flux (nJy)"
74 self.produce.plot.panels["panel_flux"].hists = dict(
75 hist_psf_flux="psfFlux",
76 hist_ap09_flux="ap09Flux",
77 hist_gaap1p0_flux="gaap1p0Flux",
78 )
79 self.produce.plot.panels["panel_flux"].rangeType = "sigmaMad"
80 self.produce.plot.panels["panel_flux"].lowerRange = 3.5
81 self.produce.plot.panels["panel_flux"].upperRange = 3.5
82 self.produce.plot.panels["panel_flux"].referenceValue = 0.0
83 self.produce.plot.panels["panel_flux"].validate()
85 self.produce.plot.panels["panel_sn"] = HistPanel()
86 self.produce.plot.panels["panel_sn"].label = "S/N"
87 self.produce.plot.panels["panel_sn"].hists = dict(
88 hist_psf_sn="psf S/N",
89 hist_ap09_sn="ap09 S/N",
90 hist_gaap1p0_sn="gaap1p0 S/N",
91 )
92 self.produce.plot.panels["panel_sn"].rangeType = "sigmaMad"
93 self.produce.plot.panels["panel_sn"].lowerRange = 3.5
94 self.produce.plot.panels["panel_sn"].upperRange = 3.5
95 self.produce.plot.panels["panel_sn"].referenceValue = 0.0
96 self.produce.plot.panels["panel_sn"].histDensity = True
97 self.produce.plot.panels["panel_sn"].validate()