!which python; python -V;
from astropy import units as u
from poliastro.bodies import Earth, Mars, Sun, Moon
from poliastro.twobody import Orbit
from poliastro.ephem import Ephem
import plotly.io as pio
pio.renderers.default = "notebook_connected"
from perylune.orbit_tools import *
from perylune.horizons import *
/home/thomson/devel/perylune/venv/bin/python Python 3.8.5
# STEP 1: Get ephemerides from the Horizon database. THe closest approach is 2020-04-29,
# so use 10 days before and after it.
txt = get_ephem("1998%20OR2", "2020-04-20", '2020-05-10')
pos = process_ephem(txt)
dates, dist = extract_data(pos)
Downloading data from ssd.jpl.nasa.gov URL=https://ssd.jpl.nasa.gov/horizons_batch.cgi?batch=1&COMMAND='1998%20OR2'&CENTER='500@399'&MAKE_EPHEM='YES'&TABLE_TYPE='VECTORS'&START_TIME='2020-04-20'&STOP_TIME='2020-05-10'&STEP_SIZE='1%20d'&OUT_UNITS='KM-S'&REF_PLANE='ECLIPTIC'&REF_SYSTEM='J2000'&VECT_CORR='NONE'&VEC_LABELS='YES'&VEC_DELTA_T='NO'&CSV_FORMAT='YES'&OBJ_DATA='YES'&VEC_TABLE='3' Retrieved 12129 bytes from SSD Writing to 1998%20OR2-2020-04-20-2020-05-10.txt Found 21 lines of data
# Let's make a chart of of it
fig = dist_plot(dates, dist, "1998 OR2 asteroid, Earth fly-by 2020")
fig.show()
plot = dist_chart("1998 OR2", "2020-04-29 0:0:0", 5 * u.day)
plot
<poliastro.plotting.static.StaticOrbitPlotter at 0x7ff18a8cdbb0>
# Horizons import example, using Poliastro Ephem.from_horizons
from astropy import time
epoch = time.Time("2020-08-26 10:43")
x = Ephem.from_horizons("Ceres", epochs=epoch)
o = Orbit.from_ephem(Sun, x, epoch)