A small marimo notebook that reconstructs the Artemis II solar eclipse of 2026-04-07 as an interactive widget — with
astropy.coordinates.SkyCoordrunning live in the browser via Pyodide.
On April 7, 2026, NASA's Artemis II Orion capsule "Integrity" passed through the Moon's shadow about 10 000 km from the lunar surface. The crew saw the Sun fully occluded for roughly 54 minutes — far longer than any total eclipse visible from Earth, because at that distance the Moon's angular disk is roughly 25–35× larger than the Sun's.
This notebook reproduces the geometry of the event. The slider scrubs through a 2-hour window around the eclipse; on every tick, the widget recomputes the Sun–Moon geometry from Artemis II's viewpoint using astropy running in your browser tab. No kernel round-trip, no JavaScript.
I built and demoed it live on the Numerically Speaking podcast, 2026-05-01. This repo is the reference implementation.
The notebook ships with PEP 723 inline dependencies, so uv handles everything:
# Open in marimo (edit mode, all widgets interactive)
uvx marimo edit eclipse_widget_mo.py --sandbox
# Read-only / app view
uvx marimo run eclipse_widget_mo.py --sandboxIt also runs unmodified in molab — click the badge above. Pyodide handles all numerics in-browser, no server needed.
To refresh the ephemeris JSON from JPL Horizons (optional — the file is committed):
uv run prepare_data.pyTwo stages, by necessity: sunpy is not packaged for Pyodide, and Horizons cannot be reached from the browser sandbox.
prepare_data.py → artemis_data.json → eclipse_widget_mo.py
(sunpy + astropy, (~50 KB, committed) (pywidget + astropy
runs once on a Mac, runs in Pyodide)
queries JPL Horizons)
prepare_data.pyqueries JPL Horizons via sunpy for Artemis II (NAIF-1024), the Sun, the Moon, and Earth across the eclipse window at 30-second resolution, then writes Earth-relative ICRS vectors plus a precomputed 2D trajectory toartemis_data.json.eclipse_widget_mo.pyis the marimo notebook. TheEclipseWidgetclass subclassespywidget.PyWidget; itsrenderandupdatemethods are Python, but they never execute in the kernel.pywidgetships their source to the browser tab, where Pyodide runs them — including theastropy.SkyCoord.separationcall that drives the right panel.
|
|
pywidget — pure-Python interactive widgets running in Pyodide/WASM. No JavaScript, no _esm blocks, no kernel round-trips.
|
- Eclipse geometry & SunPy analysis inspiration: Artemis II Eclipse on sunpy.org
- Ephemerides: JPL Horizons
- Astronomy: astropy, sunpy
- Runtime: marimo + pywidget
Konstantin Taletskiy — May 2026.