Coverage for python / lsst / analysis / tools / atools / sizeMagnitude.py: 65%
32 statements
« prev ^ index » next coverage.py v7.14.0, created at 2026-05-13 09:02 +0000
« prev ^ index » next coverage.py v7.14.0, created at 2026-05-13 09:02 +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/>.
22import logging
24from deprecated.sphinx import deprecated
26from ..actions.vector import CoaddPlotFlagSelector, VisitPlotFlagSelector
27from .genericBuild import SizeTool
28from .genericProduce import MagnitudeScatterPlot
30logging.basicConfig()
31_LOG = logging.getLogger(__name__)
32_LOG.setLevel(logging.WARNING)
35class SizeMagnitudePlot(SizeTool, MagnitudeScatterPlot):
37 _parameterizedBand: bool = True
39 # TODO: Remove the getter and setting in DM-54864.
40 # Instead, just convert _parameterizedBand to parameterizedBand.
41 @property
42 def parameterizedBand(self) -> bool:
43 return self._parameterizedBand
45 @parameterizedBand.setter
46 def parameterizedBand(self, value: bool) -> None:
47 _LOG.info(
48 "Setting 'parameterizedBand' of a `SizeMagnitudePlot' is a no-op. "
49 "If you see this message, it is likely because you are trying "
50 "to read older version of configs with newer versions of the "
51 "LSST Science Pipelines."
52 )
54 # TODO: Remove the getter and setter in DM-54864.
55 @property
56 @deprecated(reason="This is no longer used.", version="v31")
57 def extendedness(self) -> None:
58 """A config-like attribute for backward compatibility.
60 This does not do anything but enable reading old configs.
61 """
63 @extendedness.setter
64 def extendedness(self, value: str) -> None:
65 _LOG.info(
66 "Setting 'extendedness' of a `SizeMagnitudePlot' is a no-op. "
67 "If you see this message, it is likely because you are trying "
68 "to read older version of configs with newer versions of the "
69 "LSST Science Pipelines."
70 )
72 def coaddContext(self) -> None:
73 self.prep.selectors.flagSelector = CoaddPlotFlagSelector()
74 self.prep.selectors.flagSelector.bands = []
76 def visitContext(self) -> None:
77 self.prep.selectors.flagSelector = VisitPlotFlagSelector()
79 def finalize(self):
80 # TODO: Investigate why MagnitudeScatterPlot.finalize(self) is called
81 # always, even if super().finalize() is omitted
82 super().finalize()
83 if not self.produce.plot.yAxisLabel:
84 size = self.sizes[self.size_y]
85 self.produce.plot.yAxisLabel = (
86 f"log10({size.name_size}/{size.unit_size})"
87 if size.log10_size
88 else f"{size.name_size} ({size.unit_size})"
89 )