python使用skyfiled进行轨道计算

python使用skyfiled进行轨道计算,第1张

python使用skyfiled进行轨道计算

python 使用skyfield进行轨道计算

pip install skyfield

依赖numpy,scipy, 建议安装anaconda

计算火星在天空中的位置:

from skyfield.api import load

# Create a timescale and ask the current time.
ts = load.timescale()
t = ts.now()

# Load the JPL ephemeris DE421 (covers 1900-2050).
planets = load('de421.bsp')
earth, mars = planets['earth'], planets['mars']

# What's the position of Mars, viewed from Earth?
astrometric = earth.at(t).observe(mars)
ra, dec, distance = astrometric.radec()

print(ra)
print(dec)
print(distance)

输出为:

10h 47m 56.24s
+09deg 03' 23.1"
2.33251 au

相比较PyEphem 而言,skyfiled 全部由python编写,更容易发挥python的优势,在后续的版本升级和迭代支持优于PyEphem,毕竟PyEphem的官网也写了,如果是新研发的项目,建议使用skyfield。

参见Skyfield — documentationhttps://rhodesmill.org/skyfield/

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5701383.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存