CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-dustmaps

Uniform interface for multiple dust reddening maps

Overview
Eval results
Files

2d-maps.mddocs/

2D Dust Maps

Line-of-sight integrated extinction maps that provide total dust column density measurements across the sky. These maps represent the cumulative dust extinction along the entire line of sight and are the most commonly used for extinction corrections in observational astronomy.

Capabilities

SFD Map (Schlegel, Finkbeiner & Davis 1998)

The widely-used SFD'98 dust map based on IRAS and COBE observations, providing full-sky E(B-V) extinction values with ~6 arcminute resolution.

class SFDQuery(DustMap):
    def __init__(self, map_dir=None):
        """
        Initialize SFD dust map query.

        Parameters:
        - map_dir (str, optional): Directory containing SFD map files
        """

    def query(self, coords, order=1):
        """
        Query SFD E(B-V) extinction values.

        Parameters:
        - coords (SkyCoord): Coordinate positions to query
        - order (int): Interpolation order (0=nearest, 1=linear)

        Returns:
        - float | np.ndarray: E(B-V) extinction values
        """

class SFDWebQuery(WebDustMap):
    def __init__(self, api_url=None):
        """Initialize web-based SFD query (no local data required)."""

    def query(self, coords, **kwargs):
        """Query SFD via web API."""

def fetch():
    """Download SFD map data files to configured data directory."""

Usage Example:

import dustmaps.sfd
from dustmaps.sfd import SFDQuery
from astropy.coordinates import SkyCoord

# Download data (first time only)
dustmaps.sfd.fetch()

# Initialize query
sfd = SFDQuery()

# Query extinction
coord = SkyCoord(ra=180.0, dec=0.0, unit='deg', frame='icrs')
extinction = sfd(coord)
print(f"SFD E(B-V): {extinction:.4f}")

Planck Dust Maps

Dust maps from the Planck satellite providing both thermal emission and polarization-based extinction measurements.

class PlanckQuery(HEALPixFITSQuery):
    def __init__(self, map_fname=None, component='extragalactic'):
        """
        Initialize Planck 2013 dust map query.

        Parameters:
        - map_fname (str, optional): Path to Planck map file
        - component (str): Map component ('extragalactic' or 'galactic')
        """

    def query(self, coords, **kwargs):
        """
        Query Planck dust measurements.

        Parameters:
        - coords (SkyCoord): Coordinate positions to query

        Returns:
        - float | np.ndarray: Dust optical depth values
        """

class PlanckGNILCQuery(HEALPixFITSQuery):
    def __init__(self, map_fname=None):
        """Initialize Planck GNILC dust map query."""

    def query(self, coords, **kwargs):
        """Query Planck GNILC dust measurements."""

def fetch(which='2013'):
    """
    Download Planck map data.

    Parameters:
    - which (str): Map version ('2013' or 'GNILC')
    """

Corrected SFD Map (CSFD - Chiang 2023)

Temperature-corrected version of the SFD map addressing known systematic errors in the original SFD measurements.

class CSFDQuery(HEALPixQuery):
    def __init__(self, map_dir=None):
        """
        Initialize Corrected SFD (CSFD) map query.

        Parameters:
        - map_dir (str, optional): Directory containing CSFD map files
        """

    def query(self, coords, **kwargs):
        """
        Query CSFD E(B-V) extinction values.

        Parameters:
        - coords (SkyCoord): Coordinate positions to query

        Returns:
        - float | np.ndarray: Corrected E(B-V) extinction values
        """

def fetch():
    """Download CSFD map data files."""

Lenz 2017 Map

Dust map based on Planck observations with improved temperature and spectral index corrections.

class Lenz2017Query(HEALPixFITSQuery):
    def __init__(self, map_fname=None):
        """Initialize Lenz et al. 2017 dust map query."""

    def query(self, coords, **kwargs):
        """Query Lenz 2017 dust measurements."""

def fetch():
    """Download Lenz 2017 map data."""

Peek & Graves 2010 Map

High Galactic latitude dust map based on SDSS stellar photometry.

class PG2010Query(SFDBase):
    def __init__(self, map_dir=None):
        """Initialize Peek & Graves 2010 map query."""

    def query(self, coords, **kwargs):
        """Query P&G 2010 dust measurements."""

def fetch():
    """Download P&G 2010 map data."""

Burstein & Heiles 1982 Map

Classic dust reddening map based on galaxy counts, included for historical completeness.

class BHQuery(DustMap):
    def __init__(self, map_fname=None):
        """Initialize Burstein & Heiles 1982 map query."""

    def query(self, coords, **kwargs):
        """
        Query B&H reddening values.

        Returns:
        - float | np.ndarray: Reddening estimates
        """

IPHAS Map

Galactic plane extinction map derived from the IPHAS H-alpha survey.

class IPHASQuery(UnstructuredDustMap):
    def __init__(self, map_fname=None):
        """Initialize IPHAS extinction map query."""

    def query(self, coords, **kwargs):
        """
        Query IPHAS extinction values (Galactic plane coverage).

        Parameters:
        - coords (SkyCoord): Coordinate positions to query

        Returns:
        - float | np.ndarray: A_V extinction values
        """

def fetch(clobber=False):
    """Download IPHAS map data."""

Gaia Total Galactic Extinction Map

All-sky extinction map derived from Gaia stellar observations.

class GaiaTGEQuery(HEALPixQuery):
    def __init__(self, map_fname=None, **kwargs):
        """Initialize Gaia Total Galactic Extinction map query."""

    def query(self, coords, **kwargs):
        """Query Gaia TGE extinction values."""

def fetch():
    """Download Gaia TGE map data."""

Common Usage Patterns

Comparing Multiple 2D Maps

from dustmaps.sfd import SFDQuery
from dustmaps.planck import PlanckQuery
from dustmaps.csfd import CSFDQuery
from astropy.coordinates import SkyCoord

# Initialize multiple maps
sfd = SFDQuery()
planck = PlanckQuery()
csfd = CSFDQuery()

# Query same coordinates
coord = SkyCoord(ra=180.0, dec=30.0, unit='deg', frame='icrs')

sfd_ext = sfd(coord)
planck_ext = planck(coord)
csfd_ext = csfd(coord)

print(f"SFD: {sfd_ext:.4f}")
print(f"Planck: {planck_ext:.4f}")
print(f"CSFD: {csfd_ext:.4f}")

Batch Processing

import numpy as np
from dustmaps.sfd import SFDQuery
from astropy.coordinates import SkyCoord

sfd = SFDQuery()

# Generate grid of coordinates
ra_grid = np.linspace(0, 360, 100)
dec_grid = np.linspace(-90, 90, 50)
ra_flat, dec_flat = np.meshgrid(ra_grid, dec_grid)

coords = SkyCoord(
    ra=ra_flat.flatten(),
    dec=dec_flat.flatten(),
    unit='deg',
    frame='icrs'
)

# Query all coordinates at once
extinctions = sfd(coords)
extinction_grid = extinctions.reshape(50, 100)

Install with Tessl CLI

npx tessl i tessl/pypi-dustmaps

docs

2d-maps.md

3d-maps.md

base-classes.md

config.md

index.md

tile.json