灭绝定律、地图和修正
extinctions的Python项目详细描述
灭绝
python包包括不同的灭绝定律和尘埃图。对
- 从不同的
- 获取一组坐标(或坐标列表)的e(b-v)
- 远源(IRSA,NED)
- 本地地图(SFD98、Schlafly 2014、Planck 2013、Green 2015)
- 计算不同灭绝定律的ism传输
- ccm89:cardelli、clayton和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:谷歌(http://adsabs.harvard.edu/abs/2008ApJ…686L.103G)
安装
要安装:
git clone https://github.com/nicolaschotard/extinctions.git pip install extinctions/
要在本地目录mypath中安装,请使用:
pip install --prefix='mypath' extinctions/
别忘了把它加到你的Python身上。
要升级到新版本(在git pull或本地修改之后),请使用:
pip install --upgrade (--prefix='mypath') extinctions/
要安装发行版(尚未提供发行版):
pip install http://github.com/nicolaschotard/extinctions/archive/v0.1.tar.gz
也适用于主机:
pip install (--upgrade) https://github.com/nicolaschotard/extinctions/archive/master.zip
将来,发布版本将列在此location中。
依赖关系
extinctions
在requirements文件中列出了一些python依赖项。要全部安装,请使用:
pip install -r requirements.txt
要求如下:
- numpy==1.11.2
- scipy==0.17.1
- matplotlib==1.5.1
- Seaborn==0.7.0
- pyyaml==3.11
- 星形度==1.2.1
- 请求数=2.10.0
- astroquery==0.3.1
- Wget==2.2
- 健康=1.9.1
尘埃图设置
您可以使用脚本get_maps.py
自动下载maps.yaml文件中列出的尘埃映射。它
默认情况下,会将它们放入$home/.extinction/maps中,但其他
位置当然是可能的(选项--outdir
)。如果你选择
将它们存储在其他目录中,必须设置$mapsdir环境
指向它的变量。已在输出目录中存在的映射
将不再下载。
可用的尘埃图是:
- SFD98,全天健康格式
- SFD98north和south尘埃图
- Planck
- Schlafly 2014
- Green 2015
下载地图
要下载上面列出的绝灭图,请使用脚本
get_maps.py
。提供以下选项:
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.
用法
得到e(b-v)
下面是一个如何获取一组 坐标(Ra,Dec):
In[1]:ra,dec=340.83,-9.59# could also be arrays or list of ra/decIn[2]:fromextinctionsimportreddeningIn[3]:red=reddening.Reddening(ra,dec)# ra dec can also be lists of coordinatesINFO:Loadingthemapsfromlocaldirectory/home/chotard/.extinction/maps/-greenisloaded-schlaflyisloaded-sfdisloaded-planckisloaded
然后您可以从不同的来源获得e(b-v):
# from the local mapsIn[4]:red.query_local_map(dustmap='sfd')Out[4]:0.047723956233310674In[5]:red.query_local_map(dustmap='schlafly')Out[5]:0.062566755984547445In[6]:red.query_local_map(dustmap='planck')Out[6]:0.052058338535565914In[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 astroqueryIn[9]:red.from_astroquery()Downloadinghttp://irsa.ipac.caltech.edu//workspace/TMP_XG1Joz_30445/DUST/340.8300_-9.5900.v0001/extinction.tbl|==============================================================================================|4.3k/4.3k(100.00%)0sOut[9]:[0.047377326565143825]
绘制一些图形
要了解不同的灭绝规律和尘埃分布图,你可以
使用脚本extinction_plots.py
。