A pure-Rust astronomical ephemeris for astrology — validated against JPL DE440, zero unsafe core, Apache-2.0. Get started · Features · Accuracy · Comparison · API docs XALEN Ephemeris computes planet positions, houses and ayanamsas, and the techniques built on them for 12+ astrology traditions (Vedic, Western, Chinese and more), from one pure-Rust core with Python, Node.js, WebAssembly and C bindings and a…
XALEN Ephemeris computes planet positions, houses and ayanamsas, and the
techniques built on them for 12+ astrology traditions (Vedic, Western, Chinese
and more), from one pure-Rust core with Python, Node.js, WebAssembly and C
bindings and a command-line tool. The analytical engine needs no data files and
is sub-arcsecond against JPL DE440 for the Sun and Mercury to Saturn; load the
DE440 kernel and the Moon is sub-arcsecond too. It is validated against JPL
Horizons, Swiss Ephemeris and the public calculators, is thread-safe, has no
unsafe in the core crates, and is licensed Apache-2.0.
Chart wheel. 15 August 1947, 00:00 IST (UTC+05:30), Delhi (28.6139° N, 77.209° E, built-in city table), sidereal Lahiri, Placidus houses: xalen chart --date 1947-08-15T00:00:00+05:30 --place delhi --sidereal --house-system placidus --bodies sun,moon,mercury,venus,mars,jupiter,saturn,uranus,neptune,pluto,rahu,ketu --json
Astrocartography. The same moment: MC, IC, ascendant and descendant lines of the Sun to Saturn, their zenith points, and the three parans nearest Delhi's latitude: xalen map --date 1947-08-15T00:00:00+05:30 --bodies sun,moon,mercury,venus,mars,jupiter,saturn --geojson --parans
Every figure on this page is drawn from a real run by
scripts/readme-figures/generate.py;
run it from the repository root to reproduce them.
Get started
Rust — cargo add xalen-ephemeris
use xalen_ephem::{Almanac, Body};
use xalen_time::{calendar_to_jd, CalendarSystem, JulianDay};
use xalen_ayanamsa::Ayanamsa;
use xalen_vedic::nakshatra::Nakshatra;
let jd = calendar_to_jd(1990, 3, 15, 12.0 - 5.5, CalendarSystem::default());
let almanac = Almanac::default_vedic();
let pos = almanac.geocentric_ecliptic(Body::Moon, jd).unwrap();
let sid = (pos.longitude.to_degrees() - Ayanamsa::Lahiri.compute_deg(jd.as_f64())).rem_euclid(360.0);
println!("{}", Nakshatra::from_longitude_deg(sid)); // Swati
The umbrella crate re-exports every sub-crate (xalen_ephemeris::ephem,
::vedic, ::time, …); individual crates give a smaller footprint
(docs/CRATES.md). Run cargo run --example basic_chart (also
vedic_chart, western_chart, chinese_bazi); more code is in
docs/FEATURES.md.
import xalen.swe as swe is a near-drop-in for import swisseph as swe for the
common calls; see crates/xalen-python.
Node.js — npm install @xalen/ephemeris (published from 0.8; until then build from source, see crates/xalen-node)
const xalen =require('@xalen/ephemeris');const p = xalen.planetPosition('sun',2451545.0);// J2000
console.log(p.longitude, p.isRetrograde);
Browser / WASM — npm install @xalen/wasm
import init,{ XalenWasm }from"@xalen/wasm";awaitinit();const w =newXalenWasm();// Full Vedic chart for Pune (18.52 N, 73.85 E) at J2000, Lahiri ayanamsa (id 0).const chart =JSON.parse(w.fullChartJson(2451545.0,18.52,73.85,0));
Command line — cargo install xalen-cli
# Sidereal (Lahiri) positions with nakshatra and pada
xalen positions --date 2026-11-07T00:00:00Z --sidereal --bodies sun,moon
# Solar eclipses of 2024 as JSON (the 8 April total eclipse is the first)
xalen eclipses --from 2024-01-01 --to 2024-12-31 --type solar --json
Positions, charts, panchang, dasha, fixed stars, eclipses, rise and set times,
aspects, time conversions, astrocartography maps, synastry, composite, Davison
and relocated charts, as a table or with --json; offline, no data files. See
crates/xalen-cli for every command.
What you get
Vedic / Jyotish Dasha, shadbala, KP, Jaimini, Tajaka, panchang with tithi / nakshatra / yoga / karana transition times, compatibility, 16 divisional charts, yoga, dosha; 50 ayanamsa systems, among them every Swiss Ephemeris ID (0-46) and a custom one.
Western Aspects, dignities, 97 Arabic Lots, Hellenistic, Uranian, Cosmobiology, progressions, exact solar and lunar returns, declination aspects and antiscia, harmonics, horary; 23 house systems with Porphyry fallback at polar latitudes.
Chinese and world traditions BaZi, Zi Wei Dou Shu, Feng Shui Flying Stars, Qi Men Dun Jia (experimental), Lal Kitab, I Ching (all 384 Legge line texts), numerology, Korean Saju, Nine Star Ki, Burmese Mahabote (day-sign profile only), Mayan, Aztec, Tibetan, Persian, Egyptian, Celtic.
Relationships and astrocartography Synastry (aspect grid, house overlays), composite (Hand) and Davison charts, relocated charts; MC, IC, ascendant and descendant lines and zenith points for each body (Lewis), and parans (Brady).
Sky 9,096 Bright Star Catalogue stars and 503 named fixed stars with proper motion; 15 asteroids; Chiron, mean and true node, mean and true Black Moon Lilith; solar eclipses from Besselian elements with local C1–C4 contacts, lunar eclipses with umbral and penumbral magnitudes.
Engine and time VSOP87A, ELP2000-82, IAU 2006/P03 precession and IAU 2000B nutation, a NAIF DE440 SPK reader; daily motion and retrograde flags, topocentric, equatorial, heliocentric and XYZ output; UT1 / TT / TDB, leap seconds, Stephenson–Morrison–Hohenkerk 2016 ΔT.
Output SVG charts (North Indian diamond, South Indian box, Western wheel) with no external dependencies; names in 19 languages; geocoding for 130+ cities.
Bindings Python (PyO3), Node.js (napi-rs), WebAssembly (wasm-bindgen) and C (extern "C"), each returning the full six-component position and speed with a retrograde flag.
Cross-checked against JPL Horizons DE440, the real DE440 binary kernel, the
official VSOP87 check file, Swiss Ephemeris and the public calculators
(astro.com, AstroSage, Drik Panchang, Prokerala, Jagannatha Hora). Figures from
docs/ACCURACY.md:
What
Measured
Against
Sun
~0.21″
JPL DE440, 20,000 charts
Mercury – Saturn
≤ 0.76″
JPL DE440, 20,000 charts
Uranus / Neptune
1.78″ / 2.53″
JPL DE440, 20,000 charts
Pluto (Goffin fit, 1885–2099)
~3.2″ measured in-window; published Goffin bound ~1 arcminute
JPL DE440
Moon (ELP2000-82, 60+60 terms)
RMS ~2.8″ (max ~12″) over AD 1600–2100
pyswisseph 2.10.03
Sun, Moon, planets with the DE440 kernel
sub-arcsecond apparent
JPL DE440
Ayanamsas
46 of 47 SE systems < 1″, one documented exception ≤ 2″
Swiss Ephemeris
House systems
18 of 19 comparable systems < 0.01°
Swiss Ephemeris
Lunar eclipses 1900–2100
all 457 found, same type, no extra ones
pyswisseph 2.10.03
The DE440 kernel is optional: enable the kernel-autodownload feature and call
De440Provider::from_auto_cache() to fetch NASA’s de440s.bsp once and reuse
it. How XALEN compares with Swiss Ephemeris, pyswisseph and other Rust crates is
in docs/COMPARISON.md; moving from Swiss Ephemeris is
covered in docs/MIGRATING_FROM_SWISS_EPH.md.
Pure Rust with no C FFI dependencies in any core crate, and no unsafe in library
code outside xalen-ffi (which needs it for extern "C"). No global state: all computation
goes through owned or Arc<T> references, and Almanac and all position types
are Send + Sync. Core crates target wasm32-unknown-unknown, DE440 stacks on
top of VSOP87 with automatic body and epoch fallback, and all data types derive
Serialize / Deserialize.
Building
cargo build --release
cargo test # workspace default members; xalen-python is tested with maturin
bash scripts/gate.sh # the full pre-merge gate: fmt, clippy, tests, docs, accuracy harness
The workflow, toolchain and every check are in CONTRIBUTING.md;
the binding, WASM and benchmark builds are in docs/CRATES.md.
Project stats
24 crates in crates/, plus the umbrella crate and the validation/ runner
over 130,000 lines of Rust in 234 files, 168 of them library sources
over 2,400 tests passing, 0 failures (cargo test --workspace --exclude xalen-python)
zero unsafe in the core crates’ library code; only xalen-ffi uses it, for extern "C"
For commercial licensing inquiries, contact [email protected].
The XALEN name and logo are trademarks of XALEN Technology Pvt Ltd and are
governed by TRADEMARK.md, not by the Apache licence.
Enterprise
XALEN Ephemeris is free and open source (Apache-2.0) — and always will be. For
production use that needs an SLA, IP indemnification, a managed/hosted API,
certified-accuracy reports, white-label, or on-premise support, see
ENTERPRISE.md or reach us at [email protected]. The
open-source core stays Apache-2.0; Enterprise only adds services and optional
proprietary modules on top.
Contributing
Questions, bug reports and feature requests: see SUPPORT.md.
Contributions are welcome; please open an issue before starting significant
work. The path from issue to merged pull request (branch names, commit style,
checks, and the contributor licence agreement) is in
CONTRIBUTING.md. In short: run cargo test and
cargo clippy --workspace --exclude xalen-python -- -D warnings, follow
rustfmt defaults, give every new astrological formula at least one
known-answer test against a published reference, and cite the textbook,
chapter and verse or page in code comments (Wikipedia and blog posts are not
acceptable sources for astrological algorithms).
Especially welcome: an expanded fixed star catalog, DE441 reader support, more
world tradition systems, documentation and examples, and cross-validation test
vectors against Swiss Ephemeris or JPL Horizons.
评论