Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic #195

Closed
rgoalcast opened this issue Jun 17, 2017 · 4 comments
Closed

Basic #195

rgoalcast opened this issue Jun 17, 2017 · 4 comments
Labels
not a bug this issue is not a bug question

Comments

@rgoalcast
Copy link

I am trying example from http://spiceypy.readthedocs.io/en/master/exampleone.html
I downloaded necessary file 'naif0009.tls', 'cas00084.tsc', 'cpck05Mar2004.tpc', '020514_SE_SAT105.bsp',
'981005_PLTEPH-DE405S.bsp', '030201AP_SK_SM546_T45.bsp', '04135_04171pc_psiv2.bc', 'cas_v37.tf', 'cas_iss_v09.ti' and a text file 'cassMetaK.txt' in which I am writing this as follows

\begindata

KERNELS_TO_LOAD=(
'naif0009.tls',
'cas00084.tsc',
'cpck05Mar2004.tpc',
'020514_SE_SAT105.bsp',
'981005_PLTEPH-DE405S.bsp',
'030201AP_SK_SM546_T45.bsp',
'04135_04171pc_psiv2.bc',
'cas_v37.tf',
'cas_iss_v09.ti')
\begintext

Now I am in this folder: C:\Users\Ramdayal, cassMetaK.txt and all downloaded kernel files are in the same folder C:\Users\Ramdayal, I am getting


SpiceyError Traceback (most recent call last)
in ()
----> 1 spice.furnsh("./cassMetaK.txt")

C:\Users\Ramdayal\AppData\Local\Enthought\Canopy\User\lib\site-packages\spiceypy\spiceypy.pyc in with_errcheck(*args, **kwargs)
69 try:
70 res = f(*args, **kwargs)
---> 71 checkForSpiceError(f)
72 return res
73 except:

C:\Users\Ramdayal\AppData\Local\Enthought\Canopy\User\lib\site-packages\spiceypy\spiceypy.pyc in checkForSpiceError(f)
52 msg = stypes.errorformat.format(**errorparts)
53 reset()
---> 54 raise stypes.SpiceyError(msg)
55
56

SpiceyError:

Toolkit version: N0066

SPICE(NOSUCHFILE) --

The attempt to load "./cassMetaK.txt" by the routine FURNSH failed. It could not be located.

furnsh_c --> FURNSH --> ZZLDKER

================================================================================

How can I proceed?
I am getting this correctly
spice.tkvrsn("TOOLKIT")
'CSPICE_N0066'

@AndrewAnnex
Copy link
Owner

you are not passing in the correct path to the meta kernel. Try passing in the absolute path to the meta kernel to spice.furnsh or be sure to start the python interpreter or script within that directory as you are only giving a relative path. Also as you are on windows, you may need to use windows paths ie C:\\blah\to\thing.txt not *nix style paths ie /blah/to/thing.txt. Also the paths within the meta kernel may also need to be absolute, if that still doesn't work try loading each kernel separately with furnsh without using the meta kernel.

@AndrewAnnex AndrewAnnex added question not a bug this issue is not a bug labels Jun 17, 2017
@rgoalcast
Copy link
Author

rgoalcast commented Jun 22, 2017

Thank you, Sir, I am getting the results for Cassini Position example http://spiceypy.readthedocs.io/en/master/exampleone.html,
but when I am plotting data, I am not getting the plot, and also there is not any error.

### ```
threeDPlot = Scatter3d(
    x=positions[:, 0], # X coordinates
    y=positions[:, 1], # Y coordinates
    z=positions[:, 2], # Z coordinates
    name='Cassini',
    mode='lines',
    line=Line(width=3)
)
barycenter = Scatter3d(
    x=[0],
    y=[0],
    z=[0],
    name='bc',
    mode='marker',
    marker=dict(
        size=10,
        color='orange'
    )
)
data = Data([threeDPlot, barycenter])
layout = Layout(title="SpiceyPy Cassini Position Example")
fig = dict(data=data, layout=layout)
iplot(fig)


In[]: data
Out[]:
[{'line': {'width': 3},
'mode': 'lines',
'name': 'Cassini',
'type': 'scatter3d',
'x': array([-5461446.61080924, -5405334.74422541, -5349146.94705376, ...,
-1707474.84294684, -1746356.96542149, -1783710.34586425]),
'y': array([-4434793.40785864, -4394389.30467674, -4353923.53971293, ...,
-274607.5065943 , -310089.45261548, -345300.0914401 ]),
'z': array([-1200385.93315424, -1188170.51939463, -1175938.44080957, ...,
169001.94299463, 174816.22627009, 180477.49434824])},
{'marker': {'color': 'orange', 'size': 10},
'mode': 'marker',
'name': 'bc',
'type': 'scatter3d',
'x': [0],
'y': [0],
'z': [0]}]

How can I see the plot? Thank you.

@AndrewAnnex
Copy link
Owner

AndrewAnnex commented Jun 22, 2017

The example I provided in the docs uses a library called plotly which hasn't been updated so it doesn't work, so don't use that code verbatim. Yes I do need to update that. You can plot the data using matplotlib instead, see https://matplotlib.org/examples/mplot3d/lines3d_demo.html for a simple example that should be easy to adapt to use the position data returned from spkpos.

@rgoalcast
Copy link
Author

Thank you, getting the plot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not a bug this issue is not a bug question
Projects
None yet
Development

No branches or pull requests

2 participants