1、背景知识
1.1 A NEW ELECTRON-DENSITY MODEL FOR ESTIMATION OF PULSAR AND FRB DISTANCES ,A NEW ELECTRON-DENSITY MODEL FOR ESTIMATION OF PULSAR AND FRB DISTANCES - IOPscience
YMW16是一个自由电子在银河系、麦哲伦星云和星系间介质中分布的模型,可以根据它们的位置和色散测量来估计真实或模拟的脉冲星和快速射电爆发(FRB)的距离。
YMW16 is a model for the distribution of free electrons in the Galaxy, the Magellanic Clouds and the inter-galactic medium, that can be used to estimate distances for real or simulated pulsars and fast radio bursts (FRBs) based on their position and dispersion measure.
The Galactic model is based on 189 pulsars that have independently determined distances as well as dispersion measures, whereas simpler models are used for the electron density in the MC and the IGM. It is estimated that the 95% of predicted Galactic pulsar distances will have a relative error of less than a factor of 0.9. Pulse broadening due to scattering in the Galactic interstellar medium, the Magellanic Clouds, the intergalactic medium and FRB host galaxies is estimated.
As well as the ymw16 dm-distance program, we also provide a program, ymw16_ne, which gives the electron density at any point in the Galaxy or Magellanic Clouds.
1.2 NE2001.I. A New Model for the Galactic Distribution of Free Electrons and its Fluctuations, [astro-ph/0207156] NE2001.I. A New Model for the Galactic Distribution of Free Electrons and its Fluctuations (arxiv.org)
2、 在线 app
https://apps.datacentral.org.au/pygedm/
3、python 包
4、Github
FRBs/pygedm: Python bindings for YMW16, NE2001 and YT2020 electron density models (github.com)
NOTE:
1,相关的网页已经介绍了如何安装,运行,并给出实例。如果查询少量几个,可直接在网页端查询,如果经常使用,且批量操作等等,建议安装到linux上面。
在调试的过程中,pyymw16对于ymw16的使用没有问题,但是ne2001的使用报错,没解决,甚至用官方的实例也报错,可能是我安装过程的问题,也许是编译器,没检查出来!所以单独安装了ne2001(也可不用pyymw16, 单独安装ne2001, ymw16)来调用。
2,在使用的过程中,需要注意两个点,一个是坐标的格式,和输入的坐标是银道坐标(银经,银纬 / degree);ymw16 的输入距离是 pc 为单位,ne2001是 kpc 为单位。
3,暂时不支持 windows运行。
5、下面分别是天文坐标和ne2001的参考。
5.1 Astronomical Coordinate Systems, Astronomical Coordinate Systems (astropy.coordinates) — Astropy v5.1.1
5.2 pyne2001 安装与使用_Persus的博客-CSDN博客
## 下面是是自用的python程序用来批量处理 (慎用!
# @ yin , 2022-12-12
import numpy as np import pandas as pd import matplotlib.pyplot as plt from astropy import units as u #用于单位转换的包 from astropy.coordinates import SkyCoord import pygedm ## for ymw16 and ne2001, but it is succecssful only for ywm16. import pyne2001 as pn ## so install ne2001 python package df = pd.read_csv("./filename.csv") df['ymw16'] = np.nan df['ymw16_upper'] = np.nan df['ne2001'] = np.nan df['ne2001_upper'] = np.nan ra = df.ra dec = df.dec D = df.R_Sun ## kpc for ne2001 D1 = D*1000 ## pc for ymw16 ### ymw16 #c = SkyCoord('18 01 50.52 -08 57 31.6', unit=(u.hourangle, u.deg)) #ra = "18:01:50.52" ##赤经 #dec = "-08:57:31.6" ## 赤纬 #c = SkyCoord(ra+" "+dec, unit=(u.hourangle, u.deg)) #d=c.galactic #DM, tau_sc = pygedm.dist_to_dm(d.l, d.b, 10600, method='ymw16') ## pc #### ne2001 #dist = 10.6 #para = pn.get_dm(d.l.degree, d.b.degree,dist) # kpc #para = pn.get_dm_full(d.l.degree, d.b.degree,dist) ## 1, dist to dm for i in range(len(df)): c = SkyCoord(ra[i]+" "+dec[i], frame='icrs',unit=(u.hourangle,u.deg)) d = c.galactic DM, tau_sc = pygedm.dist_to_dm(d.l, d.b, D1[i], method='ymw16') ## D1[i] / pc df.ymw16[i] = DM for i in range(len(df)): c = SkyCoord(ra[i]+" "+dec[i], frame='icrs',unit=(u.hourangle,u.deg)) d = c.galactic DM = pn.get_dm(d.l.degree, d.b.degree, D[i]) # D[i] / kpc df.ne2001[i] = DM ## 2, direction for dm_upper #""" for i in range(len(df)): c = SkyCoord(ra[i]+" "+dec[i], frame='icrs',unit=(u.hourangle,u.deg)) d = c.galactic dm_ymw16 = [] dm_ne2001 = [] for j in range(1, 50, 2): ### kpc j1 = j*1000 dm_1 = pygedm.dist_to_dm(d.l, d.b, j1, method='ymw16') ##ymw16 j1 / pc dm_2 = pn.get_dm(d.l.degree, d.b.degree, j) #ne2001, j / kpc dm_ymw16.append(float(str(dm_1[0])[0:-9])) dm_ne2001.append(dm_2) df.ymw16_upper[i] = np.max(dm_ymw16) df.ne2001_upper[i] = np.max(dm_ne2001) #""" df.to_csv("./FileName.csv",index=False,header=True)
标签:电子密度,degree,df,YMW16,ne2001,##,NE2001,dm,ymw16 From: https://www.cnblogs.com/dejiang/p/16976106.html