73 Commits

Author SHA1 Message Date
53733daeba Update docs for v0.8.0 orbital_elements type and MPC parser
Add orbital_elements (72-byte Keplerian element type) to types reference,
three new function sections (oe_from_mpc, small_body_heliocentric,
small_body_observe) to the functions reference, MPC catalog loading
workflow to the comets/asteroids guide, and update CLAUDE.md with
v0.8.0 version numbers, 82 functions, 8 types, 16 test suites.
2026-02-18 14:22:39 -07:00
1adab6e136 Update docs with 66k benchmark results, honest SP-GiST framing
- benchmarks.mdx: Add GiST conjunction screening and KNN sections,
  update all numbers to 66,440-object catalog, PG 17→18, show SP-GiST
  slower than seqscan at this scale with explanation of why
- operators-gist.mdx: Real 66k performance tables for GiST and SP-GiST,
  rewrite KNN example with scalar subquery pattern, add CTE warning
- conjunction-screening.mdx: Update catalog size, candidate counts,
  add KNN scalar subquery note, verified performance numbers
2026-02-18 12:23:47 -07:00
eadbb45a3b Fix function names and argument order in catalog guide 2026-02-18 10:28:26 -07:00
26ae80d340 Add Building TLE Catalogs guide, cross-reference pg-orrery-catalog
New guide: guides/catalog-management.mdx covering the full
download/merge/load pipeline with pg-orrery-catalog CLI.

Updated tracking-satellites.mdx to reference the companion tool
instead of "No TLE fetching". Added cross-reference in benchmarks
setup instructions.
2026-02-18 10:19:13 -07:00
747b7ae60a Fix L1 inclination pruning for HEO orbits, add 66k benchmark
Bug: inner_consistent used sma_low for footprint calculation, but
ground footprint grows with altitude. High-SMA bins (GTO, HEO)
need sma_high to compute the maximum footprint — using sma_low
caused 453 false negatives at high-latitude observers (Tromsoe).

Fix: use sma_high (not sma_low) in L1 inclination pruning.

Added regression test: GTO-debris (inc 5 deg, e=0.73) at Tromsoe
must return identical results from seqscan and index scan.

Benchmark on 65,886-object catalog (full Space-Track including
decayed): 80-92% pruning, zero false negatives across 7 query
patterns. SP-GiST beats seqscan for high-latitude observers.
2026-02-17 23:05:49 -07:00
5e5588fddb Update docs for v0.7.0: types, operators, test count, performance framing
- types.mdx: "seven" → "seven base types + one SQL composite",
  add observer_window section with field table and usage example
- operators-gist.mdx: "three operators" → "four operators", reframe
  SP-GiST performance as scalability feature (honest about seqscan
  being faster at 14k catalog size, index helps at 100k+)
- installation.mdx: "14 test suites" → "15 test suites", list all
  suites including od_fit, spgist_tle, vallado_518
- design-principles.mdx: clarify observer_window is SQL composite
  (variable-length, query-time only), base types still STORAGE=plain
- pass-prediction.mdx: lead with operator value (80-90% elimination),
  SP-GiST index framed as optional for large catalogs
2026-02-17 21:51:26 -07:00
845aeee3a5 Add pass prediction guide, operator reference, and benchmarks
New docs:
- guides/pass-prediction.mdx: two-stage workflow (SP-GiST filter
  then SGP4 propagation), query window comparison tabs, GiST/SP-GiST
  coexistence example
- reference/operators-gist.mdx: &? operator signature and description,
  observer_window type reference, SP-GiST operator class docs with
  eccentricity/HEO limitation aside

Benchmarks on 14,376 CelesTrak active satellites:
- SP-GiST index: 2,344 kB, builds in 19 ms
- GiST index: 2,904 kB, builds in 45 ms
- Consistency: 0 false negatives, 0 false positives
- At 14k catalog size, seqscan (~6 ms) still beats index scan (~8 ms)
  due to low page count; cross-over expected at ~100k objects
2026-02-17 21:30:57 -07:00
bb235f51fa Add SP-GiST orbital trie design spec for satellite pass prediction index
Evolved from the original KTrie custom AM proposal (preserved as
KTRIE-SPEC-ORIGINAL.md). Key design decisions: 2-level trie (SMA +
inclination) instead of 5, SP-GiST framework instead of custom AM,
query-time RAAN filter instead of trie level, propagation-aware cost
estimation via traversalValue.
2026-02-17 19:53:42 -07:00
3ea4e2bf53 Add OD documentation and workflow translation pages for v0.4.0-v0.6.0
New pages:
- OD function reference (tle_from_eci, tle_from_topocentric,
  tle_from_angles, tle_fit_residuals)
- OD guide (ECI, topocentric, angles-only, range rate, weights,
  multi-observer, covariance interpretation)
- From find_orb to SQL (OD workflow comparison)
- From Poliastro to SQL (Lambert/Kepler comparison)

Updated pages:
- Corrected stale "No orbit determination" claim
- Updated function counts and test suite counts
- Added v0.4.0-v0.6.0 upgrade paths
- Added OD to capabilities table, theory-to-code mapping,
  constants/accuracy reference
- Added OD examples to Skyfield comparison and SQL Advantage
- Fixed stale version references across workflow pages
2026-02-17 18:43:13 -07:00
3915d1784f Rename pg_orbit to pg_orrery
An existing product called PG Orbit (a mobile PostgreSQL client)
creates a naming conflict. pg_orrery — a database orrery built from
Keplerian parameters and SQL instead of brass gears.

Build system: control file, Makefile, Dockerfile, docker init script.
C source: GUC prefix, PG_FUNCTION_INFO_V1 symbol, header guards,
ereport prefixes, comments across ~30 files including vendored SGP4.
SQL: all 5 install/migration scripts, function name pg_orrery_ephemeris_info.
Tests: 9 SQL suites, 8 expected outputs, standalone DE reader test.
Documentation: CLAUDE.md, README.md, DESIGN.md, Starlight site infra,
36 MDX pages, OG renderer, logo SVG, docker-compose, agent threads.

All 13 regression suites pass. Docs site builds (37 pages).
2026-02-17 13:36:22 -07:00
cd338c3c64 Vendor SGP4/SDP4 as pure C, drop g++ dependency
Replace the sat_code git submodule (lib/sat_code/) with vendored
sources in src/sgp4/. The upstream .cpp files are renamed to .c —
the code is valid C99 with zero C++ features. This eliminates the
g++ and -lstdc++ build dependencies.

Adds 518 Vallado test vectors (AIAA 2006-6753-Rev1) as a 13th
regression suite to verify byte-identical numerical output.

Updates all documentation (CLAUDE.md, DESIGN.md, 11 MDX pages,
Dockerfile) to reflect the new layout and pure-C compilation.
2026-02-17 12:45:39 -07:00
27a6e7106f Custom OG image renderer with pg_orbit branding
Replace generic blackAndWhite preset with custom renderer using
site colors (#0a0e17 dark background, #f59e0b amber accents),
decorative orbital rings watermark, branded footer with pg_orbit
name and site URL. Inter font in 400/700 weights.
2026-02-17 03:53:07 -07:00
86a2e386b7 Add tagline and docs SEO infrastructure
Hero tagline: "It's not rocket science. (It's celestial mechanics.
But now it's just SQL.)" across README, index.mdx, and meta description.

Add astro-icon with Lucide icon set, astro-seo-meta, and
astro-opengraph-images (blackAndWhite preset, Inter font). Override
Starlight Head component to inject og:image and twitter card tags
with auto-generated 1200x630 PNG images for all 37 pages.
2026-02-17 03:48:14 -07:00
15fa553c0e Add optional JPL DE440/441 ephemeris support (v0.3.0)
Clean-room DE binary reader (~400 lines C) with Chebyshev/Clenshaw
evaluation — no GPL dependency on jpl_eph. Per-backend lazy
initialization preserves PARALLEL SAFE. Existing VSOP87/ELP82B
functions stay IMMUTABLE; new _de() variants are STABLE with
automatic fallback to compiled-in ephemerides on any DE failure.

Implementation:
- de_reader.c: header parse, record seek, Clenshaw recurrence
- eph_provider.c: GUC (pg_orbit.ephemeris_path), lazy init,
  ICRS-to-ecliptic frame rotation, on_proc_exit cleanup
- de_funcs.c: 11 new SQL functions (_de variants + diagnostics)
- Constant chain of custody rules 6-8 (frame rotation,
  same-provider, AU consistency)

Extract observe_from_geocentric() to astro_math.h for shared use
by planet_funcs.c, moon_funcs.c, and de_funcs.c.

57 → 68 functions, 11 → 12 regression test suites, all passing.
2026-02-16 19:54:48 -07:00
a8c6e98bdb Add hero image: PostgreSQL elephant orbiting a planet 2026-02-16 07:52:15 -07:00
1c8cf27d36 Fix docs domain: pg-orbit.warehack.ing 2026-02-16 07:34:44 -07:00
a78e8eb27c README v0.2.0 rewrite and docs deployment infrastructure
README covers all 57 functions across 9 domains with quick-start
examples, capability matrix, body ID tables, and performance benchmarks.
Links to Starlight docs site for detailed reference.

Adds Docker Compose deployment for docs site behind caddy-docker-proxy
with dev/prod modes and Vite HMR support through reverse proxy.
2026-02-16 07:09:37 -07:00
12292415ab Starlight docs site for pg_orbit v0.2.0
34 MDX pages covering all 57 functions across 7 domains:
satellites (SGP4/SDP4), planets (VSOP87), Moon (ELP2000-82B),
19 planetary moons (L1.2/TASS17/GUST86/MarsSat), stars,
comets, Jupiter radio bursts, and Lambert transfers.

Site structure:
- Getting Started: overview, installation, 5-query quick start
- Guides: 8 domain-specific walkthroughs with workflow translation
- Workflow Translation: side-by-side comparisons with Skyfield,
  JPL Horizons, GMAT, Radio Jupiter Pro, plus SQL patterns
- Reference: all types, functions, operators, body IDs, constants
- Architecture: Hamilton's principles, constant chain of custody,
  observation pipeline, theory-to-code mapping, thread safety
- Performance: verified benchmarks with reproduction methodology

Stack: Astro 5.17 + Starlight 0.37.6, KaTeX math, Mermaid
diagrams, Pagefind search, Caddy production Docker image.
2026-02-16 03:12:41 -07:00
28511a34a2 Close Craft integration thread — install instructions
Craft-side code is wired up. pg_orbit just needs to be installed on
the Craft database for satellites to appear in /api/sky/up.
2026-02-15 18:33:34 -07:00
2dc90a992e Reply to Craft test data package with verification results
All 8 suggested regression tests pass. Amateur satellite batch
(6 TLEs) propagates cleanly. Report includes 2-D GiST index
upgrade results showing inclination-based pruning with real
satellite data.
2026-02-15 18:26:39 -07:00
3fe11a5d7f Add test data package for Craft integration
ISS reference vectors, edge case TLEs (deep space, Molniya, decayed,
sun-sync, GEO), amateur satellite batch, Skyfield cross-verification
script, and 6 suggested regression SQL tests.
2026-02-15 18:24:59 -07:00
5552bf3280 Add convenience functions for Craft integration
Implements 5 new C functions requested by the Craft (Astrolock) API team:
- tle_from_lines(text, text): two-argument TLE constructor
- observer_from_geodetic(float8, float8, float8): numeric observer constructor
- observe(tle, observer, timestamptz): single-call propagate + topocentric
- sgp4_propagate_safe(tle, timestamptz): returns NULL on propagation error
- observe_safe(tle, observer, timestamptz): returns NULL on propagation error

Refactors do_propagate() into safe/unsafe variants to support NULL returns.
Adds regression test (convenience.sql) covering all new functions including
an equivalence test verifying observe() matches the manual two-step pipeline.
All 6 regression tests pass.
2026-02-15 17:44:41 -07:00
15a830dc40 Initial implementation of pg_orbit PostgreSQL extension
6 custom types (tle, eci_position, geodetic, topocentric, observer,
pass_event), 67 SQL functions, 2 operators (&&, <->), and a GiST
operator class for altitude-band indexing. Wraps Bill Gray's sat_code
for SGP4/SDP4 propagation with WGS-72 constants for propagation and
WGS-84 for coordinate output. All 5 regression tests pass on PG 18.
2026-02-15 17:07:07 -07:00