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

1from lsst.sims.maf.maps import BaseMap 

2from .EBVhp import EBVhp 

3import warnings 

4 

5__all__ = ['DustMap'] 

6 

7class DustMap(BaseMap): 

8 """ 

9 Compute the E(B-V) for each point in a given spatial distribution of slicePoints. 

10 """ 

11 

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 

19 

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) 

31 

32 return slicePoints 

33