如何使用 python astropy 将 arcsec 转换为 Mpc?
How to convert arcsec to Mpc using python astropy?
我需要将以下量从弧秒转换为百万秒差距:
a = 737.28 # arcsec
z = 0.3 # redshift
d = ? # Mpc
I am using flat lambdaCDM using parameters
H0 = 67.8
omega_m = 0.308
使用的宇宙学:Ade 等人 2016
https://arxiv.org/pdf/1502.01589.pdf 表 1 2013F(DS)
到目前为止我已经试过了,
from astropy.cosmology import FlatLambdaCDM
import astropy.units as u
cosmo = FlatLambdaCDM(H0=70, Om0=0.3)
cosmo.luminosity_distance(z=0.3)
# I am not sure how to convert arcsec to Mpc here.
备选方案:
http://arcsec2parsec.joseonorbe.com/index.html
这有效并给出了 3.38 Mpc,但我不能简单地引用一个网站,希望使用 python.
重现结果
要计算距离,您需要将 angular 直径距离乘以 angular 大小。
l = D_A(z) × θ
参考:http://arcsec2parsec.joseonorbe.com/about.html
from astropy.cosmology import FlatLambdaCDM
import numpy as np
cosmo = FlatLambdaCDM(H0=67.8, Om0=0.308)
# angular diameter distance in Mpc
d_A = cosmo.angular_diameter_distance(z=0.3)
theta = 737.28 # arcsec
# pi radian = 180 degree ==> 1deg = pi/180 ==> 1arcsec = pi/180/3600
theta_radian = theta * np.pi / 180 / 3600
# arc length = radius * angle
distance_Mpc = d_A * theta_radian
print(distance_Mpc) # 3.3846475 Mpc
更新
正如评论中所建议的,我们也可以使用天文单位,
from astropy.cosmology import FlatLambdaCDM
import numpy as np
from astropy import units as u
cosmo = FlatLambdaCDM(H0=67.8, Om0=0.308)
d_A = cosmo.angular_diameter_distance(z=0.3)
print(d_A) # 946.9318492873492 Mpc
theta = 737.28*u.arcsec
distance_Mpc = (theta * d_A).to(u.Mpc, u.dimensionless_angles()) # unit is Mpc only now
print(distance_Mpc) # 3.384745689510495 Mpc
我需要将以下量从弧秒转换为百万秒差距:
a = 737.28 # arcsec
z = 0.3 # redshift
d = ? # Mpc
I am using flat lambdaCDM using parameters
H0 = 67.8
omega_m = 0.308
使用的宇宙学:Ade 等人 2016 https://arxiv.org/pdf/1502.01589.pdf 表 1 2013F(DS)
到目前为止我已经试过了,
from astropy.cosmology import FlatLambdaCDM
import astropy.units as u
cosmo = FlatLambdaCDM(H0=70, Om0=0.3)
cosmo.luminosity_distance(z=0.3)
# I am not sure how to convert arcsec to Mpc here.
备选方案: http://arcsec2parsec.joseonorbe.com/index.html
这有效并给出了 3.38 Mpc,但我不能简单地引用一个网站,希望使用 python.
重现结果要计算距离,您需要将 angular 直径距离乘以 angular 大小。
l = D_A(z) × θ
参考:http://arcsec2parsec.joseonorbe.com/about.html
from astropy.cosmology import FlatLambdaCDM
import numpy as np
cosmo = FlatLambdaCDM(H0=67.8, Om0=0.308)
# angular diameter distance in Mpc
d_A = cosmo.angular_diameter_distance(z=0.3)
theta = 737.28 # arcsec
# pi radian = 180 degree ==> 1deg = pi/180 ==> 1arcsec = pi/180/3600
theta_radian = theta * np.pi / 180 / 3600
# arc length = radius * angle
distance_Mpc = d_A * theta_radian
print(distance_Mpc) # 3.3846475 Mpc
更新
正如评论中所建议的,我们也可以使用天文单位,
from astropy.cosmology import FlatLambdaCDM
import numpy as np
from astropy import units as u
cosmo = FlatLambdaCDM(H0=67.8, Om0=0.308)
d_A = cosmo.angular_diameter_distance(z=0.3)
print(d_A) # 946.9318492873492 Mpc
theta = 737.28*u.arcsec
distance_Mpc = (theta * d_A).to(u.Mpc, u.dimensionless_angles()) # unit is Mpc only now
print(distance_Mpc) # 3.384745689510495 Mpc