Motivation
After troubles described in my note “Key flaw of modern programming paradigm” I got understanding that my apps for celestial navigation requires deep modification.
Software purposed for autonomous navigation must be autonomous itself. It must not require constant internet connection.
Moreover, it must be able to work using as minimal external dependencies as possible (preferably zero).
It must be automatic as possible and fast in operation – because in flight you have no time to search Nautical Almanacs. And, of course, it must be as precise as celestial navigation methods can be.
Same time, it was obvious that implementation of fully autonomous and zero-dependency application would require plenty of time. And additionally, total autonomy of an app for celestial navigation is not possible, because it needs regularly updated external data (for example, planetary ephemerides, star coordinates and time correction settings).
A solution for this contradiction was the architecture of my new celestial navigation library in a manner how it is implemented now.

Features & Architecture
celnav is freeware, open-source, Python-based, low-dependency software library for autonomous celestial navigation.
It’s functional follow the library logic – the system provides to user number of externally accessible functions, which can be used from Python console, Jupyter Notebook or any other Python app. This functions includes methods for:
- Geographical position determination via celestial navigation, triangulation and trilateration methods
- Basic navigation routines including orthodromy calculation, waypoint calculation and estimation of “dead reckoning”
- Auxiliary utility methods for processing time and detecting magnetic declination
- Set of methods for position determination on the move (experimental for now)
Provided methods allows to determine your geographical position using precise clock and elevation measurement equipment (like a sextant or star tracker), with at least two sight reductions of Sun, Moon, or other navigation stars and planets mentioned in The Nautical Almanac.
Best CEP of position fix via stars – about 1/5 nmi in autonomous mode and about 1/10 nmi (~180 m) with AstroPy ephemeris.
celnav has only 4 external dependencies:
- numpy (for vector math and matrix operations)
- requests (for downloading star coordinates from stellar catalogs)
- astropy (mostly as an alternative source of ephemerides)
- setuptools (for setup and configuration purposes)
celnav provides for user two main sources of astronomical data:
- Astropy.
- Local “astronomical engine”.
Astropy provides more precise ephemerides, but requires connection to the Internet to gather actual data.
“Astronomical engine” utilize algorithms from “Fundamentals of Astrodynamics and Applications”, Fourth Edition, by David Vallado (src. #1) and “Astronomical Algorithms (1998), 2nd ed.” by Jean Meeus (src. #2).
For Venus, Mars, Jupiter & Saturn “astronomical engine” uses ephemerides from src. #1. For stars, “astronomical engine” uses local database, built on data from celestial object catalogues.
Data in this database is actual for epoch 2025. By command, the database can be built/update (by user choice) from:
- Hipparcos/Tycho Catalogue
- SIMBAD Astronomical Database

Algorithms
Celestial coordinates
Algorithms of an “astronomical engine” follows algorithms and notation from src. #1 and src. #2. During calculation of celestial coordinates algorithms count Earth rotation and secondary effects, including:
- precession
- nutation
- yearly movement of stars
Sight corrections
Sight reduction algorithm counting sight corrections mostly following recommendations from Pub. No. 9 “AMERICAN PRACTICAL NAVIGATOR AN EPITOME OF NAVIGATION ORIGINALLY BY NATHANIEL BOWDITCH, LL.D.” 2019 EDITION (src. #3), including:
- index correction of sensor
- observer altitude
- environment temperature
- environment pressure
- chosen limb (Like in src. #3 “-1”: for Sun and Moon, “0” for stars and planets)
Sight reduction
celnav using original sight reduction algorithm, optimized for computer processing.
The idea of an algorithm developed from classic cptn. Thomas H. Sumner method, as it was explained on the site of Omar Reis and in src. #3. I modified it to use with vector math which is more suitable for computer calculations.
The algorithm is calculating an offset from dead reckoning (DR) and a heading angle of a tangent of a circle of equal elevations.
As an input for algorithm we using geographical coordinates of DR and , time (as Julian date), time correction and measured corrected elevation of selected celestial object .
From an astronomical data source we receive position vector of sighted celestial object .
Then, we calculating corrected time:
From and we calculating how that was described in src. #1.
Then let’s calculate DR position vector. Imply that is Earth equatorial radius, is Earth eccentricity and is altitude over reference ellipsoid:
Get direction vector from DR to sighted celestial object:
Now, transform direction vector into topocentric horizon system SEZ:
Now:
From this, offset from DR can be expressed as:
Further,
And from here, heading angle of a tangent of a circle of equal elevations will be:
Position determination
Position determination algorithm calculating actual position as a crossing point of two tangents of a circle of equal elevations we got from two sight reductions.
Calculation of a crossing point performed via Cramer rule.
I clearly understand that this simplest approximation is not most precise method. In further versions I will improve this.
Triangulation & trilateration
Triangulation algorithm is implemented following Tienstra method. Trilateration algorithm is implementing the algorithm described in an article “Robust Trilateration Based Algorithm for Indoor Positioning Systems” by Simeon Pande and Kwame S Ibwe.
Both triangulation and trilateration methods are not getting in count curvature of the earth, so with long ranges CEP could be high.
Further improvements
Understanding that at current state celnav library have number of weaknesses, I am planning to improve it.
Main improvements will inlcude:
- Improvements of ephemerides calculation (especially for the Moon)
- Improvements of triangulation, trilateration, position fix algorithms
- Minimization of dependencies (maybe as standalone fork)
Source code
Source code of the library provided at its GitHub repo.

