Astrolabe: Astronomical subroutines and applications

Last updated: July 4, 2005.

Best Viewed With Any Browser.

Introduction

Astrolabe is a collection of subroutines and applications for calculating the positions of the sun, moon, planets and other celestial objects. The emphasis is on high accuracy over a several thousand year time span. Note that the techniques used are overkill for most calendar applications. See the FAQ, Astronomical Calculations for the Amateur for pointers to other methods which are both faster and smaller in terms of code bulk.

The subroutine library attempts to (someday) implement all the techniques described in Astronomical Algorithms, second edition 1998, by Jean Meeus, Willmann-Bell, Inc. For an alternative open-source implementation of Meeus in ANSI C, look here.

Currently there are no graphical applications apart from some demo CGI interfaces. I may add graphics in the future, but I don't intend to create a planetarium program. For a very nice open-source example of such running on Unix/Linux systems, see XEphem. Graphical software for many platforms are linked at Planetarium Software.

The Astrolabe source is licensed under the GPL, meaning it can be copied and distributed freely.

Sources

As a general rule, I have implemented all the sources in more than one language. Currently, the source languages are: These applications are compute-intensive and are perhaps not the best use of an interpreted language like Python, but with modern hardware the Python versions perform well enough for many uses. The C++ versions are about 20-25 times faster.

The sources are available for download from the SourceForge Summary Page.

Getting started

Unpack the files into some convenient location. Everything is under a top-level directory astrolabe. If you have a previous astrolabe_params.txt, you should first copy it out of this directory tree so that your local modifications are not lost.

Models and accuracy

Mercury through Neptune

Model. The planetary model is VSOP87 (Variations Seculaires des Orbites Planetaires) by Bretagnon and Francou. The original model documentation, data files, and sample Fortran routines are available here. NOTE: It is not neccessary to download any data or sources from the original site. I have provided everything required. The original data files require about 4.1 MB; I have combined and reduced these to about 1.4 MB. The full accuracy of the model is retained.

Version. The VSOP model is available in several variants. I am using version "D" which produces heliocentric spherical coordinates for the equinox of date. This is the same as used in Meeus.

Accuracy. The model produces positions of better than 1 arc-second for Mercury through Mars for the years -2000 to +4000, for Jupiter and Saturn for the years 0 to +4000, and for Uranus and Neptune for the years -4000 to +8000. Within those ranges, the actual accuracies are:

distance to Sun (km) longitude & latitude (arc-seconds)
Mercury 0.3 0.001
Venus 2.7 0.005
Earth 3.7 0.005
Mars 22.8 0.021
Jupiter 272 0.072
Saturn 1000 0.144
Uranus 230 0.017
Neptune 1891 0.087

A note on the Meeus version. Meeus prints a truncated version of the model in his book. The first edition had an optional software supplement which included the truncated data. This supplement is no longer available, but the complete data presented here can be used instead of the version on the diskette. I use a different format.

Moon
The lunar model is Meeus's simplified version of ELP2000-82 by Chapront. The complete model can be found here. Accuracy of the simplified version is about 10 arc-seconds in longitude and 4 arc-seconds in latitude. (Over what period?)

Applications

Subroutines

I don't have separate docs for the subroutine library yet, but all the modules and functions have doc strings which should make usage pretty clear. The applications are all rather simple and studying them may be instructive.

Platforms

I've tested on these platforms:

Notes on programming languages

Years ago, I originally wrote the astrolabe routines in C. Now, I always implement in Python first, then make a C++ version as a more-or-less direct translation. The C++ source has a lot of compromises required for compatability with different compilers, which are, however, getting closer to the standard with time.

The Python sources are obviously more compact than the C++ versions and have less declarative overhead. To me, the most unfortunate aspects of C++ are:

To do

Add automated configure scripts for C++ compilation and installation.

Improve the lunar model, perhaps with the complete Chapront ELP2000-82.

Add more material from Meeus:

Fix a bug in the Rise-Set-Transit code which causes events around 0hr UT to be dropped.

Fix a bug in cronus.py that causes equinox/solstice events to be reported out of order on that day. (The displayed values are correct, though).

Improve the param file parsing so people can enter their longitude and latitude more naturally.

Extend the Python code with C modules performing the expensive computations.

(or...) Make a CORBA version of the subroutine library in C++.

Change history

version date
0.5 2005-Jul-4 Brought the code up to date to use new Python features and repair C++ damage caused by evolving gcc compliance. Added a few recent deltaT values.
0.4 2001-Jul-9 Added GPL license text; no code changes.
0.3 2001-May-21 Added equinox-cgi and solstice-cgi CGI interfaces. Plus minor format cleanup in the C++ applications.
0.2 2000-Oct-1 Added C++ version, small bug fixes.
0.1 2000-Sep-3 First version on SourceForge

Comments?
Bill McClain (wmcclain@salamander.com)

Bill McClain's Home Page

Sattre Press

Hosted by: SourceForge logo