poliastro行星际动力学python包安装使用

1 安装

1) python下面可以用conda和pip安装。为了加快速度,用国内镜像

2)可以用Jupyter,需要安装node.js,然后在jupyter terminal中或者command prompt中用npm安装:

jupyterlab-manager, plotlywidget, jupyterlab-plotly。也可以使用npm的镜像或者代理。

$ jupyter labextension install @jupyter-widgets/jupyterlab-manager
$ jupyter labextension install plotlywidget
$ jupyter labextension install @jupyterlab/plotly-extension

安装完后,在jupyterlab中执行下述代码,如果图形出现,证明可以使用。

from astropy import units as u

from poliastro.bodies import Earth, Mars, Sun
from poliastro.twobody import Orbit
# Data from Curtis, example 4.3
r = [-6045, -3490, 2500] * u.km
v = [-3.457, 6.618, 2.533] * u.km / u.s

ss = Orbit.from_vectors(Earth, r, v)
ss.plot()

2 使用

poliastro软件包的基础是orbit对象,它在twobody模块中定义。它的主要属性参数包括中心天体、轨道位置和速度(轨道根数)、时刻等。

#kepler轨道根数
# Data for Mars at J2000 from JPL HORIZONS
a = 1.523679 * u.AU
ecc = 0.093315 * u.one
inc = 1.85 * u.deg
raan = 49.562 * u.deg
argp = 286.537 * u.deg
nu = 23.33 * u.deg
ss = Orbit.from_classical(Sun, a, ecc, inc, raan, argp, nu)
发布了80 篇原创文章 · 获赞 14 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/novanova2009/article/details/103933424