AstroPy距离红移转换精度
Precision of AstroPy distance redshift conversion
AstroPy.coordinates.Distance
函数的红移转换精度如何?
它似乎只对千分之一位有用(比浮点数精度问题精确得多):
from astropy import units as u
from astropy.coordinates import SkyCoord, Distance
from astropy.cosmology import Planck15
z1 = 0.05598
z2 = 0.31427
dist1 = Distance(unit=u.pc, z = z1, cosmology = Planck15)
dist2 = Distance(unit=u.pc, z = z2, cosmology = Planck15)
dist1.z #prints 0.05718
dist2.z #prints 0.31916
我正在使用它来计算河外源之间的 3D 距离,这些差异在 Mpc 的数量级上,这对于我正在研究的内容来说非常大。这是 AstroPy 不可避免的限制吗?
这适用于 python 3.7.
的 astropy 3.2.1
from astropy import units as u
from astropy.coordinates import SkyCoord, Distance
from astropy.cosmology import Planck15
z1 = 0.05598
z2 = 0.31427
dist1 = Distance(unit=u.pc, z = z1, cosmology = Planck15)
dist2 = Distance(unit=u.pc, z = z2, cosmology = Planck15)
dist1.z
Out[9]: 0.055979999974738834
dist2.z
Out[10]: 0.31427000077974493
看起来计算精度到 7 位有效数字左右。
z3 = 1.31427987654321
dist3 = Distance(unit=u.pc, z = z3, cosmology = Planck15)
dist3.z
Out[23]: 1.3142798808605372
z4 = 900.31427987654321
dist4 = Distance(unit=u.pc, z = z4, cosmology = Planck15)
dist4.z
Out[29]: 900.3142861453044
在接近 z=1000 的某个地方,这将 return 一个错误,指出该值已达到最大值,因为此时您已接近 CMB 区域。
AstroPy.coordinates.Distance
函数的红移转换精度如何?
它似乎只对千分之一位有用(比浮点数精度问题精确得多):
from astropy import units as u
from astropy.coordinates import SkyCoord, Distance
from astropy.cosmology import Planck15
z1 = 0.05598
z2 = 0.31427
dist1 = Distance(unit=u.pc, z = z1, cosmology = Planck15)
dist2 = Distance(unit=u.pc, z = z2, cosmology = Planck15)
dist1.z #prints 0.05718
dist2.z #prints 0.31916
我正在使用它来计算河外源之间的 3D 距离,这些差异在 Mpc 的数量级上,这对于我正在研究的内容来说非常大。这是 AstroPy 不可避免的限制吗?
这适用于 python 3.7.
的 astropy 3.2.1from astropy import units as u
from astropy.coordinates import SkyCoord, Distance
from astropy.cosmology import Planck15
z1 = 0.05598
z2 = 0.31427
dist1 = Distance(unit=u.pc, z = z1, cosmology = Planck15)
dist2 = Distance(unit=u.pc, z = z2, cosmology = Planck15)
dist1.z
Out[9]: 0.055979999974738834
dist2.z
Out[10]: 0.31427000077974493
看起来计算精度到 7 位有效数字左右。
z3 = 1.31427987654321
dist3 = Distance(unit=u.pc, z = z3, cosmology = Planck15)
dist3.z
Out[23]: 1.3142798808605372
z4 = 900.31427987654321
dist4 = Distance(unit=u.pc, z = z4, cosmology = Planck15)
dist4.z
Out[29]: 900.3142861453044
在接近 z=1000 的某个地方,这将 return 一个错误,指出该值已达到最大值,因为此时您已接近 CMB 区域。