Coverage for python/lsst/sims/maf/maps/dustMap.py : 35%

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
1from lsst.sims.maf.maps import BaseMap
2from .EBVhp import EBVhp
3import warnings
5__all__ = ['DustMap']
7class DustMap(BaseMap):
8 """
9 Compute the E(B-V) for each point in a given spatial distribution of slicePoints.
10 """
12 def __init__(self, interp=False, nside=128):
13 """
14 interp: should the dust map be interpolated (True) or just use the nearest value (False).
15 """
16 self.keynames = ['ebv']
17 self.interp = interp
18 self.nside = nside
20 def run(self, slicePoints):
21 # If the slicer has nside, it's a healpix slicer so we can read the map directly
22 if 'nside' in slicePoints:
23 if slicePoints['nside'] != self.nside:
24 warnings.warn('Slicer value of nside (%i) different from map value (%i), using slicer value'
25 % (slicePoints['nside'],self.nside ))
26 slicePoints['ebv'] = EBVhp(slicePoints['nside'], pixels=slicePoints['sid'])
27 # Not a healpix slicer, look up values based on RA,dec with possible interpolation
28 else:
29 slicePoints['ebv'] = EBVhp(self.nside, ra=slicePoints['ra'],
30 dec=slicePoints['dec'], interp=self.interp)
32 return slicePoints