YMW16电子密度模型的Python/C++版本
pyymw16的Python项目详细描述
pyymw16
^ {EM1}$python /c++版本的YMW16电子密度模型 这是姚、曼彻斯特和Wang的Python/C++端口(2017,^ {A4});
arXiv:1610.09448)ymw16电子密度模型。
代码使用pybind11
为(C++移植)的YMW16代码创建Python绑定。 一些用法示例可以在examples directory中找到。 这些方法返回astropyQuantities,该方法附加了单位,并且可以接受astropyAngles和数量作为参数: 需要PybDn11、AtsiPy和一个带有C++ 11支持的新式C编译器(Ubuntu 16.04 +默认GCC将工作)。 您应该可以使用以下命令安装: 或者,下载此存储库并通过 要运行单元测试,请运行 YMW16是星系中自由电子分布的模型,
麦哲伦云和星系间介质
估算真实或模拟脉冲星和快速无线电的距离
基于位置和色散测量的突发(FRB)。 银河系模型是基于189个脉冲星,它们独立地
确定的距离和分散措施
模型用于mc和igm中的电子密度。它是
估计95%的银河脉冲星距离
相对误差小于系数0.9。脉冲展宽
由于在银河系星际介质中的散射,麦哲伦
云,星系际介质和FRB宿主星系的估计。 除了YMW16dm距离程序,我们还提供了一个程序,
Ymw16_-ne,它给出了星系中任何一点的电子密度
或者麦哲伦云。 一篇论文(姚,曼彻斯特和王,2017,Astrophys. J., 835, 29;
arXiv:1610.09448)描述模型并比较其预测
与早期的星系电子密度模型相比。YMW16是
估算河外脉冲星的第一个电子密度模型
距离和frb距离。 要生成程序的命令行可执行版本,请下载并
解包程序的最新版本。然后运行“make_ymw16”至
创建可执行文件。可以设置环境变量ymw16_dir
指向包含ymw16par.txt和
spiral.txt文件。运行时需要访问这些文件。 允许交互式访问YMW16距离模型和
最新程序版本的下载可在
http://www.xao.ac.cn/ymw16/,
http://www.atnf.csiro.au/research/pulsar/ymw16/和
https://bitbucket.org/psrsoft/ymw16/。 请报告任何问题或错误
https://bitbucket.org/psrsoft/ymw16/issues/new/或直接到
作者。请举例说明这个问题。使用量
importpyymw16# calculate DM at a given distanceDM,tau_sc=pyymw16.dist_to_dm(204.0,-6.5,200)# calculate distance for a given sky position and DMdist,tau_sc=pyymw16.dm_to_dist(123.4,4.0,200)# calculate N_e density at xyz galactocentric coordinatesne=pyynmw16.calculate_electron_density_xyz(1.0,2.0,3.0)# calculate N_e density at Galactic lat/long/distance coordsne=pyynmw16.calculate_electron_density_lbr(204.0,-6.5,3000.0)
importpyymw16importastropy.unitsasuimportastropy.coordinatesascDM=u.Quantity(10.0,unit='pc cm^-3')ra,dec=c.Angle(23.0,unit='hourangle'),c.Angle('-43:00:02',unit='degree')sky_coords=c.SkyCoord(ra,dec,frame='icrs')dist,tau_sc=pyymw16.dm_to_dist(sky_coords.galactic.l,sky_coords.galactic.b,DM)print(dist.to('lyr'))>>3362.16343117lyrprint(tau_sc.to('ns'))>>7.758686138ns
安装
pip install git+https://github.com/telegraphic/pyymw16
python setup.py install
python setup.py test
。注意,这些测试只检查python绑定,而不是底层c源代码。YMw16 C自述文件
YMW16 C许可证
Copyright (C) 2016, 2017 J. M. Yao, R. N. Manchester, N. Wang.
YMW16 is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
YMW16 is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License,
available at http://www.gnu.org/licenses/, for more details.
Jumei Yao (yaojumei _@_ xao.ac.cn), Richard N Manchester
(dick.manchester _@_ csiro.au), Na Wang (na.wang _@_ xao.ac.cn)
推荐PyPI第三方库