<div dir="ltr">Hello everyone! <div><br><div><div>Although I had not planned to announce it here until late October, I have been writing my own python wrapper for SPICE called SpiceyPy for fun. This grew from my work porting PySPICE into Python 3, I figured out that it would be possible to wrap CSpice by first constructing a shared library of spice from the provided static ones, and then using the standard <a href="https://docs.python.org/3/library/ctypes.html?highlight=ctypes#module-ctypes" target="_blank">ctypes module</a> to then write wrapper functions in pure python. </div><div><br></div><div>The advantage to the approach I took was that I was able to quickly write wrapper functions and extend the function of the wrapper library. For example, SpiceyPy currently runs in both Python 2 and 3 environments. Using python only has also allowed me to closely integrate Numpy into the wrapper, arrays and matrices are returned as numpy arrays for example. I also have begun to mirror the vectorized functions available in ICY in my wrapper. </div><div><br></div><div>As of writing this email, for N65 I have wrapper functions for 514 functions (around 98% of CSPICE). Also I have written unit tests, for 446 functions (around 85% of CSPICE). Most of these tests are lifted from the CSPICE and ICY documentation.</div><div><br></div><div>Currently I do not support the Geometry Finder functions that use callbacks, but it should be possible to support those, I have never used them before so writing tests will be difficult without some help. Also I am currently in the process of writing tests and fixing my wrapper functions dealing with Event Kernels. <br></div><div><div><br></div><div>As for what is supported, a lot is. You can write most CK and SPK kernel types, functions like EDLIMB and EDTERM are supported, I also support Cells and Windows. In fact it is easier to talk about what I don&#39;t currently support as I did in part above.  <a href="https://github.com/AndrewAnnex/SpiceyPy/wiki/Wrapper-Completion" target="_blank">For specifics on which functions are supported please look at this</a> page, I update that page semi frequently so the <a href="https://github.com/AndrewAnnex/SpiceyPy/blob/master/test/test_wrapper.py" target="_blank">test_wrapper.py file is more representative and provides a good amount of example usage of SpiceyPy</a>. </div><div><br></div><div>I welcome feedback and in particular contributions to SpiceyPy, github allows for code contributions to be easily discussed and merged in. If you want to help out, email me or just go ahead and start sending me pull requests. The current task is to get as many of the wrapper functions written and tested as possible. I want to get my Coverall.io score to be near 95% before I will be satisfied, you can <a href="https://coveralls.io/r/AndrewAnnex/SpiceyPy" target="_blank">view the current coverage here</a>.</div><div><br></div><div>I am currently developing SpiceyPy on OS X 10.9.5, and I assume that it works on most modern *NIX systems. Again I develop SpiceyPy on Python 3.4.1, Python 2.7.x is also supported but I would not recommend using any python older than that as I have not tested it in such an environment. Make sure you have the following python packages installed prior to installing SpiceyPy: Numpy, Six, and Pytest.</div><div><br></div><div>If you have trouble installing SpiceyPy I will try to find some time this weekend to update the Readme to be a bit clearer, but for now just download and unzip the project, and run python setup.py install, it should automatically download the correct version of CSPICE N65 for you. If it doesn&#39;t just post an issue on the github page, and I will try to help when I have time.</div></div></div></div><div><br></div><div><a href="https://github.com/AndrewAnnex/SpiceyPy" target="_blank">Here is the link to SpiceyPy!</a>*</div><div><br></div><div><br></div><div>*P.S.: For those who I contacted about SpiceyPy previously, I have changed my github username. The links above now point to the correct account.</div><div class="gmail_extra"><div class="gmail_quote"><br></div>-- <br><div dir="ltr">Andrew Annex<br>University of Virginia, Class of 2014<br>College of Arts and Sciences, B.S. Environmental Science</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 26, 2014 at 8:08 PM, Acton, Charles H (392N) <span dir="ltr">&lt;<a href="mailto:charles.h.acton@jpl.nasa.gov" target="_blank">charles.h.acton@jpl.nasa.gov</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div style="word-wrap:break-word;color:rgb(0,0,0);font-size:14px;font-family:Calibri,sans-serif">
<div>FYI, for those interested in Python interfaces to SPICE.</div>
<div><br>
</div>
<div>Chuck Acton</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div style="font-family:Consolas;font-size:medium">From: Andrew Annex &lt;<a href="mailto:ama6fy@virginia.edu" target="_blank">ama6fy@virginia.edu</a> &lt;<a href="mailto:ama6fy@virginia.edu%3E" target="_blank">mailto:ama6fy@virginia.edu&gt;</a>&gt;</div>
<div style="font-family:Consolas;font-size:medium">Date: Sunday, September 7, 2014 10:32 AM</div>
<div style="font-family:Consolas;font-size:medium">To: &quot;<a href="mailto:charles.h.acton@jpl.nasa.gov" target="_blank">charles.h.acton@jpl.nasa.gov</a> &lt;<a href="mailto:charles.h.acton@jpl.nasa.gov%3E" target="_blank">mailto:charles.h.acton@jpl.nasa.gov&gt;</a>&quot;</div>
<div style="font-family:Consolas;font-size:medium">&lt;<a href="mailto:charles.h.acton@jpl.nasa.gov" target="_blank">charles.h.acton@jpl.nasa.gov</a> &lt;<a href="mailto:charles.h.acton@jpl.nasa.gov%3E" target="_blank">mailto:charles.h.acton@jpl.nasa.gov&gt;</a>&gt;</div>
<div style="font-family:Consolas;font-size:medium">Subject: Re: A new Python wrapper for Spice, SpiceyPy</div>
<div style="font-family:Consolas;font-size:medium"><br>
</div>
<div style="font-family:Consolas;font-size:medium">Hello again Mr. Acton, I just wanted to check in with you again and to update</div>
<div style="font-family:Consolas;font-size:medium">you on the progress I have been making with my Python wrapper for CSPICE. Over</div>
<div style="font-family:Consolas;font-size:medium">the past two months I have wrote a substantial number of tests for my python</div>
<div style="font-family:Consolas;font-size:medium">functions, most of them are directly from the C and ICY documentation. The</div>
<div style="font-family:Consolas;font-size:medium">purpose of these tests is that they are in a automated test suite, which can be</div>
<div style="font-family:Consolas;font-size:medium">run to ensure that I made no breaking changes. I have fixed numerous errors in</div>
<div style="font-family:Consolas;font-size:medium">my own code and I have also learned a lot about spice in general so although it</div>
<div style="font-family:Consolas;font-size:medium">was a lot of work I am glad I made the decision to write them. As of now, and</div>
<div style="font-family:Consolas;font-size:medium">this can be seen on the github page, I have around 82% test coverage, meaning</div>
<div style="font-family:Consolas;font-size:medium">about 82% of the wrapper functions have some test called for it. What remains is</div>
<div style="font-family:Consolas;font-size:medium">most of the event kernel functions and a number of spk related functions, as</div>
<div style="font-family:Consolas;font-size:medium">well as the geometry finder functions. In essence there are around 100 functions</div>
<div style="font-family:Consolas;font-size:medium">that remain untested. In other areas I have made some important changes such as</div>
<div style="font-family:Consolas;font-size:medium">defaulting to exporting numpy arrays for functions that return numeric arrays</div>
<div style="font-family:Consolas;font-size:medium">and matrices. I am also in the process of writing wrapper functions for the new</div>
<div style="font-family:Consolas;font-size:medium">functions added in the N65 release, which I have at least partially completed.</div>
<div style="font-family:Consolas;font-size:medium">   So while plenty of work remains, the wrapper is maturing. I will probably</div>
<div style="font-family:Consolas;font-size:medium">email you again in another month or two, to give you another progress update. If</div>
<div style="font-family:Consolas;font-size:medium">naif members find to time to try out SpiceyPy I would love feedback and or</div>
<div style="font-family:Consolas;font-size:medium">contributions to the project via pull requests on github.</div>
<div style="font-family:Consolas;font-size:medium"><br>
</div>
<div style="font-family:Consolas;font-size:medium">Thanks again,</div>
<div style="font-family:Consolas;font-size:medium">-Andrew</div>
</div>
<div><br>
</div>
</div>

<br>_______________________________________________<br>
Spice_discussion mailing list<br>
<a href="mailto:Spice_discussion@naif.jpl.nasa.gov">Spice_discussion@naif.jpl.nasa.gov</a><br>
<a href="http://naif.jpl.nasa.gov/mailman/listinfo/spice_discussion" target="_blank">http://naif.jpl.nasa.gov/mailman/listinfo/spice_discussion</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Andrew Annex<br>University of Virginia, Class of 2014<br>College of Arts and Sciences, B.S. Environmental Science<br></div>
</div>