Coverage for python/lsst/analysis/tools/atools/skySource.py: 23%

56 statements  

« prev     ^ index     » next       coverage.py v7.2.5, created at 2023-05-02 11:54 -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 

22 

23__all__ = ("SkySourceSkyPlot", "SkySourceHistPlot") 

24 

25from ..actions.plot.histPlot import HistPanel, HistPlot 

26from ..actions.plot.skyPlot import SkyPlot 

27from ..actions.vector import LoadVector, SNCalculator 

28from ..actions.vector.selectors import SkySourceSelector, SnSelector 

29from ..interfaces import AnalysisTool 

30 

31 

32class SkySourceSkyPlot(AnalysisTool): 

33 parameterizedBand: bool = False 

34 

35 def setDefaults(self): 

36 super().setDefaults() 

37 self.prep.selectors.skySourceSelector = SkySourceSelector() 

38 

39 # TODO: Can we make these defaults somewhere? 

40 self.process.buildActions.x = LoadVector() 

41 self.process.buildActions.x.vectorKey = "coord_ra" 

42 self.process.buildActions.y = LoadVector() 

43 self.process.buildActions.y.vectorKey = "coord_dec" 

44 self.process.buildActions.z = LoadVector() 

45 self.process.buildActions.z.vectorKey = "ap09Flux" 

46 self.process.buildActions.statMask = SnSelector() 

47 self.process.buildActions.statMask.threshold = -1e12 

48 self.process.buildActions.statMask.fluxType = "psfFlux" 

49 

50 self.produce.plot = SkyPlot() 

51 self.produce.plot.plotTypes = ["any"] 

52 self.produce.plot.plotName = "skySource" 

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

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

55 self.produce.plot.zAxisLabel = "Sky Source ap09Flux (nJy)" 

56 self.produce.plot.plotOutlines = False 

57 self.produce.plot.fixAroundZero = True 

58 

59 

60class SkySourceHistPlot(AnalysisTool): 

61 parameterizedBand: bool = False 

62 

63 def setDefaults(self): 

64 super().setDefaults() 

65 self.prep.selectors.skySourceSelector = SkySourceSelector() 

66 

67 self.process.buildActions.hist_psf_flux = LoadVector(vectorKey="psfFlux") 

68 self.process.buildActions.hist_ap09_flux = LoadVector(vectorKey="ap09Flux") 

69 self.process.buildActions.hist_psf_sn = SNCalculator(fluxType="psfFlux") 

70 self.process.buildActions.hist_ap09_sn = SNCalculator(fluxType="ap09Flux") 

71 

72 self.produce.plot = HistPlot() 

73 

74 self.produce.plot.panels["panel_flux"] = HistPanel() 

75 self.produce.plot.panels["panel_flux"].label = "Flux (nJy)" 

76 self.produce.plot.panels["panel_flux"].hists = dict( 

77 hist_psf_flux="psfFlux", 

78 hist_ap09_flux="ap09Flux", 

79 ) 

80 self.produce.plot.panels["panel_flux"].rangeType = "sigmaMad" 

81 self.produce.plot.panels["panel_flux"].lowerRange = 3.5 

82 self.produce.plot.panels["panel_flux"].upperRange = 3.5 

83 self.produce.plot.panels["panel_flux"].referenceValue = 0.0 

84 self.produce.plot.panels["panel_flux"].validate() 

85 

86 self.produce.plot.panels["panel_sn"] = HistPanel() 

87 self.produce.plot.panels["panel_sn"].label = "S/N" 

88 self.produce.plot.panels["panel_sn"].hists = dict( 

89 hist_psf_sn="psf S/N", 

90 hist_ap09_sn="ap09 S/N", 

91 ) 

92 self.produce.plot.panels["panel_sn"].rangeType = "sigmaMad" 

93 self.produce.plot.panels["panel_sn"].lowerRange = 3.5 

94 self.produce.plot.panels["panel_sn"].upperRange = 3.5 

95 self.produce.plot.panels["panel_sn"].referenceValue = 0.0 

96 self.produce.plot.panels["panel_sn"].histDensity = True 

97 self.produce.plot.panels["panel_sn"].validate()