These are chat archives for esa/pykep

31st
Jul 2018
oidaki
@oidaki
Jul 31 16:09

Hey folks. I'm trying to write a trajopt-type thing. I am trying to use ephemeris data to make a function that calculates net gravitational influence on a spacecraft given position and time. Simple enough, but I am having trouble with something basic: I can't get planet.spice.eph to run, even though util.load_spice_kernel seems to complete with no errors.

In issue #58 @darioizzo shared some code that seemed to work for the OP, but I just get the "spice cannot compute the ephemerides, have you loaded all needed kernel files?" error. I looked in the code, but the error is pretty impenetrable.

from pykep import util, epoch
from pykep.planet import spice

util.load_spice_kernel('de432s.bsp')
x = spice('MARS', 'EARTH')
x.eph(epoch(6000, 'mjd2000'))

this gives the aforementioned error.

Now, the reason I'm not just using jpl_lp--which works fine--is that I want to include the sun and moon. If mucking about with SPICE is overkill, I'd appreciate suggestions as to another way I can get that ephemeris data.