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

43 statements  

« prev     ^ index     » next       coverage.py v6.5.0, created at 2022-12-22 22:27 +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__ = ("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_09_flux = LoadVector(vectorKey="{band}_ap09Flux") 

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

66 self.process.buildActions.hist_09_sn = SNCalculator(fluxType="{band}_ap09Flux") 

67 

68 self.produce = HistPlot() 

69 

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

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

72 self.produce.panels["panel_flux"].hists = dict(hist_psf_flux="psfFlux", hist_09_flux="ap09Flux") 

73 

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

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

76 self.produce.panels["panel_sn"].hists = dict(hist_psf_sn="psfFlux S/N", hist_09_sn="ap09Flux S/N")