Package: novas
What is NOVAS?NOVAS is an integrated package of functions for computing various
commonly needed quantities in positional astronomy.  The package can
supply, in one or two function calls, the instantaneous coordinates of
any star or solar system body in a variety of coordinate systems.  At a
lower level, NOVAS also provides astrometric utility transformations,
such as those forprecession,nutation,aberration,parallax, and
gravitationaldeflection of light.  The computations are accurate tobetter than one milliarcsecond.The NOVAS library is an easy-to-use
facility that can be incorporated into data reduction programs,
telescope control systems, and simulations.  The U.S. parts ofThe Astronomical Almanacare prepared using NOVAS.This Python package includes both the NOVAS library and the Python
wrapper that are available from theNOVAS home pageat the United
States Naval Observatory.  This version includes a few bug fixes and
packaging adjustments that are not in the most recent June 2011
release of the software from the Naval Observatory itself.  You can
find these changes described at the bottom of this page in the
Changelog, and you can also review them yourself at theproject
repository on GitHub.This package has been uploaded to the Python Package Index by Brandon
Rhodes <brandon@rhodesmill.org>.  Please contact me, and not the busy
folks at the Naval Observatory, about any problems you encounter when
trying to install it — any problems with how it has been packaged are
my fault, not theirs!  For questions about how to use the library, you
can also ask for help on Stack Overflow, where I watch for questions
that involve Python and astronomy.Quick ExamplesImporting the library and opening the planetary ephemeris:>>> from novas import compat as novas
>>> from novas.compat import eph_manager
>>> jd_start, jd_end, number = eph_manager.ephem_open()Converting a calendar date to a Julian date:>>> jd_tt = novas.julian_date(2012, 10, 2, 12.0)
>>> jd_tt
2456203.0Asking where Mars is located in the sky on a given date,
in “astrometric” coordinates of the kind that are used
in printed sky atlases:>>> mars = novas.make_object(0, 4, 'Mars', None)
>>> ra, dec, dis = novas.astro_planet(jd_tt, mars)
>>> print 'R.A. %d:%02f' % (ra, abs(ra) % 1. * 60.)
R.A. 15:36.176177
>>> print 'dec. %d:%02f' % (dec, abs(dec) % 1. * 60.)
dec. -20:11.951841
>>> print 'distance %f AU' % (dis,)
distance 1.947674 AUThere is more information at theNOVAS home pageand in particular afull PDF manual that includes a “Sample Calculations” chapter.
Even though the manual is for the C version,
you can generally puzzle out how to make the same calls from Python
if you compare the sample code
to the way that similar calculations are done
in thetestpackage included inside ofnovas!InstallationLike other packages listed here on the Python Package Index, this
package can be installed with thepipcommand. You will need to
install both the library itself as well as a high-accuracy ephemeris
data set, with the DE405 ephemeris being the current default:$ pip install novas
$ pip install novas_de405Note that the second command may take several minutes to run, depending
on your Internet connection, because the JPL ephemeris that it has to
download is 55 MB in size!If you are managing a Python project that has asetup.pyor arequirements.txtfile, then instead of running thesepipcommands manually you can simply list these two package names alongside
the other packages that you depend on, and let them be installed as part
of your normal project install.Sanity check: running the testsOnce the package is installed, you can run its tests with the new
test-discovery feature built-in to Python 2.7. If the tests pass to
extremely high accuracy, then the result should be:$ python -m unittest discover novas
........................................
........................................
...........
----------------------------------------
Ran 191 tests in 0.022s

OKIf you are using an older version of Python, then you can run the tests
with theunittest2compatibility package instead:$ pip install unittest2
$ unit2 discover novasRunning the tests this way should also result in a pretty field of dots,
followed by the message “OK.”Contents and DocumentationSuccessful installation will produce anovaspackage that contains
several namespaces full of functions:novas.compatMain NOVAS functions.novas.constantsImportant constants.novas.nutationNutation models.novas.compat.eph_managerFunctions from the NOVASeph_manager.cmodule.novas.compat.solsysFunctions from the NOVASsolsys1.cmodule.novas.compat.nutationFunctions from the NOVASnutation.cmodule.You can find more information and documentation on the project’s
officialNOVAS home pageat the Naval Observatory.ChangelogVersion 3.1.1.4 — 2016 December 1Updated all source code with improvements and rewrites from the new
official version 3.1.1 from the Naval Observatory.Version 3.1.1.3 — 2015 January 23Fixed a fatal typo inastro_star()that caused it to always raiseArgumentError: argument 3: <class'TypeError'>:wrong typeVersion 3.1.1.2 — 2013 July 31The top-level__init__.pynow attempts to load the NOVAS C library
from several different filenames under Python 3, instead of only
trying filenames with an ABI identifier.  (On my Ubuntu 13.04 laptop,
Python 3.3 isnotin fact including such an identifier, which was
causing anImportError: cannot import name novaslibfailure.)Version 3.1.1.1 — 2013 March 2Further fixes have been provided by users, so I am making this interim
release while the official version still sits at 3.1.Leo Singer fixed the wrappers forcal_date()andlimb_angle()so these two NOVAS functions can now be used from Python code.The example test filecheckout-stars-full.pynow uses syntax
compatible with Python 3, eliminating a warning during install.Thesetup.pynow specifies the encoding for this readme, so the
package can install on systems where UTF-8 is not the default.Version 3.1.1 — 2012 November 25The Naval Observatory has not released a new version of NOVAS since
June 2011, but reports and requests from users convinced me to make
several small fixes to the code and make an interim release here on
the Python Package Index:The library is now Python 3 compatible!Python code can now access theephem_close()routine inside theeph_managermodule.Bugfix: theeph_manager.state()function was always raising an
exception if invoked.Bugfix: toeph_manager.cas recommended in theNOVAS FAQ.Bugfix: tonovas.cas recommended in theNOVAS FAQ.To examine the code changes yourself, you can visit theproject
repository on GitHub.Version 3.1 — 2012 September 19Initial release of the library on the Python Package Index.License and CitationThis software was produced by the United States Naval Observatory at the
expense of United States taxpayers, and is therefore not suseptible to
copyright, because a copyright would place taxpayer property under
private ownership. Since it is not copyrighted, it cannot be licensed;
it is simply free.To credit the authors, you are invited to cite their work as follows:Barron, E. G., Kaplan, G. H., Bangert, J., Bartlett, J. L., Puatua, W., Harris, W., & Barrett, P. (2011)“Naval Observatory Vector Astrometry Software (NOVAS) Version 3.1, Introducing a Python Edition,”Bull. AAS, 43, 2011.The authors of NOVAS ask that if you use their software in your work,
that you let them know athelp@aa.usno.navy.milsince a record of who is
using their software helps them justify the excellent work that they are
doing by making the software available to the public.