[Spice_discussion] PySPICE

Bridgman, William T. William.T.Bridgman at nasa.gov
Tue Mar 22 13:18:48 PDT 2011


Had to make some adjustments for the ephemeris ('mpo' apparently isn't  
in any of my kernels) and python namespace, but I got this to build  
and work on Mac OS X 10.5, probably 32-bit.

Tom

On Mar 22, 2011, at 7:52 AM, K.-Michael Aye wrote:

> Dear all,
>
> I just wanted to let you know, that with the help of Roberto we got  
> his PySPICE code working on current Snow Leopard Macbooks.
> The current restriction is that cells and windows are not  
> implemented (yet, some start is provided by Roberto), but if you can  
> live without it, it allows already beautifully simple SPICE workings:
>
> from matplotlib.pylab import plot,show
> from spice import *
> import datetime
> import sys
>
> furnsh('bepic.mk')
>
> radii = bodvrd('MERCURY','RADII',3)
> print radii
> daterange=['2021 JAN 30 12:00:00.000', '2022 MAY 02 03:42:42.623']
>
> et1 = utc2et(daterange[0])
> et2 = utc2et(daterange[1])
> print et2utc(et2,'ISOC',5)
> times = linspace(et1,et2,100)
> print et2utc(times[-1],'ISOC',5)
>
> distances = []
> for t in times:
>    try:
>        pos = spkpos('mercury',t,'j2000','none','mpo')
>    except SpiceException:
>        print 'caught error'
>        sys.exit(1)
>    distances.append(vnorm(pos[0]))
>
> plot(times,array(distances)-radii[1][0])
> show()
>
> His code is available at
> https://github.com/rca/PySPICE
>
> Have fun!
> Michael
>
>
> _______________________________________________
> Spice_discussion mailing list
> Spice_discussion at naif.jpl.nasa.gov
> http://naif.jpl.nasa.gov/mailman/listinfo/spice_discussion

--
Dr. William T."Tom" Bridgman               Scientific Visualization  
Studio
Global Science & Technology, Inc.          NASA/Goddard Space Flight  
Center
Email: William.T.Bridgman at nasa.gov         Code 610.3
Phone: 301-286-1346                        Greenbelt, MD 20771
FAX:   301-286-1634                        http://svs.gsfc.nasa.gov/






More information about the Spice_discussion mailing list