DEV Community

Cover image for Swiss Ephemeris Returns 6 Floats. Your App Needs a Chart.
Xalen Technologies
Xalen Technologies

Posted on

Swiss Ephemeris Returns 6 Floats. Your App Needs a Chart.

Every astrology backend on earth runs on Swiss Ephemeris. It is accurate to the arcsecond and has earned three decades of trust. Now look at what it hands back.

import swisseph as swe
xx, ret = swe.calc_ut(jd, swe.MOON, swe.FLG_SIDEREAL)
moon_lon = xx[0]   # (281.43, -4.21, 0.0026, 13.17, 0.58, -0.00003)
Enter fullscreen mode Exit fullscreen mode

Six floats. Position and speed. That is the entire API for a body, and it is where Swiss stops and your real work begins.

Swiss computes positions, not astrology

There is no nakshatra function. No dasha engine. No panchang, no divisional charts, no shadbala, no KP, no yogas. pyswisseph inherits the same surface,because it is a binding, not a new library. So every team rebuilds the same thousands of lines on top of xx[0]:

# YOU write the nakshatra, the pada, the rashi,
# the Vimshottari dasha balance, the tithi/yoga/karana,
# the shadbala, the D-9, the D-10... none ships with Swiss.
Enter fullscreen mode Exit fullscreen mode

Then you hand-roll it all into JSON, because Swiss returns C double[6] arrays.

What "returns a chart" looks like

XALEN Ephemeris is a pure-Rust,Apache-2.0 ephemeris that treats the interpretive layer as part of the library.
The same Moon longitude is the input to functions that already exist:

let nak      = Nakshatra::from_longitude_deg(moon_sid);
let rashi    = Rashi::from_longitude_deg(moon_sid);
let panchang = compute_panchang(sun_sid, moon_sid, jd.as_f64());
let dashas   = vimshottari_dasha(moon_sid, jd.as_f64(),              DashaLevel::Antardasha);
Enter fullscreen mode Exit fullscreen mode

That is the real API from examples/vedic_chart.rs. And every public type derives serde, so the JSON problem vanishes:

let body = serde_json::to_string(&panchang)?;
It even renders the literal chart. Swiss hands you six floats; XALEN hands you an SVG:

Enter fullscreen mode Exit fullscreen mode


rust
let svg = render_north_indian(&chart);



On top of that: 50 ayanamsa systems, 23 house systems, Western aspects and
dignities, plus BaZi, Saju, Mayan, and I-Ching. None of it present in Swiss.

## And the math holds up

Positions are measured against **JPL Horizons DE440**, the same reference Swiss reads, reproducible from the test suite (`cargo test --workspace`, 2,199 passing):

- Sun: **0.21 arcsec**
- Mercury through Saturn: **under 0.76 arcsec**, zero data files (VSOP87A compiled in)
- Moon: RMS ~2.8 arcsec analytically, sub-arcsecond with the optional DE440 kernel

So you keep JPL-class positions and get the layer Swiss made you build yourself.

## The point

The question was never "is Swiss accurate." It is. The question is how much of your codebase exists only because Swiss stopped at a `double[6]` and left the chart to you. There is now a library that already wrote that part.

> Availability note: XALEN's crates.io, PyPI, and npm packages are not all
> published yet. Today you build from source; the claims above are reproducible
> from the repo right now. Star it to catch the release.

**github.com/vedika-io/xalen-ephemeris**

Enter fullscreen mode Exit fullscreen mode

Top comments (0)