Caltech-IPAC / kete

Kete Solar System Survey tools
https://Caltech-IPAC.github.io/kete
BSD 3-Clause "New" or "Revised" License
14 stars 1 forks source link

Support for SPK Segment Type 10 #66

Open dahlend opened 4 months ago

dahlend commented 4 months ago

Hubble's spice kernels are of SPK Segment Type 10, I now have an example to add support from:

kete.spice.kernel_fetch_from_url("https://naif.jpl.nasa.gov/pub/naif/HST/kernels/spk/hst.bsp")

dahlend commented 4 months ago

I have had loading of these files working since sunday afternoon, however there is a discrepancy between neospy and SPICE.

A few things that I have discovered which are incorrect in the SPICE file for hubble:

The main issue:

After spending a few hours on this I believe there is an error in time conversion, and I am somewhat certain that this conversion is incorrect in cSPICE itself. Much of this error may be fixed by applying a small linear offset to time which causes about a 3 second offset in 2024 vs a 0 second offset in 2000. I am currently trying to diagnose the source of this, I have checked and validated that my time conversion matches cSPICE time conversion to the microsecond level. image

EDIT: I am using an external library to analyze the TLEs, which has been validated to match the official standard TLE implementation to the expected numerical precision of the TLE format. I trust this source of the computation far more than the implementation present in cSPICE.

dahlend commented 4 months ago

I will continue to work on this on my own time, but I will merge what I have for now, as it is mostly working, if not at 100%.

dahlend commented 4 months ago

For a point of comparison, here is the same plot for the difference of earths position in spice vs neospy, less than about 100 micron: image

joemasiero commented 4 months ago

I think these spikes correspond to the space shuttle servicing missions. They boosted the orbit right around the same time you're seeing the spikes, so that might be why there are differences?

dahlend commented 4 months ago

Good catch, servicing mission near may 11 2009 image

dahlend commented 4 months ago

Pretty sure their interpolation fails near those dates due to interpolation being a bad move for discontinuous events.

dahlend commented 4 months ago

Here is a more detailed plot showing the effects of interpolation, the minimums in the sin waves are when exact dates are saved in the spice kernels. The overall offset of about 17km is the underlying time conversion issue. image