Coverage for python/lsst/analysis/tools/atools/limitingMagnitudeMetric.py: 45%
20 statements
« prev ^ index » next coverage.py v7.3.2, created at 2023-10-03 10:01 +0000
« prev ^ index » next coverage.py v7.3.2, created at 2023-10-03 10:01 +0000
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__ = ("FiveSigmaPointSourceDepthMetric",)
25from ..actions.scalar.scalarActions import MeanAction, MedianAction
26from ..actions.vector.selectors import SnSelector, StarSelector
27from ..actions.vector.vectorActions import ConvertFluxToMag
28from ..interfaces import AnalysisTool
31class FiveSigmaPointSourceDepthMetric(AnalysisTool):
32 """Calculate the five-sigma point source depth of a visit, based on the
33 PSF flux and its reported error. By default the calculation selects
34 objects between 4.75 < S/N < 5.25, but these limits are configurable.
35 The flux type to use for selection is also configurable. Both the median
36 and mean 5-sigma depths are returned.
37 """
39 parameterizedBand: bool = False
41 def setDefaults(self):
42 super().setDefaults()
44 self.prep.selectors.starSelector = StarSelector()
45 self.prep.selectors.starSelector.vectorKey = "extendedness"
47 self.prep.selectors.snSelector = SnSelector()
48 self.prep.selectors.snSelector.fluxType = "psfFlux"
49 # Select between 4.75 < SNR < 5.25 to get a decent sample:
50 self.prep.selectors.snSelector.threshold = 4.75
51 self.prep.selectors.snSelector.maxSN = 5.25
53 self.process.buildActions.mags = ConvertFluxToMag(vectorKey="psfFlux")
54 self.process.calculateActions.median5sigmaDepth = MedianAction(vectorKey="mags")
55 self.process.calculateActions.mean5sigmaDepth = MeanAction(vectorKey="mags")
57 self.produce.metric.units = { # type: ignore
58 "median5sigmaDepth": "mag",
59 "mean5sigmaDepth": "mag",
60 }