vexpvat_demo.print_positionΒΆ

An example to print out the position of VEX.

Command line tool - irfpy-vexpvat-print will also help.

""" An example to print out the position of VEX.

Command line tool
- irfpy-vexpvat-print
will also help.
"""

### Spice binding (SpiceyPy) is used. Installation of SpiceyPy is needed.
### If the following ``import`` fails, the installation of SpiceyPy has not done.
### See https://irfpy.irf.se/projects/aspera/quickinstall.html
import spiceypy as spice

### VEX Spice related functionalites.
### See https://irfpy.irf.se/projects/aspera/api/api_irfpy.vexpvat.vexspice.html
### for the setup of VEX spice setting.
from irfpy.vexpvat import vexspice
vexspice.init()   # Initialize the spice.

### Use get_position function to get the position at the given time.
import datetime
t = datetime.datetime(2008, 6, 27, 0, 0, 0)    # 2008-06-27T00:00:00
pos = vexspice.get_position(t, target='VEX', origin='VENUS', frame='VSO')

print(pos)   # Position (x, y, z) in the MSO frame.  Unit is km.
# -> [-22331.32543483    665.72122225 -44568.48954004]