Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

from .baseMetric import BaseMetric 

from .simpleMetrics import Coaddm5Metric 

from lsst.sims.photUtils import Sed 

 

__all__ = ['ExgalM5', 'ExgalM5_cut'] 

 

class ExgalM5(BaseMetric): 

""" 

Calculate co-added five-sigma limiting depth after dust extinction. 

 

Uses photUtils 

""" 

def __init__(self, m5Col='fiveSigmaDepth', units='mag', 

lsstFilter='r', wavelen_min=None , wavelen_max=None , wavelen_step=1., **kwargs ): 

""" 

Args: 

m5Col (str): Column name that ('fiveSigmaDepth') 

units (str): units of the metric ('mag') 

lsstFilter (str): Which LSST filter to calculate m5 for 

wavelen_min (float): Minimum wavength of your filter (None) 

wavelen_max (float): (None) 

wavelen_step (float): (1.) 

**kwargs: 

""" 

maps = ['DustMap'] 

waveMins={'u':330.,'g':403.,'r':552.,'i':691.,'z':818.,'y':950.} 

waveMaxes={'u':403.,'g':552.,'r':691.,'i':818.,'z':922.,'y':1070.} 

 

if lsstFilter is not None: 

wavelen_min = waveMins[lsstFilter] 

wavelen_max = waveMaxes[lsstFilter] 

 

self.m5Col = m5Col 

super(ExgalM5, self).__init__(col=[self.m5Col], 

maps=maps, units=units, **kwargs) 

 

testsed = Sed() 

testsed.setFlatSED(wavelen_min = wavelen_min, 

wavelen_max = wavelen_max, wavelen_step = 1) 

self.a,self.b = testsed.setupCCM_ab() 

self.R_v = 3.1 

self.Coaddm5Metric = Coaddm5Metric(m5Col=m5Col) 

 

 

def run(self, dataSlice, slicePoint=None): 

""" 

Compute the co-added m5 depth and then apply extinction to that magnitude. 

 

Args: 

dataSlice (np.array): 

slicePoint (dict): 

Returns: 

float that is the dust atennuated co-added m5-depth. 

""" 

 

m5 = self.Coaddm5Metric.run(dataSlice) 

A_x = (self.a[0]+self.b[0]/self.R_v)*(self.R_v*slicePoint['ebv']) 

result = m5-A_x 

return result 

 

 

class ExgalM5_cut(BaseMetric): 

""" 

Calculate co-added five-sigma limiting depth after dust extinction  

and depth cuts 

 

A copy of ExgalM5 for use of FoMEmulator as a Summary Metric on this. 

""" 

def __init__(self, m5Col='fiveSigmaDepth', units='mag', 

lsstFilter='i', wavelen_min=None, wavelen_max=None, 

wavelen_step=1., extinction_cut=0.2, depth_cut=26, **kwargs): 

""" 

Args:  

m5Col (str): Column name that ('fiveSigmaDepth') 

units (str): units of the metric ('mag') 

lsstFilter (str): Which LSST filter to calculate m5 for 

wavelen_min (float): Minimum wavength of your filter (None) 

wavelen_max (float): (None) 

wavelen_step (float): (1.) 

**kwargs: 

""" 

maps = ['DustMap'] 

waveMins={'u':330., 'g':403., 'r':552., 'i':691., 'z':818., 'y':950.} 

waveMaxes={'u':403., 'g':552., 'r':691., 'i':818., 'z':922., 'y':1070.} 

 

if lsstFilter is not None: 

wavelen_min = waveMins[lsstFilter] 

wavelen_max = waveMaxes[lsstFilter] 

 

self.m5Col = m5Col 

super(ExgalM5_cut, self).__init__(col=[self.m5Col], 

maps=maps, 

units=units, 

**kwargs 

) 

 

testsed = Sed() 

testsed.setFlatSED(wavelen_min=wavelen_min, 

wavelen_max=wavelen_max, 

wavelen_step=1) 

self.a,self.b = testsed.setupCCM_ab() 

self.R_v = 3.1 

self.Coaddm5Metric = Coaddm5Metric(m5Col=m5Col) 

 

self.extinction_cut = extinction_cut 

self.depth_cut = depth_cut 

 

 

def run(self, dataSlice, slicePoint=None): 

""" 

Compute the co-added m5 depth and then apply extinction cut 

and depth cut to that magnitude. 

 

Args: 

dataSlice (ndarray): Values passed to metric by the slicer,  

which the metric will use to calculate metric values  

at each slicePoint. 

slicePoint (Dict): Dictionary of slicePoint metadata passed 

to each metric. 

Returns: 

float: the dust atennuated co-added m5-depth. 

""" 

 

if slicePoint['ebv'] > self.extinction_cut: 

return self.badval 

 

m5 = self.Coaddm5Metric.run(dataSlice) 

A_x = (self.a[0] + self.b[0]/self.R_v) * (self.R_v*slicePoint['ebv']) 

result = m5-A_x 

if result < self.depth_cut: 

return self.badval 

else: 

return result