Add git hooks for format and lint checks (#31)
rusty-hook installs the hooks on the first test build of the wrapper crate. On commit:
cargo fmt --all --checkand the workspace clippy invocation CI runs; on push: clippy again. The gates and CI own the tests.Co-authored-by: Claude Fable 5.1 noreply@anthropic.com
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
empyrean
High-fidelity ephemeris generation, orbit propagation, and orbit determination powered by automatic differentiation
empyrean is an astrodynamics toolkit for ephemeris generation, high-fidelity propagation, and orbit determination. It ships as a Python wheel, a C shared library, a CLI binary, and a Rust crate — a single codebase in Rust with minimal dependencies: a custom automatic differentiation library, a state-of-the-art orbit propagator, and an orbit determination code leveraging the best of both.
The design premise is simple: every function and routine in the propagator is differentiable. Force model terms, coordinate transformations, ephemeris generation, and integrator steps each carry exact derivatives through the computation. With those derivatives in hand, sensitivity analyses, covariance propagation, and orbit determination optimization come naturally rather than as an afterthought.
Linearized uncertainty propagation has its limits, even with higher-order corrections. Close approaches, chaotic dynamics, and long arcs push it past the point of validity. The art is in knowing when you have reached that point and are better off switching to classical sampling methods: Monte Carlo, line-of-variation, or Gaussian mixture sampling. empyrean strives to do this automatically, accurately, and at the blazing speed you would expect from a toolkit built in Rust.
The current focus is planetary science: dynamics of Solar System small bodies like asteroids and comets, with plans to extend to cislunar space.
Install
pip install empyreancargo add empyreancargo install empyrean-cli(or grab a binary from Releases)libempyrean-<target>.tar.gzfrom Releases — ships the shared library,empyrean.h, and LICENSECurrent release: 0.10.0 — see the CHANGELOG.
Prebuilt binaries — the engine cdylib, the CLI, and the Python wheels — target four platforms: macOS arm64 (
macos-aarch64), macOS x86_64 (macos-x86_64), Linux x86_64 (linux-x86_64), and Linux aarch64 (linux-aarch64). Python wheels are published as a single abi3 stable-ABI wheel per architecture that installs on CPython 3.10 and every newer version (3.10–3.13), with no source distribution.cargo add empyrean/cargo install empyrean-clidownload the prebuilt engine for those targets and stop with an error elsewhere.All channels pull from the same published cdylib. Run
empyrean version(CLI),empyrean::version_string()(Rust), orempyrean.version_string()(Python) to confirm the build provenance — every cdylib carries the<tag>+<sha>strings of thevilleneuve/scott/nolancommits it was built against. For per-run reproducibility, a built system handle’sdescribe()additionally reports the force-model menu and the SHA-256 identity of every kernel that run loaded.Channels
Four bindings, one engine binary. The same call makes the same numbers wherever you make it; what differs is reach.
determinekeyed by ADES designationSessionrefit — mask / refine / diffdescribe()provenanceempyrean showoutput browserQuickstart
The three headline pipelines — propagation, ephemeris generation, and orbit determination (including iterative
Sessionfitting) — each shown end-to-end in Python, Rust, and CLI.Propagate
Pull Apophis (99942) from JPL SBDB, propagate 10 years past its SBDB epoch.
Python
Rust
CLI
Ephemeris
Predict Apophis’s on-sky position (RA / Dec / range / light-time) at Mauna Kea (MPC observatory code 568) for the next three months.
Python
Rust
CLI
Each ephemeris row also carries its uncertainty: the 6×6 sky-plane covariance over (ρ, RA, Dec) and their rates (AU / degree units), mapped from the orbit’s state covariance — absent when the input orbit carries none, never zero-filled — plus the aberrated (light-time corrected) barycentric ICRF Cartesian state at the photon-emission epoch, with its own 6×6 covariance. The sky covariance is the marginal over whatever force-model parameter uncertainty the orbit declares, not the conditional: an orbit declaring none is unchanged, and any Marsden 3×3, DT / AMRAT variance or Δv block widens every sky σ. A generate call additionally returns its non-fatal warnings — an Earth-orientation kernel coverage gap bridged by the analytic IAU 2006 fallback, a row whose sensitivity chain was skipped — so a silent run is a clean run.
One case needs a deliberate choice: generating an ephemeris for one of the sixteen SB441-N16 bodies (1 Ceres, 2 Pallas, 4 Vesta, 7 Iris, …), which at Standard tier are simultaneously the target and part of the force model. The default
ephemeris_overlap_policyreturns the body’s own SPK states and integrates nothing, so the call fails for want of a dense trajectory. Set the policy toexclude_and_integrate(or name the body inexcluded_perturbers) and the overlapped perturber is dropped from the force model, your initial conditions are integrated, and the overlap is reported. It lives on the propagation config, so Python, Rust, and C all reach it; the CLI exposes no flag for it.Orbit determination (with
Session)Fit Apophis’s orbit from its full MPC astrometric arc — optical and radar together — then iterate with
Sessionto mask a noisy night and compare χ² / DOF before vs after.determineis multi-object at every layer: hand it an ADES set covering many designations and it returns one result per object, keyed by designation. The CLI exposes the one-shot pipeline; theSessionworkflow is Python, Rust, and C.Python
Rust
CLI
Determination is batch-first at every layer: the ADES file is grouped by object identifier and every object is fitted, so the CLI emits sibling tables — the fitted orbits (state + covariance + any fitted non-gravitational parameters, one row per delivered object, keyed by its ADES designation), a per-object fit summary covering every input object whether or not it produced an orbit, and the per-observation residuals carrying an
object_idcolumn so a flat table across a batch stays attributable.fit_summaryis always written as both parquet and CSV, whatever--formatsays, so a partially successful batch can be read at a terminal without a parquet tool. Join them in pandas / Polars / DuckDB the same way you would the propagation / ephemeris outputs.Every table is written whole. The residual file carries the complete 36-field per-observation surface — the
obs_id/object_idjoin keys, observatory code, catalog and epoch, the effective residual covariances, the entire typed rejection block (reason, criterion, threshold, effective threshold, information loss), the influence diagnostics, the along / cross-track decomposition, and the radar block — in parquet, CSV, and JSON alike, all three emitted from one column table so they cannot disagree. The fitted-orbit CSV carries the same 82-column schema as the parquet, covariance included, rather than a lossy projection of it.Parquet additionally carries the wide cross-covariance — the state↔parameter and parameter↔parameter terms beyond the state+Marsden 9×9 — in a tagged tail, so a fitted orbit round-trips through a parquet file with the joint the fit actually computed rather than its diagonal blocks. It is the only orbit format here that can, and the other two refuse such a batch by name rather than writing it short — both pointing at parquet. CSV cannot because the schema makes the difference between an absent cross and a supplied zero cross load-bearing, and CSV renders both as an empty cell; the JSON orbit format is this crate’s own flat row shape, carrying the 6×6 and nothing beyond it. A carrier holding thrust Δv terms is refused wherever it is offered, because no orbit-file format can serialize the thrust arcs those terms describe.
Residual rows are typed by observable. Optical rows carry the RA / Dec and along / cross-track residuals with the track-frame pair’s full 2×2 covariance; radar rows carry the delay (seconds) or Doppler (hertz) observed − predicted residual with its χ², degrees of freedom, survival probability, and combined variance. Every row also reports its D-optimality information loss on removal — +∞ marks an observation the fit cannot do without.
No observation is ever dropped without saying why. Every row carries a typed
rejection_reason—accepted,chi_squared,sigma_clip,cooks_distance,adaptive,cmc2003,unsupported_observatory,outside_arc,non_finite_chi2,missing_jacobian, and the rest — written as a name rather than an integer code, alongside the criterion value that was tested, the threshold it was tested against, and the effective threshold when the adaptive layer set one.Both acceptability verdicts travel with the fit and reach the files.
fit_acceptableis the fit-quality gate;extrapolation_acceptableis that AND four forward-propagation axes, each writing its own boolean, measured value, and threshold: the fraction of observations retained, the span the selected observations still cover, the gap between the last selected and the last available observation, and σₐ / |a|. A fit that is not safe to propagate therefore says which axis failed — a heavily pruned arc, a selected span that no longer covers the requested one, a rejected recent tail — rather than only that it is not. A quantity that could not be computed is NaN, never0.0, which would read as a measurement at the floor.Every delivered fit also says how the solver stopped — including one that did not converge, which is exactly the case the verdict is for.
terminationis the solver’s own verdict (metgtol, ran out of damping, exhausted its iteration budget, was delivered by the stable-stall acceptance, …), andgn_step_qnormis the undamped Gauss-Newton step’s quadratic form at the delivered iterate, the one step norm comparable toconvergence_tol. A fit that converged and a fit the solver merely stopped producing steps for used to arrive through the same success path, indistinguishable; now they are not.accepted_steps,final_solve_iterations,mu_finaland the stall-delivery block travel alongside.Underneath, the fit is the engine’s, and three of its lanes are what carry the hard objects. Optical and radar are solved together rather than in sequence — radar rows are grouped by the same object identifier and folded into that object’s fit, so delay and Doppler tighten the same covariance the astrometry does. A co-orbital IOD lane seeds the Earth-Trojan-class geometries (2010 TK7, 2020 XL5) the classical cascade does not reach; it fires only when every co-orbitality gate passes, and
coorbital_enabledon the OD config turns it off. And the outward-expansion pipeline escalates across the dynamical discontinuities that break a long comet arc, delivering the full arc where it can and tagging what it could not reconcileoutside_arcwhere it cannot — setallow_arc_truncationto false and that fallback becomes a loud failure instead of a partial fit. Observation weights default to the VFCC2017 station floors (Vereš, Farnocchia, Chesley & Chamberlin 2017) with nightly de-weighting.Beyond the six-element state,
determineandrefinesolve a wider parameter set — the Marsden A1/A2/A3 non-gravitational coefficients, the (cometary outgassing) time delay DT, the solar-radiation-pressure area-to-mass ratio (AMRAT), and thrust Δv-correction segments — each carried through the fit with the exact derivatives the propagator already computes. DT, AMRAT, and the thrust segments are refine-path solves: the orbit you pass in must already carry a prior (a declared variance) on the parameter, and that prior is what opens it to the fit. Ask for a parameter the orbit has no prior for and the call errors loudly — it never returns a zeroed or silently defaulted column.The result carries a tagged solved covariance: the identities of the fitted parameters travel with the matrix, so you read a parameter’s variance from its slot — the DT slot, the AMRAT slot, a thrust component — rather than guessing at column order.
It also carries an event-aware trust verdict on that covariance: trusted; encounter-intervenes — naming the intervening close approach or high-nonlinearity crossing, and whether a second-order state-only correction can recover it; or weakly-determined for wider solves, where the delivered 6×6 is the marginal of a higher-dimensional fit. Absence of a verdict is not trust — it means no gate ran.
An optional post-OD photometry fit recovers the absolute magnitude H and a phase-function slope from the arc’s observation magnitudes. It runs after the orbit is solved, climbing a model ladder — H-only → HG₁₂ → HG₁G₂ (Muinonen et al. 2010) — to the richest model the arc’s phase-angle coverage supports, and reports H with an honest 1σ. Magnitudes in bands with no adopted V-band conversion are excluded, counted, and their band codes listed — the observations’ astrometry is unaffected.
Reading the outputs back
Every pipeline command writes Parquet / CSV / JSON, and
empyrean showreads them at a terminal. It only reads files: no kernels, no engine, so it works on a machine that has the CLI and nothing else, and on files copied off a cluster.When a batch fails, it names the orbit
Every batch entry point takes N orbits and M epochs and fails as a whole. A failure that belongs to one orbit says which one — the index in the batch, the
orbit_idit was tagged with, and the epoch — so the offending row is read off the failure rather than found by re-running the batch one orbit at a time.The same three values are
Error::orbit_index()/orbit_id()/epoch_mjd_tdb()in Rust,empyrean_error_location()in C, and a line of their own on any CLI command that runs a batch. They areNonewhen the failure belongs to no single orbit — an empty epoch grid, a missing kernel, a config the whole call was refused on — because an index that is always present is an index that means nothing. Nothing is inferred from the message text: a field is filled only when the boundary or the engine supplied that value, so absent means not known, never not applicable.Data and offline operation
empyrean init(CLI),empyrean.download_data()(Python), andempyrean::download_data(Rust) provision a data directory: files already present are kept and only the missing ones are fetched, so re-running costs nothing. On Python, kernels supplied by installed data packages are staged with no network access at all.A context can then be built with the network switched off. Strict offline resolves the tier’s kernel set from the data directory alone and fails, naming every absent file, if any is missing — there is no try-the-network-and-tolerate path and no quiet degrade to a lower tier. The absent names come back as a list rather than as prose:
Error::missing_data_files()in Rust, amissing_data_filesattribute on theFileNotFoundErrorPython raises,empyrean_missing_data_files()in C. It is reachable on every channel —initialize(refresh=False)(Python),Context::from_data_dir_withwithDataDirOptions(Rust),empyrean_context_from_data_dir_withwithEmpyreanDataDirOptions(C), and the global--no-refreshflag on every CLI command, whereempyrean init --no-refreshbecomes a pure verifier that downloads nothing and reports exactly what the directory lacks.A fetch that was attempted and failed is reported on the same missing-data axis rather than as a generic I/O fault, and the message names the kernel by URL — a withdrawn or rotated upstream pin reads as the connectivity problem it is, not as a local disk to repair.
EMPYREAN_OFFLINE=1in the environment is a floor, not a switch: it downgrades a requested refresh to off and announces it on stderr, and it can only ever remove network access, never restore it. It binds data provisioning on every channel that reads the environment — both Rust constructors (Context::from_data_dirandContext::from_data_dir_with),initialize()in Python, and the CLI’s data-acquiring commands — and the provisioning calls that have no offline form (empyrean::download_data,empyrean.download_data(),empyrean init) refuse under it rather than download. Only the exact value1asserts it.Two things it deliberately does not cover, so that a machine-level assertion is never mistaken for more than it is. The catalog query helpers —
query_sbdb,query_horizons,query_horizons_vectors,query_observations,query_radar, and the CLI’squerycommand and--object-idinputs — call JPL and the MPC directly and are not gated by the variable. Neither is the C ABI, which reads no environment variable at all by design: a C caller states the policy in theEmpyreanDataDirOptionsit passes.Validation
Every release is validated against JPL Horizons,
find_orb, and GRSS on a curated catalog of 50 objects across 13 dynamical populations — NEOs, MBAs, SB441-N16 self-perturbers, Jupiter / Neptune / Earth Trojans, TNOs, Centaurs, comets, interstellar objects, temporarily-captured objects, confirmed impactors, and short-arc NEOs. The same plan runs through all four channels, so cross-channel parity is measured rather than assumed. Propagated states agree with JPL Horizons at the sub-meter level on bounded timescales; orbit determination results are cross-checked againstfind_orbfits and JPL SBDB solutions, and radar delay / Doppler residuals against GRSS; ASSIST serves as an additional propagation reference on a 39-object subset. Per-release changes are tracked in the CHANGELOG.Citing
If you use empyrean in your research, please cite it. Citation metadata ships in
CITATION.cff(GitHub’s “Cite this repository” button renders it), and every GitHub release is archived on Zenodo with a version-specific DOI — prefer citing the DOI of the exact version you used. The DOI badge at the top of this page carries the concept DOI (10.5281/zenodo.21318471), which always resolves to the latest archived release.License
empyrean is dual-licensed:
libempyreanshared library, and theempyreancommand-line binary — are licensed under the proprietary Empyrean Binary License. Binaries are free to install and use (including commercial use) but may not be redistributed, modified, reverse-engineered, decompiled, or disassembled.Scope of the BSD-3 source
The BSD-3 grant covers only the binding / integration layers in this repository — the Rust API surface, FFI shims, Python
pyo3wrappers, CLI argument parsing, and build glue. The underlying propagation engine, orbit-determination engine, and automatic- differentiation library are proprietary closed-source components distributed only as the compiled binary inside the wheel / dylib / CLI. These engines do their work entirely inside the binary; the BSD-3 wrapper sources call into them through stable internal APIs but do not contain their implementations.Practical consequence: cloning this repository and reading or modifying the wrapper source is permitted under BSD-3, but you cannot build a working empyrean from this source alone — the engines are not in this repository and are not part of the BSD-3 grant. Use the published binary distribution (
pip install empyrean, the C dylib, the CLI binary) and treat it as the unit of deployment.Copyright © 2024–2026 Joachim Moeyens. All rights reserved.