Source code for lsst.sims.maf.maps.dustMap

from lsst.sims.maf.maps import BaseMap
from .EBVhp import EBVhp
import warnings

__all__ = ['DustMap']

[docs]class DustMap(BaseMap): """ Compute the E(B-V) for each point in a given spatial distribution of slicePoints. """ def __init__(self, interp=False, nside=128): """ interp: should the dust map be interpolated (True) or just use the nearest value (False). """ self.keynames = ['ebv'] self.interp = interp self.nside = nside
[docs] def run(self, slicePoints): # If the slicer has nside, it's a healpix slicer so we can read the map directly if 'nside' in slicePoints: if slicePoints['nside'] != self.nside: warnings.warn('Slicer value of nside (%i) different from map value (%i), using slicer value' % (slicePoints['nside'],self.nside )) slicePoints['ebv'] = EBVhp(slicePoints['nside'], pixels=slicePoints['sid']) # Not a healpix slicer, look up values based on RA,dec with possible interpolation else: slicePoints['ebv'] = EBVhp(self.nside, ra=slicePoints['ra'], dec=slicePoints['dec'], interp=self.interp) return slicePoints