Hello! I am a planetary scientist and avid coder. I like to make computers do science, and I am also the author of the SpiceyPy Python library.
Here's some mars for now (btw I made this elevation model)
SpiceyPy: a Pythonic Wrapper for the SPICE Toolkit.
License: MIT License
I tried it on python 3.3 and 3.4:
± python setup.py develop
running develop
running egg_info
writing SpiceyPy.egg-info/PKG-INFO
writing dependency_links to SpiceyPy.egg-info/dependency_links.txt
writing top-level names to SpiceyPy.egg-info/top_level.txt
writing requirements to SpiceyPy.egg-info/requires.txt
reading manifest file 'SpiceyPy.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'SpiceyPy.egg-info/SOURCES.txt'
running build_ext
Creating /Users/maye/miniconda3/envs/py33/lib/python3.3/site-packages/SpiceyPy.egg-link (link to .)
Adding SpiceyPy 0.5.2 to easy-install.pth file
Installed /Users/maye/Dropbox/src/SpiceyPy
Processing dependencies for SpiceyPy==0.5.2
Finished processing dependencies for SpiceyPy==0.5.2
and get the same error when trying to import it:
) ipython
Python 3.3.5 |Continuum Analytics, Inc.| (default, Sep 2 2014, 13:57:31)
Type "copyright", "credits" or "license" for more information.
IPython 2.2.0 -- An enhanced Interactive Python.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import SpiceyPy as spice
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-747380d12fa3> in <module>()
----> 1 import SpiceyPy as spice
/Users/maye/Dropbox/src/SpiceyPy/SpiceyPy/__init__.py in <module>()
3 __all__ = ['wrapper']
4
----> 5 from SpiceyPy.wrapper import *
6
7 #Default setting for error reporting so that programs don't just exit out!
/Users/maye/Dropbox/src/SpiceyPy/SpiceyPy/wrapper.py in <module>()
4 import ctypes
5 import SpiceyPy.support_types as stypes
----> 6 from SpiceyPy.libspice import libspice
7 import numpy
8
/Users/maye/Dropbox/src/SpiceyPy/SpiceyPy/libspice.py in <module>()
26 libspice.badkpv_c.argtypes = [c_char_p, c_char_p, c_char_p, c_int, c_int, c_char]
27 libspice.badkpv_c.restype = c_bool
---> 28 libspice.bltfrm_c.argtypes = [c_int, POINTER(stypes.SpiceCell)]
29 libspice.bodfnd_c.argtypes = [c_int, c_char_p]
30 libspice.bodfnd_c.restype = c_bool
/Users/maye/miniconda3/envs/py33/lib/python3.3/ctypes/__init__.py in __getattr__(self, name)
364 if name.startswith('__') and name.endswith('__'):
365 raise AttributeError(name)
--> 366 func = self.__getitem__(name)
367 setattr(self, name, func)
368 return func
/Users/maye/miniconda3/envs/py33/lib/python3.3/ctypes/__init__.py in __getitem__(self, name_or_ordinal)
369
370 def __getitem__(self, name_or_ordinal):
--> 371 func = self._FuncPtr((name_or_ordinal, self))
372 if not isinstance(name_or_ordinal, int):
373 func.__name__ = name_or_ordinal
AttributeError: dlsym(0x102584580, bltfrm_c): symbol not found
for 3.4:
) ipython
Python 3.4.1 |Continuum Analytics, Inc.| (default, Sep 2 2014, 14:03:45)
Type "copyright", "credits" or "license" for more information.
IPython 2.2.0 -- An enhanced Interactive Python.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import SpiceyPy
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-756a48dc04ba> in <module>()
----> 1 import SpiceyPy
/Users/maye/Dropbox/src/SpiceyPy/SpiceyPy/__init__.py in <module>()
3 __all__ = ['wrapper']
4
----> 5 from SpiceyPy.wrapper import *
6
7 #Default setting for error reporting so that programs don't just exit out!
/Users/maye/Dropbox/src/SpiceyPy/SpiceyPy/wrapper.py in <module>()
4 import ctypes
5 import SpiceyPy.support_types as stypes
----> 6 from SpiceyPy.libspice import libspice
7 import numpy
8
/Users/maye/Dropbox/src/SpiceyPy/SpiceyPy/libspice.py in <module>()
26 libspice.badkpv_c.argtypes = [c_char_p, c_char_p, c_char_p, c_int, c_int, c_char]
27 libspice.badkpv_c.restype = c_bool
---> 28 libspice.bltfrm_c.argtypes = [c_int, POINTER(stypes.SpiceCell)]
29 libspice.bodfnd_c.argtypes = [c_int, c_char_p]
30 libspice.bodfnd_c.restype = c_bool
/Users/maye/miniconda3/envs/py34/lib/python3.4/ctypes/__init__.py in __getattr__(self, name)
362 if name.startswith('__') and name.endswith('__'):
363 raise AttributeError(name)
--> 364 func = self.__getitem__(name)
365 setattr(self, name, func)
366 return func
/Users/maye/miniconda3/envs/py34/lib/python3.4/ctypes/__init__.py in __getitem__(self, name_or_ordinal)
367
368 def __getitem__(self, name_or_ordinal):
--> 369 func = self._FuncPtr((name_or_ordinal, self))
370 if not isinstance(name_or_ordinal, int):
371 func.__name__ = name_or_ordinal
AttributeError: dlsym(0x104296c80, bltfrm_c): symbol not found
Hello,
I just started implementing a SPICE system in a popular 3D animation package and switched over to SpiceyPy from PySPICE, as it seems to be more active.
I've run into an issue where trying to supply a SpiceCell object to spiceypy.spkobj causes the application to crash for some reason. Probably because it expects a pointer, although to be honest I really don't know much about how the ctypes module works.
After a little investigation it looks like some functions have been modified to be more Pythonic by returning a new SpiceCell (such as bltfrm) and some haven't, such as spkobj. For that I modified wrapper.py to return a new object and it seemed to fix the crashing issue.
Is this something that should be fixed or am I using the API incorrectly somehow?
Thanks for all the hard work on this package!
😭
figure it out
#124
I don't know if this is supported, but I don't see any comment in the README.md otherwise:
I just called py.test
inside the SpiceyPy to see if this works, and it ends up with
===================== 125 failed, 421 passed in 78.51 seconds =====================
From a little browsing, I can see that most failures have this error signature:
E SpiceyPy.support_types.SpiceyError:
E ================================================================================
E
E Toolkit version: N0065
E
E SPICE(NOSUCHFILE) --
E
E The attempt to load "/Users/klay6683/Dropbox/src/SpiceyPy/test/testKernels.txt" by the routine FURNSH failed. It could not be located.
E
E furnsh_c --> FURNSH --> ZZLDKER
E
E ================================================================================
I will try to get into this over the weekend and maybe start a pull request for discussion how to fix this (if this is indeed an issue and not unsupported, maybe your current way of testing works differently, but then it should be added to the docs)
Andrew,
both using the wifi connection at Flagstaff and from ESAC I was getting the following error:
_Download failed with URLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (ssl.c:645), trying again after 15 seconds!
I was trying to do it with pip. I solved the issue by cloning SpiceyPy and then downloading cspice and unzipping it in the main directory and installing it with setup.py
Might be a glitch of for networks with a certain firewall for urllib?
Cheers!
The setup.py file needs to be made to work better (yes that is vague). The install process at the moment is a bit of a mess, not conforming to standards. The cleanup function for example doesn't do anything. Also I am not sure why uninstalling with pip doesn't work... adding SpiceyPy to pip is a later goal (1.0 release).
Hi Andrew,
Is there a way to install SpiceyPy to the instance of Anaconda's Python on a Linux server instead of the default Python? I assume it involves some method of doing a manual installation where you can specify the Python path.
Thanks,
Mihir Patel
Hello,
I've tried to follow the Cassini position example but the first call to str2et throws a SPICE (NOLEAPSECONDS) error:
Toolkit version: N0065
SPICE(NOLEAPSECONDS) --
The variable that points to the leapseconds (DELTET/DELTA_AT) could not be located in the kernel pool. It is likely that the leapseconds kernel has not been loaded via the routine FURNSH.
str2et_c --> STR2ET --> TTRANS
I find this error odd as the ste2et_c documentation doesn't list SPICE(NOLEAPSECONDS) as a possible exception. What I assume are the two other functions in the stack trace (STR2ET and TTRANS) have no documentation on the naif website. You can find my attempt at the example here. I am running 64-bit Python 3.5.2 on Windows 10 using a WinPython distribution.
the NAIF just released toolkit version N65, it looks like a number of functions were added (http://naif.jpl.nasa.gov/pub/naif/toolkit/C/MacIntel_OSX_AppleC_64bit/packages/whats.new). It is a high priority to support these new functions!
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
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
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'
Functions like bodn2c
return a tuple of (result, True)
which is very un-pythonic, as if the execution did not work as expected, it should throw a catch-able exception, in my opinion.
To not have this supported means to constantly unpack the resulting tuple into something one uses and something to be thrown away, which makes for cumbersome, less readable code.
In my opinion, it would be good if that could be changed to only return the result, and if it would return False, to throw specific exceptions what went wrong.
If you give me a pointer where to attack this, I could help. I think we had this the way I suggest in our pyspice
implementation, and found it very pleasant to work with, so I could look up how Roberto coded that.
update spiceypy to download and utilize N66 spice. other tickets will enclose supporting new functions from N66
Andrew,
while pipping SpiceyPy from a fresh OS with a fresh Python 3 I got the following error:
Downloading spiceypy-2.0.0.tar.gz (221kB)
100% |████████████████████████████████| 225kB 367kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/sc/45xrb78x3372prlpzxr0wk2m0000gn/T/pip-build-n8nomi05/spiceypy/setup.py", line 29, in <module>
import getspice
File "/private/var/folders/sc/45xrb78x3372prlpzxr0wk2m0000gn/T/pip-build-n8nomi05/spiceypy/getspice.py", line 58, in <module>
import six.moves.urllib as urllib
ModuleNotFoundError: No module named 'six'
Needless to say it was solved by pip installing six, but just for you to know if you want to include it as a dependency.
Cheers,
I've just tried to install the latest SpiceyPy and it looks like the spiceypy/utils directory is not being copied during setup.py install, and hence imports fail on the line:
from .utils import support_types as stypes
If I copy the folder manually, all works as expected. This is on linux x64.
Okay, I was able to run the Cassini example. However, creating a window for input to gfdist isn't obvious. Also, the c example that's the template for gfdist sends result as a pointer input. The matlab example seems more appropriate, in which result is an output. An example would be helpful. What are the plans for posting such "cookbooks" moving forward? I'd be happy to help as I'm learning this stuff.
The install instructions are maybe incomplete?
$ python exampleProgramTest.py
Traceback (most recent call last):
File "exampleProgramTest.py", line 3, in
import SpiceyPy as spice
File "/Users/maye/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/SpiceyPy-0.3-py2.7.egg/SpiceyPy/init.py", line 5, in
from SpiceyPy.wrapper import *
File "/Users/maye/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/SpiceyPy-0.3-py2.7.egg/SpiceyPy/wrapper.py", line 7, in
from SpiceyPy.libspice import libspice
File "/Users/maye/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/SpiceyPy-0.3-py2.7.egg/SpiceyPy/libspice.py", line 3, in
libspice = ctypes.CDLL('spice.so')
File "/Applications/Canopy.app/appdata/canopy-1.3.0.1715.macosx-x86_64/Canopy.app/Contents/lib/python2.7/ctypes/init.py", line 365, in init
self._handle = _dlopen(self._name, mode)
OSError: dlopen(spice.so, 6): image not found
I guess I have to put the spice.so at the right place, where is that?
Attempted to install via conda. Following error given:
conda install -c https://conda.anaconda.org/andrewannex spiceypy
Fetching package metadata .........
Solving package specifications: .
Error: Package missing in current linux-64 channels:
Anaconda version:
anaconda 2.3.0 np19py27_0
Please discuss work towards v1.1.0 here or in the relevant issue.
Should be made to work really well, possibly have setup.py execute it first. As of now it is a mess.
I'm currently working my way through the tutorials but running them in SpiceyPy rather than C. Everything was working well until the remote-sensing fovint tutorial. When I run SpiceyPy.ilumin I get significantly different values to that quoted in the remote_sensing_c.txt - i.e. for the boresight:
(C)
Vector: Cassini NAC Boresight
Position vector of surface intercept in the IAU_PHOEBE frame (km):
X = 86.390
Y = 72.089
Z = 8.255
Planetocentric coordinates of the intercept (degrees):
LAT = 4.196
LON = 39.844
Phase angle (degrees): 28.139
Solar incidence angle (degrees): 18.247
Emission angle (degrees): 17.858
(SpiceyPy)
X = 86.390
Y = 72.089
Z = 8.255
LAT = 4.196
LON = 39.844
Phase Angle = 27.514 **
Solar Angle = 102.847 **
Emission An = 85.681 **
Call is as follows:
trgepc, surfvec, phase, solar, emissn = SpiceyPy.ilumin(
"Ellipsoid", "PHOEBE", et, "IAU_PHOEBE", "LT+S",
"CASSINI", bv)
Trying to pip install spiceypy, but get the following error message:
Command "python setup.py egg_info" failed with error code 1
My Python version is 3.4.4. I was running spiceypy 1.0 before, and everything worked fine.
Thanks in advance, and please let me know if additional information is required.
Hi Andrew,
Scipeypy is a great library, thanks for making it available.
So, I using your spiceypy to calculate some positions and states from 67P/C-G.
Everything runs smoothly for str2et, sce2c and spkezr until it reachs the function ckgp.
It basically returns a weird error telling me that the function is not found.
Is it this function implemented? I have version 2.0.0 and N066.
Could you help me out on this?
I thank you in advance,
Pedro H.
CSPICE_N0066
460193921.183
2.15438313986e+13
[ 3.63287867e+02 -5.67723506e+02 -2.70443184e+02 -8.90437246e-04
2.92334359e-03 1.95441175e-03]
4.03747141222e-05
Traceback (most recent call last):
File "spice.py", line 138, in
target_pos()
File "spice.py", line 90, in target_pos
spice.ckgp(int(ins), sclkst, 0e0, 'J2000')
File "C:\Programming\Anaconda\lib\site-packages\spiceypy\spiceypy.py", line 70, in with_errcheck
res = f(*args, **kwargs)
File "C:\Programming\Anaconda\lib\site-packages\spiceypy\spiceypy.py", line 88, in wrapper
raise stypes.SpiceyError("Spice returns not found for function: {}".format(f.name))
spiceypy.utils.support_types.SpiceyError: Spice returns not found for function: ckgp
The docs for inrypl
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/inrypl_c.html
have a nice example for calculating intercept of instrument boresight with the Saturn ring plane, but it uses a weird, non-wrapper (hence, no _c
at the end) function called stlabx_
:
We now wish to find the vector corvec that, when corrected for
stellar aberration, yields borvec. A good first approximation is
obtained by applying the stellar aberration correction for
transmission to borvec. Note that the routine called is not
a wrapper, so there is no letter 'c' at the end of its name.
The prototype for this routine is declared in SpiceZfc.h.
./
stlabx_ ( (doublereal *) borvec, scssb+3, corvec );
and it's not currently in SpiceyPy. Could this be implemented as well?
I tried pip install spiceypy running pip from
/Users/rfrench/Library/Enthought/Canopy_64bit/User/bin/pip
I get an error that it can't find cspice.tar.Z, but I was able to follow the "Best option" URL
https://naif.jpl.nasa.gov/pub/naif/misc/toolkit_N0065/C/MacIntel_OSX_AppleC_64bit/packages/cspice.tar.Z
to get cspice on my own. However, I don't know where to install it to make pip happy.
Any suggestions?
2007 rfrench@achilles> pip install spiceypy
Collecting spiceypy
Using cached spiceypy-1.1.1.tar.gz
Complete output from command python setup.py egg_info:
Unable to find CSPICE at /private/var/folders/gb/sk0lbh553q79qcmbk1gwrb5c0000gn/T/pip-build-urphol/spiceypy/cspice. Attempting to Download CSPICE For you:
Gathering information...
('SYSTEM: ', 'Mac')
('PROCESSOR:', 'i386')
('MACHINE: ', '64bit')
('Best option:', 'MacIntel_OSX_AppleC_64bit')
('URL: ', 'https://naif.jpl.nasa.gov/pub/naif/misc/toolkit_N0065/C/MacIntel_OSX_AppleC_64bit/packages/cspice.tar.Z')
Downloading...
Attempting to download spice...
Download failed with URLError, trying again after 15 seconds!
Attempting to download spice...
Download failed with URLError, trying again after 15 seconds!
Attempting to download spice...
Download failed with URLError, trying again after 15 seconds!
Attempting to download spice...
Download failed with URLError, trying again after 15 seconds!
Attempting to download spice...
Download failed with URLError, trying again after 15 seconds!
Attempting to download spice...
Download failed with URLError, trying again after 15 seconds!
Attempting to download spice...
Download failed with URLError, trying again after 15 seconds!
Attempting to download spice...
Download failed with URLError, trying again after 15 seconds!
Attempting to download spice...
Download failed with URLError, trying again after 15 seconds!
Attempting to download spice...
Download failed with URLError, trying again after 15 seconds!
Unable to find CSPICE at /private/var/folders/gb/sk0lbh553q79qcmbk1gwrb5c0000gn/T/pip-build-urphol/spiceypy/cspice. Exiting
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/gb/sk0lbh553q79qcmbk1gwrb5c0000gn/T/pip-build-urphol/spiceypy/
Investigate using numpy.vectorize of functions, likely only needed for the ones ICY has vectorized. I consider this a feature because it is additional functionality on top of the C version of spice, but brings SpiceyPy inline with ICY.
until now, I hadn't actually been following http://semver.org/ guide for the version number. I suspect that this will be cleaned up with the 1.0.0 release.
Well this is the big one, last summer I wasn't really aware of python wheels but this looks like a great way to distribute pre-built binaries. What is even better, I have read tutorials that show how to do this with appveyor and travis, so I could potentially have artifacts built for me by those services!
Numpy displays some odd behaviors with integers and occasionally causes segfaults. Also supporting matrices from numpy would be useful.
only 5 more DSK functions left to wrap, maybe make that and adding ckw05 as the target and cut a new release. target end of October?
Since the change to lowercase, SpiceyPy does not work here anymore. If I install the git-hash before that change, things work fine.
Here's the errors I get, but in words: IPython still only finds SpiceyPy
, not spiceypy
, but it doesn't find everything, so I guess you changed it at enough places to break it, but not enough to make it work?
I guess it works at your place because you never tried a fresh install?
In [1]: import SpiceyPy
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-756a48dc04ba> in <module>()
----> 1 import SpiceyPy
/Users/klay6683/miniconda3/lib/python3.4/site-packages/spiceypy-0.6.1-py3.4.egg/SpiceyPy/__init__.py in <module>()
3 __all__ = ['wrapper']
4
----> 5 from spiceypy.wrapper import *
6
7 #Default setting for error reporting so that programs don't just exit out!
ImportError: No module named 'spiceypy'
> /Users/klay6683/miniconda3/lib/python3.4/site-packages/spiceypy-0.6.1-py3.4.egg/SpiceyPy/__init__.py(5)<module>()
4
----> 5 from spiceypy.wrapper import *
6
ipdb> exit
In [2]: import spiceypy
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-c5b546b9c11f> in <module>()
----> 1 import spiceypy
ImportError: No module named 'spiceypy'
> <ipython-input-2-c5b546b9c11f>(1)<module>()
----> 1 import spiceypy
ipdb>
Has anyone managed to multithread SpiceyPy (or Spice)? I had a quick go with the threading module but it failed miserably. Just wondering if anyone has had any success?
Hi! I haven't tried SpiceyPy yet but I've noticed that you have a conda package in your personal channel. Would you be interested in putting this in conda-forge? It is a sort of community-blessed repository of conda packages, with automatic testing in all platforms.
While we are at it, we can even provide a conda package for SPICE itself and just declare it as a dependency. I al willing to help with all of this.
Discussion for solutions and fixes to occur here.
So after giving it some thought, I have decided to go forward with my plan to utilize abbreviated reStructured Text formatted docstrings for SpiceyPy, instead of using the full documentation sections contained in the headers of the files. The main reasons for this are:
I will post a PR and merge in soon the docstrings as they are currently on my local system. It will take a while to go through and update the documentation, however this should be significantly easier and faster than writing the test functions. I will also post further updates regarding documentation here.
https://ci.appveyor.com/project/AndrewAnnex/spiceypy/build/1.1.707
looks like something strange is occurring with windows builds.
epochs = stypes.toDoubleVector(epochs)
> libspice.spk14a_c(handle, ncsets, coeffs, epochs)
E WindowsError: exception: access violation reading 0x000000000367F000
spiceypy\spiceypy.py:11151: WindowsError
_________________________________ test_spk14b _________________________________
The interface to spiceypy.libspice.dafac_c does not work for me (Ubuntu). This also may be a problem with some other SPICE toolkit routines that pass a single pointer to multiple strings, where the strings are embedded on the left edge of a 2-dimensional array of SpiceChars that is passed as a single block.
It's not urgent; I may fix it myself and issue a pull request.
This is what I do (cmnts is a list of items):
### Write DAF comments
nComments = len(cmnts)
lenvals = max([nComments for cmnt in cmnts]) + 1
try: sp.dafac_c(handle,nComments,lenvals,cmnts)
except:
### As of October, 2017, spiceypy.dafac_c does not work
### - build string and call sp.libspice.dafac_c directly
arr = ''.join([(cmnt + ('\0'*lenvals))[:lenvals] for cmnt in cmnts])
sp.libspice.dafac_c(handle,nComments,lenvals,arr)
P.S. Andrew, I see you coded the HapkeModel; I met him once, I think it was in AZ. I also coded the model in gawk.
Here are the install command and output:
conda install -c https://conda.anaconda.org/andrewannex spiceypy
Fetching package metadata .........
Solving package specifications: ....
UnsatisfiableError: The following specifications were found to be in conflict:
Using version
Installed /Users/maye/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/SpiceyPy-0.4.4-py2.7.egg
Processing dependencies for SpiceyPy==0.4.4
Finished processing dependencies for SpiceyPy==0.4.4
$ python exampleProgramTest.py
================================================================================
Toolkit version: N0064
SPICE(NOSUCHFILE) --
The attempt to load "./Kernels/testmetak.txt" by the routine FURNSH failed. It
could not be located.
A traceback follows. The name of the highest level module is first.
furnsh_c --> FURNSH --> ZZLDKER
Oh, by the way: The SPICELIB error handling actions are USER-TAILORABLE. You
can choose whether the Toolkit aborts or continues when errors occur, which
error messages to output, and where to send the output. Please read the ERROR
"Required Reading" file, or see the routines ERRACT, ERRDEV, and ERRPRT.
================================================================================
I am looking for the state (position and velocity) of a minor body relative to an observatory on Earth corrected for light time aberration. The results I get with spiceypy.spkez
are consistent with JPL Horizons except for the velocity of the object with respect to the observer that is off by 0.1 km/s. This is difference is likely due to having introduced an observatory defined by longitude, latitude and altitude in Horizons while spkez takes the NAIF ID 399 coresponding to Earth. Is there any way to obtain the state of a body relative to a position given in latitudinal coordinates?
During a scheduled build, all travis linux builds failed downloading CSPICE from the naif servers returning urlexceptions of some kind (see https://travis-ci.org/AndrewAnnex/SpiceyPy/jobs/189723324)
I was unable (yet) to reproduce the failure locally or through appveyor builds (both appear normal).
Not enough information as of yet to explain issue
%run C:\Users\Ramdayal\SpiceyPy\setup.py install
Host OS: Windows
Attempting to move: C:\Users\Ramdayal\SpiceyPy\cspice\src\cspice\cspice.dll to: C:\Users\Ramdayal\SpiceyPy\spiceypy\utils\cspice.dll
An exception has occurred, use %tb to see the full traceback.
SystemExit: cspice.dll file not found, what happend?: [Error 2] The system cannot find the file specified
Problem: cspice.dll file is missing? How can I get cspice.dll?
Thank you.
Hi guys,
anyone else having trouble with this?
import SpiceyPy as spice
spice.furnsh('testKernels.txt')
Toolkit version: N0065
SPICE(BADVARASSIGN) --
The first item following the assignment operator should be the value of a
variable or a left parenthesis '(' followed by a value for a variable. This is
not true on line 1 of the text kernel file 'testKernels.txt'.
A traceback follows. The name of the highest level module is first.
furnsh_c --> FURNSH --> ZZLDKER --> LDPOOL --> ZZRVAR
'testKernels.txt' looks like this:
\begindata
KERNELS_TO_LOAD =(
'/Users/jmcaulif/Code/python/SpiceyPy/test/pck00010.tpc',
'/Users/jmcaulif/Code/python/SpiceyPy/test/de421.bsp',
'/Users/jmcaulif/Code/python/SpiceyPy/test/gm_de431.tpc',
'/Users/jmcaulif/Code/python/SpiceyPy/test/naif0011.tls',
)
\begintext
Has there been a change with N0065? This used to work for me...
Cheers,
J.
add an authors file for impending CLA agreement and giving credit
Hi Andrew,
This is a routine documented in other implementations but not exposed in cspice:
https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/spicelib/ev2lin.html
My request is naive, so I am unaware of the difficulty of implementation or whether it is even possible...
we should start transitioning builds to include and build artifacts for python 3.6, now that it is available in appveyor this shouldn't be too difficult for windows.
I am using SpiceyPy in order to do frame transformations and use de430 for planetary ephemerids. I can install and use SpiceyPy correctly on my local machine, but I am having issues installing this on my travis-ci testing virtual machines, cf. https://travis-ci.org/ChristopherRabotin/smd/builds/207118128 . I don't think this issue is specifically related to SpiceyPy, but I was wondering whether you had encountered that error before, or whether you had any tips on fixing this?
Thanks.
I do have this started on a non-committed version, but I need to work out a good organization method for the tests. Should it all be in one test file, or should we break them down by alphabetical order?
Hi --
Just a quick question about installation. New python user so maybe I'm doing something wrong here. I grabbed the code via git and then did python setup.py install
to install it into my Anaconda / MacOS environment. After doing this, import spiceypy
would not find the library.
I found that install
had copied the spiceypy-1.1.0-py3.5.egg
directory, but not spicepy
itself. I worked around this by manually copying the spiceypy
directory into site-packages, e.g.,
cp -r spiceypy /Users/throop/anaconda/envs/py3/lib/python3.5/site-packages/
Is this how it's supposed to work?
Thanks,
Henry
This comes from C of course but is very un-pythonic.
See for example for getfov:
http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/getfov_c.html
the required inputs are 4:
VARIABLE I/O DESCRIPTION
-------- --- --------------------------------------------------
instid I NAIF ID of an instrument.
room I Maximum number of vectors that can be returned.
shapelen I Space available in the string `shape'.
framelen I Space available in the string `frame'.
shape O Instrument FOV shape.
frame O Name of the frame in which FOV vectors are defined.
bsight O Boresight vector.
n O Number of boundary vectors returned.
bounds O FOV boundary vectors.
but shapelen and framelen are just the lengths for the strings of shape and frame in the output. This is usually not required in Python and it would be nice if the user, especially the not-C versatile user who does not understand what is going on, would not need to provide this number.
How about setting it to something large like 100
that SpiceyPy sets internally whereever such length of a string is required?
What do people think? I think, but am not sure now, that we did that at PySPICE?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.