Skip to main content

Extinction laws, maps and corrections

Project description

Documentation Status Code Health Travis CI build status (Linux)


Python package including different extinction laws and dust maps. Useful to


To install:

git clone
pip install extinctions/

To install in a local directory mypath, use:

pip install --prefix='mypath' extinctions/

and do not forget to add it to your PYTHONPATH.

To upgrade to a new version (after a git pull or a local modification), use:

pip install --upgrade (--prefix='mypath') extinctions/

To install a release version (no release version available yet):

pip install

Also works with the master:

pip install (--upgrade)

In the future, release versions will be listed at this location.


extinctions has a few python dependencies listed in the requirements file. To install them all, use:

pip install -r requirements.txt

Requirements are:

  • numpy==1.11.2

  • scipy==0.17.1

  • matplotlib==1.5.1

  • seaborn==0.7.0

  • pyyaml==3.11

  • astropy==1.2.1

  • requests==2.10.0

  • astroquery==0.3.1

  • wget==2.2

  • healpy==1.9.1

Dust map setup

You can automatically download the dust maps listed in the maps.yaml file using the script It will, by default, put them in $HOME/.extinction/maps, but other locations are of course possible (option –outdir). If you choose to store them in an other diretory, you must set a $MAPSDIR environment variable pointing to it. Already existing maps in the output directory will not be downloaded again.

The available dust maps are:

Download the maps

To download the extinction maps listed above, use the script The following options are available: -h
usage: [-h] [--outdir OUTDIR] [--update] [--list]
                 [--select SELECT] [--exclude EXCLUDE]

optional arguments:
   -h, --help         show this help message and exit
   --outdir OUTDIR    Output directory in where to put the dust maps
   --update           Update the maps directory in case of changes of maps.yaml
   --list             List of available maps and exit
   --select SELECT    Select maps to download (coma separated)
   --exclude EXCLUDE  Exclude map(s) (coma separated).If the select option is
                      used, the exclude option will be ignored.


Get E(B-V)

Here is an example of how to get the value of E(B-V) for a set of coordinates (RA,DEC):

In [1]: ra, dec = 340.83, -9.59 # could also be arrays or list of ra/dec
In [2]: from extinctions import reddening
In [3]: red = reddening.Reddening(ra, dec) # ra dec can also be lists of coordinates
INFO: Loading the maps from local directory /home/chotard/.extinction/maps/
- green is loaded
- schlafly is loaded
- sfd is loaded
- planck is loaded

You can then get E(B-V) from different sources:

# from the local maps
In [4]: red.query_local_map(dustmap='sfd')
Out[4]: 0.047723956233310674
In [5]: red.query_local_map(dustmap='schlafly')
Out[5]: 0.062566755984547445
In [6]: red.query_local_map(dustmap='planck')
Out[6]: 0.052058338535565914
In [7]: red.query_local_map(dustmap='green')
Out[7]: 0.035786284169101318

# from the SFD98 north/south maps using `sncosmo`
In [8]: red.from_sncosmo()
Out[8]: array([ 0.0473752])

# Using astroquery
In [9]: red.from_astroquery()
|==============================================================================================| 4.3k/4.3k (100.00%)         0s
Out[9]: [0.047377326565143825]

Make some plots

To have a look at the different extinction laws amd dust maps, you can use the script

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

extinctions-0.1.11.tar.gz (23.8 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page