Coverage for python/lsst/analysis/tools/analysisPlots/skyObject.py: 20%

56 statements  

« prev     ^ index     » next       coverage.py v6.5.0, created at 2023-02-08 04:01 -0800

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__ = ("SkyObjectSkyPlot", "SkyObjectHistPlot") 

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 SkyObjectSelector, SnSelector 

29from ..interfaces import AnalysisPlot 

30 

31 

32class SkyObjectSkyPlot(AnalysisPlot): 

33 def setDefaults(self): 

34 super().setDefaults() 

35 self.prep.selectors.skyObjectSelector = SkyObjectSelector() 

36 

37 # TODO: Can we make these defaults somewhere? 

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

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

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

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

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

43 self.process.buildActions.z.vectorKey = "{band}_ap09Flux" 

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

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

46 self.process.buildActions.statMask.fluxType = "{band}_psfFlux" 

47 

48 self.produce = SkyPlot() 

49 self.produce.plotTypes = ["any"] 

50 self.produce.plotName = "skyObject_{band}" 

51 self.produce.xAxisLabel = "R.A. (degrees)" 

52 self.produce.yAxisLabel = "Dec. (degrees)" 

53 self.produce.zAxisLabel = "Sky Object ap09Flux (nJy)" 

54 self.produce.plotOutlines = False 

55 self.produce.fixAroundZero = True 

56 

57 

58class SkyObjectHistPlot(AnalysisPlot): 

59 def setDefaults(self): 

60 super().setDefaults() 

61 self.prep.selectors.skyObjectSelector = SkyObjectSelector() 

62 

63 self.process.buildActions.hist_psf_flux = LoadVector(vectorKey="{band}_psfFlux") 

64 self.process.buildActions.hist_ap09_flux = LoadVector(vectorKey="{band}_ap09Flux") 

65 self.process.buildActions.hist_gaap1p0_flux = LoadVector(vectorKey="{band}_gaap1p0Flux") 

66 self.process.buildActions.hist_psf_sn = SNCalculator(fluxType="{band}_psfFlux") 

67 self.process.buildActions.hist_ap09_sn = SNCalculator(fluxType="{band}_ap09Flux") 

68 self.process.buildActions.hist_gaap1p0_sn = SNCalculator(fluxType="{band}_gaap1p0Flux") 

69 

70 self.produce = HistPlot() 

71 

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

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

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

75 hist_psf_flux="psfFlux", 

76 hist_ap09_flux="ap09Flux", 

77 hist_gaap1p0_flux="gaap1p0Flux", 

78 ) 

79 self.produce.panels["panel_flux"].rangeType = "sigmaMad" 

80 self.produce.panels["panel_flux"].lowerRange = 3.5 

81 self.produce.panels["panel_flux"].upperRange = 3.5 

82 self.produce.panels["panel_flux"].referenceValue = 0.0 

83 self.produce.panels["panel_flux"].validate() 

84 

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

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

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

88 hist_psf_sn="psf S/N", 

89 hist_ap09_sn="ap09 S/N", 

90 hist_gaap1p0_sn="gaap1p0 S/N", 

91 ) 

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

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

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

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

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

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