"""Orbital regime classification based on mean motion. Thresholds match the bench/load_bench.sh SQL query: LEO: mean_motion > 11.25 rev/day (period < 128 min, alt < ~2000 km) MEO: mean_motion > 1.8 rev/day (period < 800 min) GEO: mean_motion > 0.9 rev/day (near-synchronous) HEO: everything else (Molniya, tundra, GTO, etc.) """ from .tle import TLERecord def classify_regime(mean_motion: float) -> str: """Classify orbital regime from mean motion (revs/day).""" if mean_motion > 11.25: return "LEO" if mean_motion > 1.8: return "MEO" if mean_motion > 0.9: return "GEO" return "HEO" def classify_record(rec: TLERecord) -> str: """Classify a TLERecord's orbital regime.""" return classify_regime(rec.mean_motion) def regime_summary(records: dict[int, TLERecord]) -> dict[str, int]: """Count objects per regime.""" counts: dict[str, int] = {"LEO": 0, "MEO": 0, "GEO": 0, "HEO": 0} for rec in records.values(): regime = classify_record(rec) counts[regime] = counts.get(regime, 0) + 1 return counts