Git Product home page Git Product logo

spiceypy's Introduction

SpiceyPy

SpiceyPy is a Python wrapper for the NAIF C SPICE Toolkit (N66), written using ctypes.

Continuous Integration Code Coverage Docs Citation Code Style
Codecov - Test Coverage Readthedocs - Documentation Citation Information: Journal of Open Source Software

Code Style - Black

Introduction

SpiceyPy is a python wrapper for the SPICE Toolkit. SPICE is an essential tool for scientists and engineers alike in the planetary science field for Solar System Geometry. Please visit the NAIF website for more details about SPICE.

IMPORTANT: The code is provided "as is", use at your own risk. However, the NAIF now distributes python "lessons" that use SpiceyPy as the python to spice interface.

Citing SpiceyPy

If you are publishing work that uses SpiceyPy, please cite SpiceyPy and the SPICE toolkit.

SpiceyPy can be cited using the JOSS DOI (https://doi.org/10.21105/joss.02050) or with the following:

Annex et al., (2020). SpiceyPy: a Pythonic Wrapper for the SPICE Toolkit. Journal of Open Source Software, 5(46), 2050, https://doi.org/10.21105/joss.02050

Instructions for how to cite the SPICE Toolkit are available on the NAIF website:

https://naif.jpl.nasa.gov/naif/credit.html.

To cite information about SpiceyPy usage statistics, please cite my 2017 and or 2019 abstracts as appropriate below:
  1. 2017 abstract: https://ui.adsabs.harvard.edu/abs/2017LPICo1986.7081A/abstract.
  2. 2019 abstract: https://ui.adsabs.harvard.edu/abs/2019LPICo2151.7043A/abstract.

Installation

PyPI Conda Forge
PyPI - python package index Conda - conda-forge feedstock for SpiceyPy

SpiceyPy can be installed using pip by running: pip install spiceypy

Anaconda users should use the conda-forge distribution of SpiceyPy by running:

conda config --add channels conda-forge

conda install spiceypy

If you wish to install spiceypy from source first download or clone the project. Then run python setup.py install. To uninstall run pip uninstall spiceypy.

Documentation

The SpiceyPy docs are available at: spiceypy.readthedocs.org. The documentation for SpiceyPy is intentionally abridged so as to utilize the excellent documentation provided by the NAIF. Please refer to C and IDL documentation available on the NAIF website for in-depth explanations. Each function docstring has a link to the corresponding C function in the NAIF docs at a minimum. SpiceyPy documentation contains the NAIF authored Lessons for step-by-step tutorials with code examples.

How to Help

Feedback is always welcomed, if you discover that a function is not working as expected, submit an issue detailing how to reproduce the problem. If you utilize SpiceyPy frequently please consider contributing to the project by citing me using the zenodo DOI above.

Known Working Environments:

SpiceyPy is compatible with modern Linux, Mac, and Windows environments. Since the package is a wrapper, any environment not supported by the NAIF is similarly not supported by SpiceyPy. If you run into issues with your system please submit an issue with details. Please note that support for Python minor versions are generally phased out as newer versions are released.

  • OS: OS X, Linux, Windows, FreeBSD
  • CPU: 64bit only!
  • Python 3.6, 3.7, 3.8, 3.9, 3.10, 3.11
  • ARM support for Linux-aarch64 & osx-arm64
  • Support for Python 2.7 ended with version 2.3.2 January 2020 *

Acknowledgements

DaRasch wrote spiceminer, which I looked at to get SpiceCells working, thanks!

spiceypy's People

Contributors

alfonsosr avatar andrewannex avatar cgobat avatar drbitboy avatar elementc avatar fyellin avatar gitter-badger avatar helgee avatar jdiazdelrio avatar jeanlucmargot avatar jessemapel avatar johan12345 avatar kberryusgs avatar kd7uiy avatar kyleniemeyer avatar marcsit avatar medley56 avatar michaelaye avatar migueldvb avatar mstefko avatar murashin avatar pyup-bot avatar seignovert avatar skulumani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spiceypy's Issues

dafac (append comments to DAF) not quite there yet

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.

don't force user to provide length of output string

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?

Documentation

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:

  1. This is how most python libraries are documented and there are various PEPs about the subject.
  2. It allows for a short description and a type to be conveyed quickly.
  3. It is much simpler to update, and differences between the c functions and the wrapper functions can be conveyed simply.
  4. It allows me to leverage the NAIF documentation available online.
  5. This also allows compatibility with tools such as Sphinx which I may use later as detailed here.

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.

Basic

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'

Make SpiceyPy 2.1.0 release

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?

ilumin gives different values than tutorial

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)

Install spice on windows from source

%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.

Add Wheels to PyPi

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!

utils folder not being copied during setup.py install

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.

Fix getspice.py

Should be made to work really well, possibly have setup.py execute it first. As of now it is a mess.

Update to N66

update spiceypy to download and utilize N66 spice. other tickets will enclose supporting new functions from N66

(Numpy) Vectorization of certain functions

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.

Remove un-pythonic 'found' response from results

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.

CSPICE not downloading for certain connections

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!

change to lower case import broken

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>

CKGP throws a not found exception

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

Add Authors.MD

add an authors file for impending CLA agreement and giving credit

Current master does not import despite install error-free.

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

general py.test call fails

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)

Unexpected behavior with failures

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.

Tutorial Problem

Hello,

I've tried to follow the Cassini position example but the first call to str2et throws a SPICE (NOLEAPSECONDS) error:

SpiceyError:

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.

Conda packages in conda-forge

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.

https://conda-forge.org/

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.

python3.4 support

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.

Write py.test files

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?

Fix setup.py

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).

Installing on anaconda Python 3.4.4

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:

  • python 3.4*
  • spiceypy
    Use "conda info " to see the dependencies for each package.

Missing non-wrapper (=Fortran??) routine

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?

Example program does not run

The install instructions are maybe incomplete?

  • git-cloned SpiceyPy
  • copied my cspice folder from PySpice into SpiceyPy
  • I followed the README.md, went into cspice/lib and did that stuff
  • then I did a python setup.py install in the main folder of SpiceyPy
  • then went into Test folder and tried `python exampleProgramTest.py'. This is what I got:

$ 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?

Probably unrelated to SpiceyPy itself: `no module named "six"`

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.

window creation

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.

cannot Install on Canopy OS X with pip install spiceypy

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/

Install to Anaconda

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

'install' does not copy into site-packages

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

No module named 'six'

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,

Some functions still set up to pass SpiceCell object in as a pointer.

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!

Running exampleProgramTest.py fails

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.

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

Multithread SpiceyPy

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?

spkez including geodetic correction

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.