Coverage for python/lsst/analysis/tools/atools/stellarLocus.py: 17%
135 statements
« prev ^ index » next coverage.py v7.2.3, created at 2023-04-28 05:15 -0700
« prev ^ index » next coverage.py v7.2.3, created at 2023-04-28 05:15 -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__ = (
24 "StellarLocusBase",
25 "WPerpPSF",
26 "WPerpCModel",
27 "XPerpPSF",
28 "XPerpCModel",
29 "YPerpPSF",
30 "YPerpCModel",
31)
33from ..actions.keyedData.stellarLocusFit import StellarLocusFitAction
34from ..actions.plot.colorColorFitPlot import ColorColorFitPlot
35from ..actions.scalar import ApproxFloor
36from ..actions.vector import (
37 CoaddPlotFlagSelector,
38 ExtinctionCorrectedMagDiff,
39 MagColumnNanoJansky,
40 SnSelector,
41 StarSelector,
42)
43from ..interfaces import AnalysisTool
46class StellarLocusBase(AnalysisTool):
47 # Use this as the Base Class for now StellarLocusBaseMetric
48 parameterizedBand: bool = False
50 def setDefaults(self):
51 super().setDefaults()
52 self.prep.selectors.flagSelector = CoaddPlotFlagSelector()
54 self.prep.selectors.snSelector = SnSelector()
55 self.prep.selectors.snSelector.threshold = 300
57 self.prep.selectors.starSelector = StarSelector()
59 self.process.buildActions.x = ExtinctionCorrectedMagDiff()
60 self.process.buildActions.x.magDiff.returnMillimags = False
61 self.process.buildActions.y = ExtinctionCorrectedMagDiff()
62 self.process.buildActions.y.magDiff.returnMillimags = False
65class WPerpPSF(StellarLocusBase):
66 parameterizedBand: bool = False
68 def setDefaults(self):
69 super().setDefaults()
70 self.prep.selectors.flagSelector.bands = ["g", "r", "i"]
71 self.prep.selectors.snSelector.bands = ["r"]
72 self.prep.selectors.snSelector.fluxType = "{band}_psfFlux"
74 self.prep.selectors.starSelector.vectorKey = "r_extendedness"
76 self.process.buildActions.x.magDiff.col1 = "g_psfFlux"
77 self.process.buildActions.x.magDiff.col2 = "r_psfFlux"
79 self.process.buildActions.y.magDiff.col1 = "r_psfFlux"
80 self.process.buildActions.y.magDiff.col2 = "i_psfFlux"
82 self.process.buildActions.mag = MagColumnNanoJansky(vectorKey="r_psfFlux")
84 self.process.calculateActions.wPerp_psfFlux = StellarLocusFitAction()
85 self.process.calculateActions.wPerp_psfFlux.stellarLocusFitDict = {
86 "xMin": 0.28,
87 "xMax": 1.0,
88 "yMin": 0.02,
89 "yMax": 0.48,
90 "mHW": 0.52,
91 "bHW": -0.08,
92 }
94 self.process.calculateActions.approxMagDepth = ApproxFloor(vectorKey="mag")
95 self.produce.metric.units = {
96 "wPerp_psfFlux_sigmaMAD": "mmag",
97 "wPerp_psfFlux_median": "mmag",
98 }
100 self.produce.plot = ColorColorFitPlot()
101 self.produce.plot.xAxisLabel = "g - r (PSF) [mags]"
102 self.produce.plot.yAxisLabel = "r - i (PSF) [mags]"
103 self.produce.plot.magLabel = "PSF Mag"
104 self.produce.plot.plotName = "wPerp_psfFlux"
107class WPerpCModel(WPerpPSF):
108 def setDefaults(self):
109 super().setDefaults()
110 self.prep.selectors.snSelector.fluxType = "{band}_cModelFlux"
112 self.process.buildActions.x.magDiff.col1 = "g_cModelFlux"
113 self.process.buildActions.x.magDiff.col2 = "r_cModelFlux"
115 self.process.buildActions.y.magDiff.col1 = "r_cModelFlux"
116 self.process.buildActions.y.magDiff.col2 = "i_cModelFlux"
118 self.process.buildActions.mag = MagColumnNanoJansky(vectorKey="r_cModelFlux")
120 self.process.calculateActions.wPerp_cmodelFlux = StellarLocusFitAction()
121 self.process.calculateActions.wPerp_cmodelFlux.stellarLocusFitDict = {
122 "xMin": 0.28,
123 "xMax": 1.0,
124 "yMin": 0.02,
125 "yMax": 0.48,
126 "mHW": 0.52,
127 "bHW": -0.08,
128 }
130 self.process.calculateActions.approxMagDepth = ApproxFloor(vectorKey="mag")
132 self.produce.metric.units = {
133 "wPerp_cmodelFlux_sigmaMAD": "mmag",
134 "wPerp_cmodelFlux_median": "mmag",
135 }
137 self.produce.plot = ColorColorFitPlot()
138 self.produce.plot.xAxisLabel = "g - r (CModel) [mags]"
139 self.produce.plot.yAxisLabel = "r - i (CModel) [mags]"
140 self.produce.plot.magLabel = "CModel Mag"
141 self.produce.plot.plotName = "wPerp_cmodelFlux"
144class XPerpPSF(StellarLocusBase):
145 def setDefaults(self):
146 super().setDefaults()
147 self.prep.selectors.flagSelector.bands = ["g", "r", "i"]
148 self.prep.selectors.snSelector.bands = ["r"]
149 self.prep.selectors.snSelector.fluxType = "{band}_psfFlux"
151 self.prep.selectors.starSelector.vectorKey = "r_extendedness"
153 self.process.buildActions.x.magDiff.col1 = "g_psfFlux"
154 self.process.buildActions.x.magDiff.col2 = "r_psfFlux"
156 self.process.buildActions.y.magDiff.col1 = "r_psfFlux"
157 self.process.buildActions.y.magDiff.col2 = "i_psfFlux"
159 self.process.buildActions.mag = MagColumnNanoJansky(vectorKey="r_psfFlux")
161 self.process.calculateActions.xPerp_psfFlux = StellarLocusFitAction()
162 self.process.calculateActions.xPerp_psfFlux.stellarLocusFitDict = {
163 "xMin": 1.05,
164 "xMax": 1.55,
165 "yMin": 0.78,
166 "yMax": 1.62,
167 "mHW": 13.35,
168 "bHW": -15.54,
169 }
171 self.process.calculateActions.approxMagDepth = ApproxFloor(vectorKey="mag")
173 self.produce.metric.units = {
174 "xPerp_psfFlux_sigmaMAD": "mmag",
175 "xPerp_psfFlux_median": "mmag",
176 }
177 self.produce.plot = ColorColorFitPlot()
178 self.produce.plot.xAxisLabel = "g - r (PSF) [mags]"
179 self.produce.plot.yAxisLabel = "r - i (PSF) [mags]"
180 self.produce.plot.magLabel = "PSF Mag"
181 self.produce.plot.plotName = "xPerp_psfFlux"
184class XPerpCModel(XPerpPSF):
185 def setDefaults(self):
186 super().setDefaults()
187 self.prep.selectors.snSelector.fluxType = "{band}_cModelFlux"
189 self.process.buildActions.x.magDiff.col1 = "g_cModelFlux"
190 self.process.buildActions.x.magDiff.col2 = "r_cModelFlux"
192 self.process.buildActions.y.magDiff.col1 = "r_cModelFlux"
193 self.process.buildActions.y.magDiff.col2 = "i_cModelFlux"
195 self.process.calculateActions.xPerp_cmodelFlux = StellarLocusFitAction()
196 self.process.calculateActions.xPerp_cmodelFlux.stellarLocusFitDict = {
197 "xMin": 1.05,
198 "xMax": 1.55,
199 "yMin": 0.78,
200 "yMax": 1.62,
201 "mHW": 13.35,
202 "bHW": -15.54,
203 }
205 self.process.buildActions.mag = MagColumnNanoJansky(vectorKey="r_cModelFlux")
207 self.produce.metric.units = { # type: ignore
208 "xPerp_cmodelFlux_sigmaMAD": "mmag",
209 "xPerp_cmodelFlux_median": "mmag",
210 }
212 self.produce.plot = ColorColorFitPlot()
213 self.produce.plot.xAxisLabel = "g - r (CModel) [mags]"
214 self.produce.plot.yAxisLabel = "r - i (CModel) [mags]"
215 self.produce.plot.magLabel = "CModel Mag"
216 self.produce.plot.plotName = "xPerp_cmodelFlux"
219class YPerpPSF(StellarLocusBase):
220 def setDefaults(self):
221 super().setDefaults()
222 self.prep.selectors.flagSelector.bands = ["r", "i", "z"]
223 self.prep.selectors.snSelector.bands = ["i"]
224 self.prep.selectors.snSelector.fluxType = "{band}_psfFlux"
226 self.prep.selectors.starSelector.vectorKey = "i_extendedness"
228 self.process.buildActions.x.magDiff.col1 = "r_psfFlux"
229 self.process.buildActions.x.magDiff.col2 = "i_psfFlux"
231 self.process.buildActions.y.magDiff.col1 = "i_psfFlux"
232 self.process.buildActions.y.magDiff.col2 = "z_psfFlux"
234 self.process.buildActions.mag = MagColumnNanoJansky(vectorKey="i_psfFlux")
236 self.process.calculateActions.yPerp_psfFlux = StellarLocusFitAction()
237 self.process.calculateActions.yPerp_psfFlux.stellarLocusFitDict = {
238 "xMin": 0.82,
239 "xMax": 2.01,
240 "yMin": 0.37,
241 "yMax": 0.90,
242 "mHW": 0.40,
243 "bHW": 0.03,
244 }
246 self.process.calculateActions.approxMagDepth = ApproxFloor(vectorKey="mag")
248 self.produce.metric.units = {
249 "yPerp_psfFlux_sigmaMAD": "mmag",
250 "yPerp_psfFlux_median": "mmag",
251 }
253 self.produce.plot = ColorColorFitPlot()
254 self.produce.plot.xAxisLabel = "r - i (PSF) [mags]"
255 self.produce.plot.yAxisLabel = "i - z (PSF) [mags]"
256 self.produce.plot.magLabel = "PSF Mag"
257 self.produce.plot.plotName = "yPerp_psfFlux"
260class YPerpCModel(YPerpPSF):
261 def setDefaults(self):
262 super().setDefaults()
263 self.prep.selectors.snSelector.fluxType = "{band}_cModelFlux"
265 self.process.buildActions.x.magDiff.col1 = "r_cModelFlux"
266 self.process.buildActions.x.magDiff.col2 = "i_cModelFlux"
268 self.process.buildActions.y.magDiff.col1 = "i_cModelFlux"
269 self.process.buildActions.y.magDiff.col2 = "z_cModelFlux"
271 self.process.buildActions.mag = MagColumnNanoJansky(vectorKey="i_cModelFlux")
273 self.process.calculateActions.yPerp_cmodelFlux = StellarLocusFitAction()
274 self.process.calculateActions.yPerp_cmodelFlux.stellarLocusFitDict = {
275 "xMin": 0.82,
276 "xMax": 2.01,
277 "yMin": 0.37,
278 "yMax": 0.90,
279 "mHW": 0.40,
280 "bHW": 0.03,
281 }
283 self.produce.metric.units = { # type: ignore
284 "yPerp_cmodelFlux_sigmaMAD": "mmag",
285 "yPerp_cmodelFlux_median": "mmag",
286 }
288 self.produce.plot = ColorColorFitPlot()
289 self.produce.plot.xAxisLabel = "r - i (CModel) [mags]"
290 self.produce.plot.yAxisLabel = "i - z (CModel) [mags]"
291 self.produce.plot.magLabel = "CModel Mag"
292 self.produce.plot.plotName = "yPerp_cmodelFlux"