Skip to main content

Hyperdimensional-computing encoder + Pyodide bridge for the Antikythera mechanism

Project description

antikythera-spectral

A hyperdimensional-computing model of the Antikythera mechanism, packaged for Python and the browser.

Encode any date as a state vector that any of the mechanism's dials can be read from. Decode, compare against modern ephemeris truth, simulate the Hellenistic operator's seasonal-recalibration workflow, and run the project's 31-row hypothesis battery — all from one pip install. Pyodide-compatible: the same package runs in a browser via micropip so a web app can drive a digital Antikythera with no Python server.

What is the Antikythera mechanism?

A bronze hand-cranked astronomical calculator built in Hellenistic Greece around 150–60 BCE, recovered in 1901 from a shipwreck off the island of Antikythera. Its surviving 30+ gears predict solar / lunar / planetary positions, eclipses (via the 18-year Saros cycle), and the four-year Olympiad calendar. Freeth et al. 2021 (Sci. Rep. 11:5821) is the current authoritative reconstruction; the device's planetary front face has not survived intact and remains the subject of active research.

The HDC framing this package implements: every gear is a faithful representation of ℤ/nℤ; every mesh is a rational map between cyclic groups; every dial pointer is a hypervector whose components are the phase angles on the various dials. The Greeks built a resonant HDC object before Plate wrote HRR.

Install

pip install antikythera-spectral

The base install pulls only numpy — sufficient for the encoder, decoder, frozen-data accessors, and the H-battery rows that don't need a JPL ephemeris.

Optional extras:

pip install "antikythera-spectral[ephemeris]"    # adds skyfield + jplephem
pip install "antikythera-spectral[hypotheses]"   # adds scipy (for chi-square in H-H1)
pip install "antikythera-spectral[plot]"         # adds matplotlib
pip install "antikythera-spectral[all]"          # everything above

Pyodide / micropip (in-browser)

import micropip
await micropip.install("antikythera-spectral[ephemeris]")

The full Bridge API is available from a Pyodide REPL with no server-side Python.

Quick start (Python)

>>> from antikythera_spectral import bridge
>>> result = bridge.get_dial_state(jd_tdb=1684500.0)   # ~205 BCE
>>> result['ok']
True
>>> result['dials']['mars']['angle_deg']
247.3

Quick start (CLI)

antikythera-spectral encode --jd 1684500.0
antikythera-spectral visibility --planet mars --from-jd 1684500 --to-jd 1685000
antikythera-spectral compare ephemerides --jd 1684500 --body mars \
                                          --kernel-a de421 --kernel-b de441_part1
antikythera-spectral hypotheses --csv-out -

What can you do with it?

  • Encode any Julian date as a state vector across all of the mechanism's dials.
  • Decode any state vector back to per-dial residues (round-trip is exact for the LCM variant).
  • Convert dates between Gregorian, Julian, Athenian archonship + Attic months, and Olympiad year — the four calendar systems an ancient Greek astronomer or modern reader might use.
  • Compute visibility windows for each planet (heliacal rising / setting + solar elongation), the astronomical reality that gates the operator's recalibration workflow.
  • Search for eclipses in any date band via sky-driven ephemeris enumeration.
  • Simulate the operator workflow (§11.6.16 of the research notebook): start at a date, advance, observe at heliacal rising, re-anchor, repeat.
  • Compare reconstructions — Freeth 2021 vs Wright vs Price 1974 dial readings simultaneously at any date.
  • Compare ephemeris kernels — DE421 vs DE441 vs DE441_part1 deltas at a chosen JD/body in arc-seconds, kilometers, AU.
  • Run the 31-row hypothesis battery that drives the research notebook, get JSON / CSV output.
  • Override gear ratios (what-if mode) — re-encode with arbitrary p/q to explore alternative period relations like the canonical Venus 5/8.
  • Inventory by fragment (archaeological mode) — list which gears are attested in fragments A/B/C/D vs reconstructed by Freeth.
  • Babylonian Goal-Year overlay — given a planet+date, return what an astronomer using the 47-year Mars cycle (or 59-year Saturn, etc.) would have predicted.
  • Animation export — emit a time-series of states over a date range for a viewer / animation frontend.

Bridge API

docs/bridge_api.md is the consumer-facing contract. 28 methods grouped by purpose; each returns a Pyodide-JSON-serializable {"ok": True, ...} dict. Numpy arrays in return values are real-valued (Float32 for amplitude payloads) so JS consumers can use new Float32Array(...) directly.

Hypothesis battery

The package ships the same 31-row H-battery the research scaffold runs. Headlines:

  • 22 PASS — encoder round-trips perfectly for all D variants; pin-and-slot encodes T-symmetry breaking; manufacturing tolerance is fine for one Metonic cycle; etc.
  • 3 PARTIAL — the proxy-metric Pareto for {7, 17}; the prime spectrum vs null model; H-H1 chi-square against Almagest periods.
  • 3 FAIL — including E-H2: uniform Mars encoder peak ≥ 150° (this is expected; the failure mode is the rationale for the §11.6.16 operator-recalibration framing).
  • 3 UNDETERMINED — open exploration F-series rows, plus skyfield-gated rows when no ephemeris kernel is on disk.

See the research notebook for the full row-by-row narrative.

Documentation

Topic Link
Research notebook (the project narrative) antikythera_spectral_research_notebook.md
Bridge API contract bridge_api.md
Calendar systems reference CALENDAR_SYSTEMS.md
Ephemeris kernels (DE421 / DE441 / etc.) EPHEMERIS_KERNELS.md
ΔT discussion (Earth-rotation drift at -200 BCE) DELTA_T_MODEL.md
Operator workflow simulation (§11.6.16) OPERATOR_WORKFLOW.md
Roadmap ROADMAP.md
Changelog CHANGELOG.md

Citing

If antikythera-spectral contributes to a paper or write-up, please cite both the package and the research notebook:

@software{antikythera_spectral,
  author = {Kirkland, Steven},
  title = {antikythera-spectral: Hyperdimensional-computing model of the Antikythera mechanism},
  year = {2026},
  url = {https://github.com/lemonforest/mlehaptics/tree/main/docs/antikythera-maths/antikythera-spectral},
  version = {0.1.0}
}

License

GPL-3.0-or-later. Matches the license of the parent monorepo.

See also

Sibling packages in the same monorepo:

  • chess-spectral — the same HDC + cyclic-group-algebra framing applied to chess, with native C accelerator.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

antikythera_spectral-0.1.0.tar.gz (176.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

antikythera_spectral-0.1.0-py3-none-any.whl (198.2 kB view details)

Uploaded Python 3

File details

Details for the file antikythera_spectral-0.1.0.tar.gz.

File metadata

  • Download URL: antikythera_spectral-0.1.0.tar.gz
  • Upload date:
  • Size: 176.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for antikythera_spectral-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0105a649f0fb847cfe2cf36ec2671625f3a763a5bc0f7d64bc01cb941ac1c5c7
MD5 5872ef0e4cc1a26e56c510fefe2ed3c0
BLAKE2b-256 e8409703dd3024fd8a81782e121540e92b62e4a5e4e9c05baff98303682a47b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for antikythera_spectral-0.1.0.tar.gz:

Publisher: antikythera-spectral-publish.yml on lemonforest/mlehaptics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file antikythera_spectral-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for antikythera_spectral-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ed5022fb9b0dbfd6b063d110a7858568853d6c8fc79f7d3bc0627f4a25ceb78e
MD5 7ebdf5303090f74f7c713dcb7dde1364
BLAKE2b-256 0071bc11e267088cb0cc034985e0d8e054df96fdcd9aa4437ef3c99c8f17d7f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for antikythera_spectral-0.1.0-py3-none-any.whl:

Publisher: antikythera-spectral-publish.yml on lemonforest/mlehaptics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page