Skip to content

The United States Naval Observatory NOVAS astronomy library for Python

Notifications You must be signed in to change notification settings

brandon-rhodes/python-novas

Repository files navigation

Welcome to NOVAS Py

Important

This GitHub repository is merely a mirror of this official United States Naval Observatory software library, with the code tweaked to make possible its release on the Python Package Index as the novas package. None of the library’s actual authors are involved with this repository. Its official documentation is here:

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 for precession, nutation, aberration, parallax, and gravitational deflection of light. The computations are accurate to better 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 of The Astronomical Almanac are prepared using NOVAS.

What is NOVAS Py?

With NOVAS Py, the USNO is expanding NOVAS to the Python programming language. The NOVAS Py module is simply a wrapper around the NOVAS C code; all computations are still performed by the C code. NOVAS Py makes use of Python's ctypes module.

Installation

The NOVAS Py Module

The NOVAS Py module is installed from the top-level source directory with the command python setup.py install. If there are multiple versions of Python installed, the NOVAS Py package will be installed for the version used to run the setup.py script. Note that you may need superuser or administrator privileges to install the package.

Ephemerides

NOVAS requires access to a high-accuracy solar system ephemeris in order to compute places of solar system bodies and the highest-accuracy star places. Groups in the U.S., France, and Russia now construct high-accuracy solar system ephemerides. NOVAS is able to use solar system ephemerides that use JPL's export format, for example, the "developmental ephemerides," designated as "DEnnn", which are produced by JPL in the U.S. NOVAS C provides an implementation of JPL's ephemeris-access software that enables reading and interpolating a binary, direct-access ephemeris file.

Before using any NOVAS functionality that requires access to the ephemerides, you must first open the file with the ephem_open function (from novas.compat.eph_manager import ephem_open). You must either pass ephem_open the path to the binary ephemeris file you wish to use or have the path set in an environment variable named EPHEMERIS_FILE. If you choose to do the latter, you may then call ephem_open without passing any arguments to the function.

Consult the NOVAS C User Guide for directions on how to create the binary ephemeris file.

Package Layout

Phase one of NOVAS Py is intended to feel like NOVAS C. For the most part, function calls in Python match the function calls in C. All results are returned from the function. Some function inputs have been reordered so that the function can support optional inputs.

NOVAS functions can be found under the novas.compat namespace. Functions from eph_manager.c, solsys1.c, and nutation.c can be found under novas.compat.eph_manager, novas.compat.solsys, and novas.compat.nutation, respectively.

Note on constants

NOVAS Py includes a constants file copied from the NOVAS C constants file; this is only provided for consistency with the NOVAS C package. Since the wrapped NOVAS C functions are where the constants are used, and those functions obtain the constants from the NOVAS C constants file, any changes to constants in the NOVAS Py constants file will have no effect.

Notes on error handling

Error return codes from NOVAS C functions are handled by raising an appropriate exception. However, given the way NOVAS C does error codes, it was found that some return codes from higher-level C functions can represent more than one error. For these cases the developer choose what was felt to be the most likely or most important error code to escalate to an exception. All possible error codes are in the c_error dictionaries attached to each C function object, within each wrapper function, but those with duplicate numbers are commented out at this time.

Tests

Some tests are available in the tests source directory; they are designed to work with Python >= 2.7. To run the tests with Python 2.5 or 2.6, first install the unittest2 module

Using NOVAS Py

Once installation is complete, the NOVAS functions can be found under the novas.compat namespace. Nutation models can be found under novas.nutation, and constants under novas.constants.

About

The United States Naval Observatory NOVAS astronomy library for Python

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •