Coverage for python/lsst/sims/maf/metrics/exgalM5.py : 44%

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
1import numpy as np
2from .baseMetric import BaseMetric
3from .simpleMetrics import Coaddm5Metric
4from lsst.sims.photUtils import Dust_values
6__all__ = ['ExgalM5']
9class ExgalM5(BaseMetric):
10 """
11 Calculate co-added five-sigma limiting depth after dust extinction.
13 Uses photUtils to calculate dust extinction.
15 Parameters
16 ----------
17 m5Col : str, opt
18 Column name for five sigma depth. Default 'fiveSigmaDepth'.
19 unit : str, opt
20 Label for units. Default 'mag'.
21 """
22 def __init__(self, m5Col='fiveSigmaDepth', metricName='ExgalM5', units='mag',
23 filterCol='filter', **kwargs):
24 # Set the name for the dust map to use. This is gathered into the MetricBundle.
25 maps = ['DustMap']
26 self.m5Col = m5Col
27 self.filterCol = filterCol
28 super().__init__(col=[self.m5Col, self.filterCol], maps=maps, metricName=metricName, units=units, **kwargs)
29 # Set the default wavelength limits for the lsst filters. These are approximately correct.
30 dust_properties = Dust_values()
31 self.Ax1 = dust_properties.Ax1
32 # We will call Coaddm5Metric to calculate the coadded depth. Set it up here.
33 self.Coaddm5Metric = Coaddm5Metric(m5Col=m5Col)
35 def run(self, dataSlice, slicePoint):
36 """
37 Compute the co-added m5 depth and then apply dust extinction to that magnitude.
38 """
39 m5 = self.Coaddm5Metric.run(dataSlice)
40 # Total dust extinction along this line of sight. Correct default A to this EBV value.
41 A_x = self.Ax1[dataSlice[self.filterCol][0]] * slicePoint['ebv']
42 return m5 - A_x