Ruby wrapper for the NASA-JPL CSPICE library via SciRuby
C++ C Objective-C Ruby HCL
Pull request Compare This branch is even with gau27:master.



Ruby wrapper for the NASA JPL CSPICE Library.


SpiceRub is a wrapper interface for the NASA JPL CSPICE library used for various astronomical calculations. The spicerub gem provides a direct port of the CSPICE API along with additional Ruby functions to make commonly compounded tasks more straightforward. The initial release aims to port a useful subset of the various routines offered by the SPICE toolkit, the major focus of which is on routines related to ephemerides calculations using various JPL ephemerides files.


An existing CSPICE installation or download the toolkit package and simply extract the binary file cspice.a. Find an appropriate installation for your architecture here. Please run +bundle install+ in your terminal from the Gem directory to make sure you have all the required Ruby dependencies.


Clone repository :

git clone

Copy CSPICE binary library to the right extension folder (must be renamed to libcspice.a) :

cp path/to/cspice.a ext/spice_rub/cspice/lib/libcspice.a

Compile the gem :

bundle exec rake compile

Run test suite to see if everything works :

bundle exec rake spec

Try out the code without installing the gem :

bundle exec rake pry

Install as a gem :

bundle exec rake install


Kernel Loading Functions

Geometric Co-Ordinate Conversion Functions

Basic Time Conversion and Encoding Functions

Time windows for Observer-Target constraints

Basic Ephemerides Functions

All ported CSPICE functions can be accessed by the call `SpiceRub::Native.CSPICE_FUNCTION_NAME`


Copyright © 2016, Gaurav Tamba and The Ruby Science Foundation.

All rights reserved.