Coverage for python/lsst/analysis/tools/atools/sizeMagnitude.py: 44%

14 statements  

« prev     ^ index     » next       coverage.py v7.5.1, created at 2024-05-16 04:38 -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/>. 

21 

22from ..actions.vector import CoaddPlotFlagSelector, VisitPlotFlagSelector 

23from .genericBuild import ExtendednessTool, SizeTool 

24from .genericProduce import MagnitudeScatterPlot 

25 

26 

27class SizeMagnitudePlot(ExtendednessTool, SizeTool, MagnitudeScatterPlot): 

28 def coaddContext(self) -> None: 

29 self.prep.selectors.flagSelector = CoaddPlotFlagSelector() 

30 self.prep.selectors.flagSelector.bands = [] 

31 

32 def visitContext(self) -> None: 

33 self.prep.selectors.flagSelector = VisitPlotFlagSelector() 

34 

35 def finalize(self): 

36 # TODO: Investigate why MagnitudeScatterPlot.finalize(self) is called 

37 # always, even if super().finalize() is omitted 

38 super().finalize() 

39 if not self.produce.plot.yAxisLabel: 

40 size = self.sizes[self.size_y] 

41 self.produce.plot.yAxisLabel = ( 

42 f"log10({size.name_size}/{size.unit_size})" 

43 if size.log10_size 

44 else f"{size.name_size} ({size.unit_size})" 

45 )