Coverage for python/lsst/analysis/tools/atools/magDiff.py: 22%

32 statements  

« prev     ^ index     » next       coverage.py v7.5.0, created at 2024-05-04 11:05 +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 

22 

23__all__ = ("CModelSubPsfMagMeasSkyGalaxies",) 

24 

25from ..actions.plot.skyPlot import SkyPlot 

26from ..actions.vector import CoaddPlotFlagSelector, GalaxySelector, LoadVector, MagDiff, SnSelector 

27from ..interfaces import AnalysisTool 

28 

29 

30class CModelSubPsfMagMeasSkyGalaxies(AnalysisTool): 

31 """Make a plot showing the difference between the cmodel magnitude and the 

32 PSF magnitude. This plot shows the on sky distribution of these values 

33 for galaxies. 

34 """ 

35 

36 def setDefaults(self): 

37 super().setDefaults() 

38 

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

40 self.prep.selectors.flagSelector.bands = ["g", "r", "i"] 

41 

42 self.prep.selectors.snSelector = SnSelector() 

43 self.prep.selectors.snSelector.bands = ["i"] 

44 self.prep.selectors.snSelector.fluxType = "{band}_psfFlux" 

45 self.prep.selectors.snSelector.threshold = 100 

46 

47 self.prep.selectors.galaxySelector = GalaxySelector() 

48 self.prep.selectors.galaxySelector.vectorKey = "{band}_extendedness" 

49 

50 # TODO: Can we make these defaults somewhere? 

51 self.process.buildActions.xGalaxies = LoadVector() 

52 self.process.buildActions.xGalaxies.vectorKey = "coord_ra" 

53 self.process.buildActions.yGalaxies = LoadVector() 

54 self.process.buildActions.yGalaxies.vectorKey = "coord_dec" 

55 self.process.buildActions.galaxyStatMask = SnSelector() 

56 self.process.buildActions.galaxyStatMask.fluxType = "{band}_psfFlux" 

57 

58 self.process.buildActions.zGalaxies = MagDiff() 

59 self.process.buildActions.zGalaxies.col1 = "{band}_cModelFlux" 

60 self.process.buildActions.zGalaxies.col2 = "{band}_psfFlux" 

61 

62 self.produce.plot = SkyPlot() 

63 self.produce.plot.plotTypes = ["galaxies"] 

64 self.produce.plot.plotName = "CModel_sub_PSF_meas_galaxies_{band}" 

65 self.produce.plot.xAxisLabel = "R.A. (degrees)" 

66 self.produce.plot.yAxisLabel = "Dec. (degrees)" 

67 self.produce.plot.zAxisLabel = "CModel - PSF (mmag) (Meas)" 

68 self.produce.plot.plotOutlines = False