Extinction laws, maps and corrections
Project description
extinctions
Python package including different extinction laws and dust maps. Useful to
get E(B-V) for a set of coordinates (or list of coordinates) from different
distant sources (IRSA, NED)
local maps (SFD98, Schlafly 2014, Planck 2013, Green 2015)
compute the ISM transmission for different extincion laws
CCM89: Cardelli, Clayton and Mathis (http://adsabs.harvard.edu/abs/1989ApJ…345..245C)
OD94: O’Donnell (http://adsabs.harvard.edu/abs/1994ApJ…422..158O)
FM98: Fitzpatrick & Massa (1998)
G08: Goobar (http://adsabs.harvard.edu/abs/2008ApJ…686L.103G)
Installation
To install:
git clone https://github.com/nicolaschotard/extinctions.git 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 http://github.com/nicolaschotard/extinctions/archive/v0.1.tar.gz
Also works with the master:
pip install (--upgrade) https://github.com/nicolaschotard/extinctions/archive/master.zip
In the future, release versions will be listed at this location.
Dependencies
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 get_maps.py. 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:
SFD98, full sky Healpy format
Download the maps
To download the extinction maps listed above, use the script get_maps.py. The following options are available:
get_maps.py -h usage: get_maps.py [-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.
Usage
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()
Downloading http://irsa.ipac.caltech.edu//workspace/TMP_XG1Joz_30445/DUST/340.8300_-9.5900.v0001/extinction.tbl
|==============================================================================================| 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 extinction_plots.py.
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
File details
Details for the file extinctions-0.1.11.tar.gz
.
File metadata
- Download URL: extinctions-0.1.11.tar.gz
- Upload date:
- Size: 23.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebe44def7a85202dfe7a74db64aa150f31f029df26d6446a7d8e4daca362b953 |
|
MD5 | 251e5092c2b2e54f17a9e1d512e14475 |
|
BLAKE2b-256 | fcd545cc83a055084adb51e072d9b1fee0f36f3f9921ed28c75f4292926c70d0 |