Coverage for python/lsst/analysis/tools/analysisParts/rhoStatistics.py: 30%

23 statements  

« prev     ^ index     » next       coverage.py v6.5.0, created at 2023-04-05 09: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/>. 

21 

22from __future__ import annotations 

23 

24__all__ = ("RhoStatisticsMixin",) 

25 

26from ..actions.vector import ( 

27 CalcRhoStatistics, 

28 CoaddPlotFlagSelector, 

29 DownselectVector, 

30 FlagSelector, 

31 LoadVector, 

32 MagColumnNanoJansky, 

33 SnSelector, 

34 VectorSelector, 

35) 

36from ..interfaces import AnalysisTool 

37 

38 

39class RhoStatisticsMixin(AnalysisTool): 

40 parameterizedBand: bool = True 

41 

42 def setDefaults(self): 

43 super().setDefaults() 

44 self.prep.selectors.flagSelector = CoaddPlotFlagSelector() 

45 self.prep.selectors.snSelector = SnSelector(fluxType="{band}_psfFlux", threshold=100) 

46 

47 self.process.buildActions.patchWhole = LoadVector() 

48 self.process.buildActions.patchWhole.vectorKey = "patch" 

49 

50 self.process.buildActions.mags = MagColumnNanoJansky(vectorKey="{band}_psfFlux") 

51 # pre-compute a stellar selector mask so it can be used in the filter 

52 # actions while only being computed once, alternatively the stellar 

53 # selector could be calculated and applied twice in the filter stage 

54 self.process.buildActions.starSelector = FlagSelector(selectWhenTrue=("{band}_calib_psf_used",)) 

55 

56 self.process.filterActions.xStars = DownselectVector( 

57 vectorKey="mags", selector=VectorSelector(vectorKey="starSelector") 

58 ) 

59 # downselect the psfFlux as well 

60 self.process.filterActions.psfFlux = DownselectVector( 

61 vectorKey="{band}_psfFlux", selector=VectorSelector(vectorKey="starSelector") 

62 ) 

63 self.process.filterActions.psfFluxErr = DownselectVector( 

64 vectorKey="{band}_psfFluxErr", selector=VectorSelector(vectorKey="starSelector") 

65 ) 

66 

67 self.process.filterActions.patch = DownselectVector( 

68 vectorKey="patchWhole", selector=VectorSelector(vectorKey="starSelector") 

69 ) 

70 

71 self.process.calculateActions.stars = CalcRhoStatistics() 

72 

73 self.process.calculateActions.stars.treecorr.nbins = 10 

74 self.process.calculateActions.stars.treecorr.min_sep = 0.1 

75 self.process.calculateActions.stars.treecorr.max_sep = 100.0 

76 self.process.calculateActions.stars.treecorr.sep_units = "arcmin"