Skip to content
Commits on Source (2)
%% Cell type:markdown id: tags:
## Ma_MISS example
This is an example of localization of Ma_MISS frame and instrument reading (derived from the original test script)
%% Cell type:code id: tags:
``` python
import spiceypy
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import os
```
%% Cell type:code id: tags:
``` python
# Set the base_path to the directory of the repo
base_path = '/tmp/a/mamissspice/'
os.chdir( base_path+'/kernels/')
```
%% Cell type:code id: tags:
``` python
# Load the metakernel
spiceypy.furnsh('mk/emrsp_test_rec_0003_v004.tm')
# How many kernel did we load?
spiceypy.ktotal('ALL')
```
%% Output
---------------------------------------------------------------------------
SpiceNOSUCHFILE Traceback (most recent call last)
<ipython-input-49-8f6fa52d0862> in <module>
1 # Load the metakernel
----> 2 spiceypy.furnsh('mk/emrsp_test_rec_0003_v004.tm')
3
4 # How many kernel did we load?
5 spiceypy.ktotal('ALL')
/usr/local/lib/python3.9/site-packages/spiceypy/spiceypy.py in with_errcheck(*args, **kwargs)
106 try:
107 res = f(*args, **kwargs)
--> 108 check_for_spice_error(f)
109 return res
110 except BaseException:
/usr/local/lib/python3.9/site-packages/spiceypy/spiceypy.py in check_for_spice_error(f)
89 traceback = qcktrc(200)
90 reset()
---> 91 raise stypes.dynamically_instantiate_spiceyerror(
92 short=short, explain=explain, long=long, traceback=traceback
93 )
SpiceNOSUCHFILE:
================================================================================
Toolkit version: CSPICE66
SPICE(NOSUCHFILE) --
The first file '../fk/emrsp_rm_v007.tf' specified by KERNELS_TO_LOAD in the file mk/emrsp_test_rec_0003_v004.tm could not be located.
furnsh_c --> FURNSH --> ZZLDKER
================================================================================
%% Cell type:code id: tags:
``` python
# Compute 500 time-steps between 2 sols
solStart = spiceypy.str2et("2021 APR 01 23:01:09.185 UTC")
solEnd = spiceypy.str2et("2021 APR 04 23:01:09.1850 UTC")
times = np.linspace(solStart, solEnd, num=500, endpoint=True)
```
%% Cell type:code id: tags:
``` python
# retrieve rover position at there 500 time-steps
rosalind_positions, lttimes = spiceypy.spkpos("EXOMARS ROVER", times, "IAU_MARS", "lt+s", "MARS")
```
%% Cell type:code id: tags:
``` python
# retrieve the position of CLUPI and the DRILL TIP
clupi_positions, lttimes = spiceypy.spkpos("RM_CLUPI",times, "IAU_MARS", "lt+s", "MARS")
drilltip_positions, lttimes = spiceypy.spkpos("RM_DRILL_TIP_FIX",times, "IAU_MARS", "lt+s", "MARS")
```
%% Cell type:code id: tags:
``` python
# retrieve MaMISS position
mamiss_positions, lttimes = spiceypy.spkpos("RM_MAMISS",times, "IAU_MARS", "lt+s", "MARS")
```
%% Output
---------------------------------------------------------------------------
SpiceSPKINSUFFDATA Traceback (most recent call last)
<ipython-input-46-9eef3b3a6b89> in <module>
1 # retrieve MaMISS position
----> 2 mamiss_positions, lttimes = spiceypy.spkpos("RM_MAMISS",times, "IAU_MARS", "lt+s", "MARS")
/usr/local/lib/python3.9/site-packages/spiceypy/spiceypy.py in with_errcheck(*args, **kwargs)
105 def with_errcheck(*args, **kwargs):
106 try:
--> 107 res = f(*args, **kwargs)
108 check_for_spice_error(f)
109 return res
/usr/local/lib/python3.9/site-packages/spiceypy/spiceypy.py in spkpos(targ, et, ref, abcorr, obs)
12127 for t in et:
12128 libspice.spkpos_c(targ, t, ref, abcorr, obs, ptarg, ctypes.byref(lt))
> 12129 check_for_spice_error(None)
12130 ptargs.append(stypes.c_vector_to_python(ptarg))
12131 lts.append(lt.value)
/usr/local/lib/python3.9/site-packages/spiceypy/spiceypy.py in check_for_spice_error(f)
89 traceback = qcktrc(200)
90 reset()
---> 91 raise stypes.dynamically_instantiate_spiceyerror(
92 short=short, explain=explain, long=long, traceback=traceback
93 )
SpiceSPKINSUFFDATA:
================================================================================
Toolkit version: CSPICE66
SPICE(SPKINSUFFDATA) --
Insufficient ephemeris data has been loaded to compute the position of -174500 (RM_MAMISS) relative to 0 (SOLAR SYSTEM BARYCENTER) at the ephemeris epoch 2021 APR 01 23:02:18.370.
spkpos_c --> SPKPOS --> SPKEZP --> SPKAPO --> SPKGPS
================================================================================
%% Cell type:code id: tags:
``` python
```