Scientific Python · Open source

EclipseKit

A modular Python toolkit for calculating, analysing, mapping and validating solar and lunar eclipses.

Numerical astronomy separated from application runtime code. Structured Python results, explicit model assumptions and reproducible validation workflows.

Version 0.1.0a1 · AlphaPython 3.10+Apache-2.0PyPI package

EclipseKit is a Python library, not a graphical eclipse simulator. It has no built-in GUI; developers use its API and command-line validation tools inside their own workflows.

Python libraryStructured API
from eclipsekit import EclipseEngine, Observer

engine = EclipseEngine.from_jpl("de440s")
observer = Observer(
    latitude=42.6,
    longitude=-5.5703,
    name="León",
)

result = engine.calculate_local(
    observer, "2026-08-12"
)

if result is not None:
    print(result.to_dict())
Python 3.10+NumPySkyfieldPyPI

One toolkit, multiple scientific workflows

EclipseKit combines local solar-eclipse circumstances, geocentric and topocentric lunar-eclipse calculations, direct JPL-ephemeris shadow geometry, Besselian-element calculations, lunar-topography interfaces, observation planning, geospatial exports and scientific-reference validation.

11/11documented acceptance cases passed*
Python3.10 or newer
Solar + lunareclipse workflows
Apache 2.0open-source licence

*Recorded validation result for version 0.1.0a1 and the specific fixtures, kernel, time-scale settings and tolerances described in the README. It is not a universal accuracy or scientific-certification claim.

Capabilities

The package exposes reusable Python objects and keeps its numerical assumptions explicit.

🌞

Solar local circumstances

Calculate C1–C4 contacts, local maximum, magnitude, disc-overlap obscuration, solar altitude and azimuth.

🌍

Global shadow geometry

Compute WGS84 shadow-axis intersections, central paths, umbral and penumbral corridor boundaries.

🌑

Lunar eclipses

Classify penumbral, partial and total eclipses, calculate P1/U1/U2/maximum/U3/U4/P4 contacts and local visibility.

🧭

Besselian backend

Run a separate calculation path from explicitly supplied published polynomial elements.

🛰️

Lunar topography

Use lunar-limb models and tiled PDS3/PDS4, GeoTIFF or JPEG 2000 DEM readers, with optional adapters.

🗺️

GIS and observation planning

Export GeoJSON, CSV and KML, compare observation sites and search caller-supplied city catalogues.

📐

Uncertainty propagation

Propagate explicit covariance budgets using finite differences or seeded Monte Carlo sampling.

✅

Scientific validation

Compare named reference fixtures, shadow paths and Besselian results while recording configuration and provenance.

🧩

Public API and extensions

Use the curated eclipsekit.api surface, runtime diagnostics, strict JSON helpers and explicit extension loading.

From local contacts to global shadow geometry

Solar workflows range from observer-specific circumstances to global track and corridor calculations. Geometry is tied to explicit ephemeris and reference-model choices.

↗

Shadow geometry

Calculate a central shadow path and corridor on the WGS84 reference ellipsoid, then export geometry for GIS workflows. Terrain clipping, atmospheric effects and lunar-limb topography are not implicitly applied.

⌕

Catalogue and observation searches

Search local events and caller-supplied city catalogues, or compare candidate observing sites using transparent, weather-agnostic heuristic scores.

from eclipsekit import EclipseEngine, Observer

engine = EclipseEngine.from_jpl("de440s")
observer = Observer(
    latitude=42.6,
    longitude=-5.5703,
    name="León",
)

result = engine.calculate_local(observer, "2026-08-12")
if result is not None:
    print(engine.format_report(result))
    print("C1:", result.contacts.c1)
    print("Obscuration:", result.obscuration_percent)
    print(result.to_dict())

The named JPL kernel is downloaded on first use when it is not already cached. A local BSP/SPK path can also be supplied.

Lunar eclipses and lunar topography

The lunar workflow includes geocentric contacts and classification, then a separate observer-specific visibility calculation that clips phase intervals at moonrise and moonset.

Geocentric event contacts

Supports the P1, U1, U2, maximum, U3, U4 and P4 events where applicable, with penumbral, partial and total classification. The default Herald–Sinnott shadow prescription includes an empirical atmospheric layer; it is not a resolved atmospheric-opacity model.

Local visibility

Accounts for observer location, elevation, optional refraction and a caller-supplied horizon profile. Local moonrise and moonset determine visibility boundaries, not replacements for global eclipse contacts.

DEM readers and mosaics

Provides tiled access to supported lunar DEM products, virtual frame-aware queries and coverage-aware mosaic routing without silently rewriting source rasters.

Coordinate frames and limb models

Requires source frame, longitude convention, reference radius and vertical datum to be explicit. Optional neural lunar-limb correction is experimental and needs independent evidence.

Large ephemeris kernels, city catalogues, lunar DEM rasters and neural checkpoints are not bundled in the PyPI wheel. Users must obtain required data and document its provenance and usage rights.

Install and get started

EclipseKit is published on PyPI. The --pre flag allows pip to select the current Alpha pre-release.

Recommended installation
python -m pip install --pre eclipsekit
Install the documented version
python -m pip install eclipsekit==0.1.0a1

Core dependencies are installed automatically:

  • NumPy
  • Skyfield
Optional extras
# GeoTIFF and JPEG 2000 DEM adapters (Rasterio/GDAL)
python -m pip install --pre "eclipsekit[raster]"

# Neural lunar-limb integration (PyTorch; checkpoint not included)
python -m pip install --pre "eclipsekit[limb]"

Check the installed package and dependencies:

python -m pip show eclipsekit
python -m pip check

Configuration-first API

New integrations can group numerical assumptions into immutable configuration objects. Ephemeris, Earth orientation, contact radii, solver tolerances and atmospheric refraction remain explicit and serializable.

from eclipsekit import (
    EclipseEngine, EclipseConfig, EphemerisConfig,
    EarthOrientationConfig, ContactModelConfig,
    SolverConfig, AtmosphereConfig, Observer,
)

config = EclipseConfig(
    ephemeris=EphemerisConfig.jpl(
        "de440s",
        earth_orientation=EarthOrientationConfig.iers(),
    ),
    contacts=ContactModelConfig(),
    solver=SolverConfig(
        root_tolerance_seconds=1e-5,
        root_max_iterations=100,
        minimum_tolerance_seconds=0.05,
    ),
    atmosphere=AtmosphereConfig(
        refraction_enabled=True,
        pressure_mbar=1013.25,
        temperature_c=15.0,
    ),
)

engine = EclipseEngine(config=config)
result = engine.calculate_local(Observer(42.6, -5.5703), "2026-08-12")

Legacy constructor keywords remain available for compatibility. Do not combine config= with legacy constructor overrides.

ConfigurationPurpose
EphemerisConfig.jpl("de440s")Select a named JPL kernel; local BSP/SPK paths are also supported.
EarthOrientationConfig.builtin()Use Skyfield's bundled time-scale tables for an offline-friendly default.
EarthOrientationConfig.iers()Use the IERS table workflow; first use may require network access.
ContactModelConfig()Use the current spherical-disc contact model.
SolverConfig(...)Set root-solver tolerances and iteration limits.
AtmosphereConfig(...)Make refraction and station atmosphere assumptions explicit.

Validation and reproducibility

The README documents package-level smoke tests and a bundled reference-validation run using a stated environment, kernel, fixture set, time-scale source and tolerances.

Recorded Alpha validation run

  • Distribution: eclipsekit 0.1.0a1
  • Python: 3.12.10 · Windows 11
  • Kernel: JPL DE440s · Skyfield 1.55
  • Reference acceptance cases: 11
  • Passed: 11 · Failed: 0 · Execution errors: 0

Reported subsets include local solar circumstances, geocentric maximum times, NASA central-line path samples and a 1999 Besselian regression.

Validation evidence

Validation is tied to named fixtures and configured tolerances. The repository records the source references, model settings and execution environment so results can be reproduced and interpreted in context.

A passing fixture set does not imply that every feature, location, epoch or physical model is independently validated.

eclipsekit-validate --kernel de440s \
  --path-samples 301 \
  --json-out reports/reference-validation.json \
  --markdown-out reports/reference-validation.md
EclipseKit 0.1.0a1 is an Alpha software release. Passing tests are not external peer review or scientific certification. Published city data may be rounded, global path fixtures are sparse, and lunar-limb/DEM features require their own independent evidence.

The complete validation workflow and required fixture paths are described in the repository README and documentation.

Development, documentation and ecosystem

Public API

New integrations should prefer eclipsekit.api. Existing imports from eclipsekit remain supported. The package includes a PEP 561 py.typed marker.

Tests and CI

The project documents pytest, Ruff, compile checks, wheel building and CI across Python 3.10–3.12 on Ubuntu, Windows and macOS.

Documentation

Detailed equations, methodology, schemas, API contracts, validation and known limitations are maintained in the repository's docs/ directory.

Scientific scope and limitations

The project intentionally distinguishes software tests, reference agreement and scientific certification.

  • Reference coverage is finite; a passing comparison applies only to its fixtures, precision, tolerances, kernel and time-scale assumptions.
  • City searches cover the catalogue points supplied by the caller, not every location in a country.
  • Global path samples do not certify every path point, complete penumbral footprint or every shadow-width/depth/velocity output.
  • Lunar-limb neural and DEM corrections remain experimental without independent benchmarks.
  • Coordinate frames and vertical datums must match the source DEM; selecting a JPL kernel does not automatically transform a DEM.
  • Physical uncertainty must be supplied through an explicit uncertainty budget; solver residuals are not physical uncertainty estimates.

For detailed release gates, consult the Alpha release requirements and scientific 1.0 certification criteria.