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)

 

發佈了74 篇原創文章 · 獲贊 11 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章