Coverage for python/lsst/analysis/tools/atools/wholeTractImageTool.py: 52%

50 statements  

« prev     ^ index     » next       coverage.py v7.14.3, created at 2026-07-08 02:24 -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__ = ( 

24 "WholeTractImageTool", 

25 "WholeTractClippedMaskTool", 

26 "WholeTractPostageStampTool", 

27 "WholeTractNImageTool", 

28 "WholeTractMaskFractionTool", 

29) 

30 

31from ..actions.plot.calculateRange import Linear, MinMax 

32from ..actions.plot.wholeTractImage import WholeTractImage 

33from ..interfaces import AnalysisTool 

34 

35 

36class WholeTractImageTool(AnalysisTool): 

37 """Makes a figure displaying all coadd images covering a whole tract.""" 

38 

39 propagateData = True 

40 parameterizedBand = False 

41 

42 def setDefaults(self): 

43 super().setDefaults() 

44 

45 self.prep.keysToLoad = ["image"] 

46 self.produce.plot = WholeTractImage() 

47 

48 

49class WholeTractClippedMaskTool(AnalysisTool): 

50 """Makes a figure displaying the pixels flagged as CLIPPED for a whole 

51 tract.""" 

52 

53 propagateData = True 

54 parameterizedBand = False 

55 

56 def setDefaults(self): 

57 super().setDefaults() 

58 

59 self.prep.keysToLoad = ["mask"] 

60 self.produce.plot = WholeTractImage() 

61 self.produce.plot.component = "mask" 

62 self.produce.plot.bitmaskPlanes = ["CLIPPED"] 

63 self.produce.plot.interval = MinMax() 

64 self.produce.plot.stretch = Linear() 

65 

66 

67class WholeTractPostageStampTool(AnalysisTool): 

68 """Makes a postage-stamp figure displaying all coadd images covering a 

69 whole tract.""" 

70 

71 propagateData = True 

72 parameterizedBand = False 

73 

74 def setDefaults(self): 

75 super().setDefaults() 

76 

77 self.prep.keysToLoad = ["image"] 

78 self.produce.plot = WholeTractImage() 

79 self.produce.plot.displayAsPostageStamp = True 

80 

81 

82class WholeTractNImageTool(AnalysisTool): 

83 

84 propagateData = True 

85 parameterizedBand = False 

86 

87 def setDefaults(self): 

88 super().setDefaults() 

89 

90 self.produce.plot = WholeTractImage() 

91 self.produce.plot.interval = MinMax 

92 self.produce.plot.stretch = Linear() 

93 self.produce.plot.showColorbar = True 

94 self.produce.plot.zAxisLabel = "Number of input images" 

95 self.produce.plot.colorbarCmap = "viridis" 

96 self.produce.plot.noDataColor = "white" 

97 self.produce.plot.noDataValue = 0 

98 self.produce.plot.vmaxFloor = 10 

99 

100 

101class WholeTractMaskFractionTool(AnalysisTool): 

102 """Aggregates per-patch mask plane pixel fractions across a tract.""" 

103 

104 parameterizedBand = False 

105 

106 def finalize(self): 

107 super().finalize() 

108 self.produce.metric.units = {name: "" for name, _ in self.process.calculateActions.items()}