star-anomaly 0.1.0
Mean, eccentric, hyperbolic and true anomaly
Public state: Released & Verified. The registry label is RELEASED. What the states mean →
Apache-2.0 Released & Verified single file
Summary
Kepler's equation and the conversions between mean, eccentric, hyperbolic and true anomaly for closed and open orbits: a bracketed Newton solver that cannot diverge, a residual that does not cancel near the periapsis of nearly parabolic orbits, the revolution kept; within 1e-14 rad of 50-digit arithmetic on 1120 orbits.
Run in your browser
Edit the code and press Run (or Ctrl+Enter). Python runs in your browser with this package's published code. The first run downloads Python once (about 12 MB).
Runs in the browser: all 32 tests pass in the browser's Python (Pyodide 314.0.7, Python 3.14.2), measured on 20 October 2026.
Use it on your computer
No account and no GitHub needed. Download, then install with one command:
- Install file · star_anomaly-0.1.0-py3-none-any.whl 4 kB
- Single file — copy it alongside your code · star_anomaly.py 8 kB
- Source code (.zip) 26 kB
python -m pip install star_anomaly-0.1.0-py3-none-any.whlIn Python: import star_anomaly
Cite it, and its bill of materials
For a paper, a report or a supplier file: the citation in two formats, and the software bill of materials (SBOM) in the two standard formats, with the fingerprint of the wheel.
@software{cavazzini_star_anomaly_0_1_0,
author = {Cavazzini, Andrea},
title = {{star-anomaly}: Mean, eccentric, hyperbolic and true anomaly},
version = {0.1.0},
year = {2026},
url = {https://andrea07072000.github.io/S.T.A.R.-/software/star_anomaly/},
note = {Apache-2.0. Source: https://github.com/Andrea07072000/S.T.A.R.-, commit dc09f61d}
}
For developers
Install directly from the public repository:
python -m pip install "star-anomaly @ git+https://github.com/Andrea07072000/S.T.A.R.-.git@dc09f61dcee098d518f070d6a23a8815defc1109#subdirectory=packages/star_anomaly"
Technical sheet
Requirements
- R1 Closed orbits (0 <= e < 1):
eccentric_from_mean,mean_from_eccentric,true_from_eccentric,eccentric_from_true,true_from_mean,mean_from_true. Open orbits (e > 1):hyperbolic_from_mean,mean_from_hyperbolic,true_from_hyperbolic,hyperbolic_from_true. Angles in radians. - R2 The closed-orbit functions keep the revolution (nothing is wrapped). Kepler's equation is solved by Newton's method inside a bracket that always contains the root, with the residual written so that it does not cancel near the periapsis of a nearly parabolic orbit; the true anomaly comes from a form with no quadrant to choose.
- R3 Measured on 1120 orbits (620 closed, 500 open, a fifth of them nearly parabolic) and two published examples, four conversions each: within 1e-14 rad of 50-digit arithmetic on every case; within 2e-14 rad of hapsira and Orekit on the ordinary orbits (the nearly parabolic ones are reported apart in the evidence file).
- R4 Every function returns a float or raises
ValueError: values that are not finite real numbers, an eccentricity on the wrong side of 1 for the function called, an angle beyond 1e9 rad, a true anomaly at or beyond the asymptote of an open orbit, a result too large for a float.
Limits (what is not claimed)
The parabola (e exactly 1) is not covered: use Barker's equation elsewhere. Some conversions are badly conditioned by nature and no code can repair that: near a parabola, the eccentric anomaly recovered from a true anomaly close to 180 degrees, and the hyperbolic anomaly recovered from a true anomaly close to the asymptote, hold fewer digits than the input (the function is accurate for the float it is given; the float does not hold the information). The 50-digit reference uses other formulas than the module's but was written by the same author. No propagation in time: converting a time to a mean anomaly is one multiplication, left to the caller.
Release gate
Computed by the registry from the result files, with the same function that decides RELEASED.
- Mutation score, latest measure of each module (needs at least 0.850)
- star_anomaly.py 0.937 (2026-10-07)
- Independent implementations written by others (needs 2)
- hapsira.core.angles, Orekit KeplerianAnomalyUtility, poliastro/hapsira angles
- Also compared with, not counted
- S.T.A.R.'s own re-derivations: Kepler's equation and half-angle relations at 50 digits in mpmath (same author), S.T.A.R. Newton (Vallado Alg. 2 start)
- Result
- Released & Verified
Evidence in the registry
| Check | Status | Recorded | What was observed |
|---|---|---|---|
| Unit tests | VERIFIED | 2026-10-07 | 32 passed in 0.61s |
| Review | VERIFIED | 2026-10-07 | Requirements, interface, units, data provenance, dependency surface and failure behaviour reviewed |
| Review | VERIFIED | 2026-10-07 | Re-running the cross-check gives a byte-identical evidence file |
| Reference value | VERIFIED | 2026-10-07 | degrees(eccentric_from_mean(radians(235.4), 0.4)) = 220.51207476752208; hyperbolic_from_mean(radians(235.4), 2.4) = 1.6013761449325081 (suite: 32 passed in 0.61s) |
| Cross-check with independent libraries | VERIFIED | 2026-10-07 | star_anomaly solves Kepler's equation and converts between mean, eccentric, hyperbolic and true anomaly to within 1e-13 rad of 50-digit arithmetic, nearly parabolic orbits included |
| Benchmark | VERIFIED | 2026-10-07 | largest difference from 50-digit arithmetic: 8.9e-15 rad; hapsira on nearly parabolic orbits: 5.4e-14 rad; Orekit: 7.1e-08 rad |
| Clean install from the release tag | VERIFIED | 2026-10-07 | pytest outside the tree: 32 passed in 0.41s |
| Mutation testing | VERIFIED | 2026-10-04 | before 216/266 = 0.812; after 224/262 = 0.855 (38 survivors, mostly equivalent: clamp constants, zero z-column of Q, Newton start/tolerance) |
| Review | VERIFIED | 2026-10-03 | Re-execution of bench.xc-010 reproduces the committed evidence bundles |
| Review | VERIFIED | 2026-10-03 | Re-execution of bench.xc-009 reproduces the committed evidence bundles |
| Cross-check with independent libraries | VERIFIED | 2026-10-03 | star_elements and hapsira agree on [E, nu] for 20 (M, e) cases plus the Vallado case |
| Benchmark | VERIFIED | 2026-10-03 | 21/21 AGREE, reference deviation 4.8e-10 deg, reproduced by star verify |
| Reference value | VERIFIED | 2026-10-03 | 220.512074767 deg, deviation < 1e-9 deg; Curtis Ex. 3.2 within 5e-5 rad |
| Unit tests | VERIFIED | 2026-10-03 | 8/8 anomaly tests pass (14/14 in the package) |
Fingerprints (SHA-256)
| star_anomaly-0.1.0-py3-none-any.whl | ef50d76b035b0f0ea4eacb9c743dacba4f619395af98cdea02634c1b14a92a92 |
| star_anomaly.py | 76f3de92f09322b24e3c45c652b3063583486a03b023535c152ab6489a7f44ea |
| star_anomaly-0.1.0-source.zip | 3e5da0c594b2b71bad7d1aae71f65b4713fc6b1f9df05c4c8ef01c01c6e7528c |
