I am trying to define a reference frame in SPICE that is

  • Centered on a particular body, for example Mars, and
  • with axes parallel to J2000/ICRF

After going through the required reading for reference frames it's still not clear to me how to proceed. This is what I tried, based on one of the examples:


      FRAME_MARSJ2000          = 4990000
      FRAME_4990000_NAME       = 'MARSJ2000'
      FRAME_4990000_CLASS      = 4
      FRAME_4990000_CLASS_ID   = 4990000
      FRAME_4990000_CENTER     = 499

      TKFRAME_4990000_SPEC     = 'MATRIX'
      TKFRAME_4990000_RELATIVE = 'J2000'
      TKFRAME_4990000_MATRIX   = ( 1,
                                   1 )


However, it seems to me that it's only using the rotation information, and not using the _CENTER as an offset:

In [39]: import spiceypy as spice
    ...: spice.tkvrsn('TOOLKIT')
    ...: spice.furnsh("mars_j2000.tf")
    ...: spice.furnsh("/home/juanlu/Downloads/GMAT/R2018a/data/planetary_ephem/spk/DE421AllPlanets.bsp")
    ...: spice.spkezr("mars", 0.0, "j2000", "none", "ssb")[0][:3]
Out[39]: array([ 2.06980542e+08, -1.86369836e+05, -5.66723310e+06])

In [40]: spice.spkezr("mars", 0.0, "marsj2000", "none", "ssb")[0][:3]
Out[40]: array([ 2.06980542e+08, -1.86369836e+05, -5.66723310e+06])

Any ideas?

  • $\begingroup$ Is it even using the rotation information? Unless I'm missing something, you're getting the exact same answer in both cases, there isn't even a correction for rotation. Try "MARSJ2000" in all caps to see if that helps, but regular SPICE complains if you try to use a non-existent frame. $\endgroup$
    – user7073
    Sep 2 '18 at 19:21
  • $\begingroup$ @barrycarter the matrix is the identity, so the fact that it's not changing due to rotation is at least acceptable. I expected a translation though. $\endgroup$ Sep 2 '18 at 19:38
  • $\begingroup$ Try tweaking the matrix to see if it's even reading the file. Or use strace or something. First step debugging: make sure it sees the file. $\endgroup$
    – user7073
    Sep 2 '18 at 19:41
  • $\begingroup$ I've been suggested on Twitter that this cannot be done: twitter.com/DegenerateConic/status/1036380843823038464 $\endgroup$ Sep 3 '18 at 0:04
  • $\begingroup$ You can always change "ssb" to 499 or "mars" or something in line 40. Although I'm guessing this is just test code, not what you're actually trying to do. $\endgroup$
    – user7073
    Sep 3 '18 at 0:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.