Celestial Programming: Greg Miller's Astronomy Programming Page
A collection of astronomy related programs, algorithms, tutorials, and data. Most of the code here is public domain, though some
code, data, and/or images my be under other copyright (usually an open source license), details will be given on relevant
pages.
Greg Miller (gmiller@gregmiller.net)
Applications
- Rise and Set Graph Graph showing sun, moon, twilight and other objects' rise and set times.
- Altitude Graph Graph showing the altitude of selected objects over the course of a day for a given location.
- Sky Path Graph showing the path of an object for a given location and day.
- Digital Sextant Use your phone's camera to get a location fix on two stars.
- Solar Eclipse Map An interactive map for solar eclipses (Under development).
- Compass A web based compass.
- JPL Horizons CGI Builds a URL for submitting to JPL Horizons CGI Interface.
Tutorials
- VSOP-87 Multilang VSOP87 in many different programming languages, computes the position of the Sun, Moon, and Planets.
- Tips, Tricks, and Pitfalls A list which might save you some time by learning from others mistakes.
- JPL Ephemeris Format Explains the format of the ASCII and binary files used for the JPL Development Ephemeris, explains how to use the data to compute the positions of the planets and other data stored in them, and has a walkthrough example. Example implementations in JavaScript and other languages are provided.
- Computing Besselian Element Polynomial Coefficients explains how to compute the polynomial coefficients for Besselian Elements like those produced in the Five Millennium Canon of Solar Eclipses. A Javascript example implementation is also given.
- Solar Eclipse Predictions Using Besselian Elements explains how to use Besselian Elements to compute predictions for various events for a Solar Eclipse.
Snippets
- Julian dates. Snippets regarding Julian date conversions.
- Day of Week Compute the day of the week for a given date, useful for generating calendars.
- Low Precision Moon Position. Low precision moon algorithm from the Astronomical Almanac. Accuracty .5deg between 1900 and 2100
- Low Precision Sun Position. Low precision algorith from the Astronomical Almanac to return RA/DEC of Sun. Accuracy 1° from 1950-2050.
- Higher Precision Sun Position. Sun position algorithm accurate to 38 arcseconds for 1000 years around Jan 1, 2000.
- Rise, Set, Transit Times. A simplified implemention of the Rise, Set, Transit algorithm from the book Astronomical Algorithms.
- Moon Position (Full ELP2000-82b) Code to compute the position of the moon using the full ELP2000-82b theory from Bureau des Longitudes.
- Moon Position (Trucated ELP2000-82b) Code to compute the position of the moon using the truncated ELP2000-82 theory from Astronomical Algorithms.
- Moon Phases Implementation from Astronomical Algorithms to compute the dates of phases of the moon.
- Illuminated Fraction of the Moon An implementation of Meuus' aproximation of the illumnated fraction of the Moon's disk.
- Moon Phase Rendering Produces an image showing the phase of the moon.
- Moon Age Computes the approximate age of the moon in days.
- Compact Ephemeris A compact and fast ephemeris to generate approximate planet positions. Algorithm from the Explanatory Supplement.
- VSOP2013 Example An example implementation of VSOP2013, a higher accuracy version of VSOP87, but not as large as the JPL DE.
- RA/Dec to Alt/Az Conversion of RA/Dec coordinates to Alt/Az by several methods.
- Ra/Dec to Alt/Az Test Data A set of about 300 test cases to validate the above RA/Dec to Alt/Az implementations.
- Alt/Az to Hour Angle/Dec Compute the Hour Angle and Declination from an Alt/Az position.
- Star X, Y, Z Coordinates Compute the rectangular (x, y, z) coordinates of a star from parallax and RA/Dec.
- Lat/Lon to XYZ Converts the polar coordinates of Latitude and Longitude to Cartisian/Rectangular x, y, z coordinates.
- Rectangular to Polar Convert between rectangular (xyz) and polar (lat/lon or RA/Dec) coordinates.
- Decimal Hours/Deg to Components Converts decimal forms of hours and degrees to hours, minutes, seconds, and degrees to degrees, arcminutes, arcseconds.
- Rotation Matricies 2D and 3D rotation matrices.
- Angle Between Two Ra/Dec Points Computes the angular separation between two points.
- Horizon DistanceCompute various values relating to the distance to the horizon.
- Atmospheric Refraction Approximate atmospheric refraction corrections.
- GMST Greenwich Mean Sidereal Time.
- 1976 Precession Implementation of IAU 1976 Precession from Astronimical Algorithms.
- 2006 Precession Implementation of IAU 2006 Precession from IERS Tech Note 36.
- Precession - Long Term Long term precession algorithm from Vondrak et al. valid for several thousand centuries.
- 1980 Nutation An implementation of the IAU 1980 nutation model.
- 2000b Nutation An implementation of the IAU 2000b nutation model.
- 2000a Nutation An implementation of the IAU 2000a nutation model.
- Stellar Parallax to Distance Convert parallax (in arcseconds) to distance (in parsecs and AU).
- Geographic Position A non-rigorous example to convert RA/Dec to a Geographic Position.
- JSON Star Catalog The Hipparcos catalog in JSON format with a simplified number of fields. Links to other common star catalogs.
- Constellation Stick Figures The stick figures used to represent constellations, taken from Stellarium (GPL License).
- Constellation Center Points The RA/Dec coordinates of the centers of the constellations.
- Common Star Names A list of common star names and their HIPPARCOS catalog ID.
- Angle Between Ecliptic and HorizonThe angle between the ecliptic and the local horizion.
- Sky Path Angle Angle between the horizon and the path of an object through the sky.
- Two Star Celestial Fix Compute latitude and longitude using the Alt from two stars.
- Camera Field of View Equation to compute the field of view of a camera.
- Greek Symbols A list of the Greek Symbols (a.k.a. greek letters/greek alphabet).
- Line Intersection (2D) Methods to compute the intersection of two lines given in different forms.
- Full Moon Names The so called "traditional" or "Indian" names of the full moons.
- Local Solar Time Computes the local solar time for a given longitude.
- Equation Of Time A simplified Eqation of Time algorithm.
- Sundial - Horizontal Equation to compute the angles for the lines on a typical sundial.
- Sundial - Vertical Equation to compute the angles for the lines on a vertical sundial.
- Sundial - Nodus Equation to compute the path of a shadow of a particular point on an object.
- Solar Terminator Algorithm Approximate method for drawing the solar terminator (or visible region of any far away object)