Coverage for python/lsst/analysis/tools/tasks/diffimTaskDetectorVisitSpatiallySampledAnalysis.py: 76%

21 statements  

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

23from typing import TYPE_CHECKING, Any, Mapping 

24 

25__all__ = ("DiffimDetectorVisitSpatiallySampledPlotsConfig", "DiffimDetectorVisitSpatiallySampledPlotsTask") 

26 

27from lsst.pipe.base import connectionTypes 

28from lsst.utils import inheritDoc 

29 

30from ..interfaces import AnalysisBaseConfig, AnalysisBaseConnections, AnalysisPipelineTask 

31 

32if TYPE_CHECKING: 32 ↛ 33line 32 didn't jump to line 33, because the condition on line 32 was never true

33 from lsst.daf.butler import DataCoordinate 

34 

35 

36class DiffimDetectorVisitSpatiallySampledPlotsConnections( 

37 AnalysisBaseConnections, 

38 dimensions=("visit", "band", "detector"), 

39 defaultTemplates={"coaddName": "goodSeeing", "fakesType": ""}, 

40): 

41 data = connectionTypes.Input( 

42 doc="QA metrics evaluated in locations throughout the difference image.", 

43 name="{fakesType}{coaddName}Diff_spatiallySampledMetrics", 

44 storageClass="ArrowAstropy", 

45 dimensions=("instrument", "visit", "detector"), 

46 deferLoad=True, 

47 ) 

48 

49 

50class DiffimDetectorVisitSpatiallySampledPlotsConfig( 

51 AnalysisBaseConfig, pipelineConnections=DiffimDetectorVisitSpatiallySampledPlotsConnections 

52): 

53 pass 

54 

55 

56class DiffimDetectorVisitSpatiallySampledPlotsTask(AnalysisPipelineTask): 

57 ConfigClass = DiffimDetectorVisitSpatiallySampledPlotsConfig 

58 _DefaultName = "DiffimDetectorVisitSpatiallySampledPlots" 

59 

60 @inheritDoc(AnalysisPipelineTask) 

61 def parsePlotInfo( 

62 self, inputs: Mapping[str, Any] | None, dataId: DataCoordinate | None, connectionName: str = "data" 

63 ) -> Mapping[str, str]: 

64 """ 

65 Notes 

66 ----- 

67 This adds a 'bands' entry to `inputs`. 

68 """ 

69 plotInfo = super().parsePlotInfo(inputs, dataId, connectionName=connectionName) 

70 plotInfo["tableName"] += f", detector: {plotInfo['detector']}" 

71 inputs["bands"] = plotInfo["band"] 

72 return plotInfo