In [ ]:
%pylab inline

In [ ]:
from skyfield.planets import Ephemeris
import de421

eph = Ephemeris(de421)
mars = eph.mars
print eph.earth(2414993.5)

In [ ]:
earth, mars = eph.earth, eph.mars

In [ ]:
from skyfield.timelib import julian_date
from numpy import arange
jd0 = julian_date(2013, 1, 1)
y2013 = arange(jd0, jd0 + 365 // 3, 3.5)
x, y, z = mars(y2013).position

In [ ]:
print mars(y2013).position.shape
print x.shape
print y.shape
print z.shape

In [ ]:
from mpl_toolkits.mplot3d import axes3d

In [ ]:
fig = plt.figure(figsize=plt.figaspect(1.0)*2.0)
ax = fig.gca(projection='3d')

for planet in mars, earth, eph.venus, eph.mercury, eph.sun:
    x, y, z = planet(y2013).position
    ax.plot(x, y, z)

for lim in ax.set_xlim, ax.set_ylim, ax.set_zlim:
    lim(-1.3, 1.3)

In [ ]:


In [ ]:
earth, mars = eph.earth, eph.mars
print earth(2414993.5).observe(mars).astrometric()

In [ ]:
earth(y2013).observe(mars).astrometric()

In [ ]:
ra, dec = earth(y2013).observe(mars).astrometric()
plot(ra, dec)

In [ ]: