备注
Go to the end 下载完整的示例代码
将径向速度转换为星系静止标准(GSR)#
在日心坐标系或太阳系重心坐标系中,经常会报告源的径向速度或视线速度。一个常见的变换是将太阳的运动沿视线投射到目标上,因此将其转换为银河系静止帧(有时称为银河系静止标准,GSR)。这种转换依赖于关于银河系相对于巴里系或日心系的方位的假设。它还取决于假定的太阳速度矢量。在这里,我们将演示如何使用天空位置和重心径向速度执行此转换。
By: Adrian Price-Whelan
许可证:BSD
导入所需的Astroy包:
import astropy.coordinates as coord
import astropy.units as u
使用银河系中心坐标的最新约定
coord.galactocentric_frame_defaults.set("latest")
<ScienceState galactocentric_frame_defaults: {'galcen_coord': <ICRS Coordinate: (ra, dec) in deg...>
在本例中,让我们使用恒星HD 155967的坐标和质心径向速度,从 Simbad :
下一步我们需要确定太阳在假定的GSR框架中的速度。我们将使用与 Galactocentric
帧,并将其转换为 CartesianRepresentation
对象使用 .to_cartesian()
方法 CartesianDifferential
对象 galcen_v_sun
:
v_sun = coord.Galactocentric().galcen_v_sun.to_cartesian()
我们现在需要从上面的ICRS帧中的天空位置得到一个假定银河系的单位矢量。我们将使用这个单位向量将太阳速度投影到视线上:
现在我们用这个单位向量来预测太阳速度:
最后,我们将太阳速度的投影与径向速度相加,得到GSR径向速度:
rv_gsr = icrs.radial_velocity + v_proj
print(rv_gsr)
123.30460087379765 km / s
我们可以将它包装在一个函数中,这样我们就可以控制太阳速度并重复使用上面的代码:
def rv_to_gsr(c, v_sun=None):
"""Transform a barycentric radial velocity to the Galactic Standard of Rest
(GSR).
The input radial velocity must be passed in as a
Parameters
----------
c : `~astropy.coordinates.BaseCoordinateFrame` subclass instance
The radial velocity, associated with a sky coordinates, to be
transformed.
v_sun : `~astropy.units.Quantity`, optional
The 3D velocity of the solar system barycenter in the GSR frame.
Defaults to the same solar motion as in the
`~astropy.coordinates.Galactocentric` frame.
Returns
-------
v_gsr : `~astropy.units.Quantity`
The input radial velocity transformed to a GSR frame.
"""
if v_sun is None:
v_sun = coord.Galactocentric().galcen_v_sun.to_cartesian()
gal = c.transform_to(coord.Galactic)
cart_data = gal.data.to_cartesian()
unit_vector = cart_data / cart_data.norm()
v_proj = v_sun.dot(unit_vector)
return c.radial_velocity + v_proj
rv_gsr = rv_to_gsr(icrs)
print(rv_gsr)
123.30460087379765 km / s
Total running time of the script: (0分0.014秒)