Ports her yinduzhanxing 17a135457ec16b621f86dd57ba3926612ce1b9b8 (docs ee34700357): timing_evidence_packets.py (new), kp_monthly_report_packet / theme_support / vimshottari / transits, kp_system, with her tests. The report path (frozen engine, no timing systems supplied) keeps its earlier packet byte for byte; her profile and window run when the caller supplies the periods it already computed (engine tool kp_timing_packet, cached per chart and window). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXp2Vp62Ur3C7yRWQdSq
51 lines
1.8 KiB
Python
Executable File
51 lines
1.8 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""Monthly transit snapshots for the KP three-year report."""
|
|
|
|
from __future__ import annotations
|
|
|
|
try: # pragma: no cover - import path differs under CLI vs pytest
|
|
from domain_calculation_service import compute_chart
|
|
except ImportError: # pragma: no cover
|
|
from scripts.domain_calculation_service import compute_chart
|
|
|
|
|
|
def build_monthly_transit_snapshot(
|
|
*, year: int, month: int, lat: float, lon: float, tz: float,
|
|
ayanamsa: str = "kp", node_mode: str = "mean", position_mode: str = "apparent"
|
|
) -> dict:
|
|
chart = compute_chart(
|
|
{
|
|
"year": year,
|
|
"month": month,
|
|
"day": 1,
|
|
"hour": 12,
|
|
"minute": 0,
|
|
"second": 0,
|
|
"lat": lat,
|
|
"lon": lon,
|
|
"tz": tz,
|
|
"ayanamsa": ayanamsa,
|
|
"node_mode": node_mode,
|
|
"position_mode": position_mode,
|
|
}
|
|
)
|
|
planets = chart.get("planets") if isinstance(chart.get("planets"), dict) else {}
|
|
snapshot = {}
|
|
for name in ("Sun", "Moon", "Mars", "Mercury", "Jupiter", "Venus", "Saturn", "Rahu", "Ketu"):
|
|
row = planets.get(name) if isinstance(planets.get(name), dict) else {}
|
|
snapshot[name] = {
|
|
"sign": row.get("sign"),
|
|
"longitude": row.get("degree_raw", row.get("degree")),
|
|
"retrograde": bool(row.get("retrograde")),
|
|
"speed": row.get("speed"),
|
|
}
|
|
return {
|
|
"month": f"{year:04d}-{month:02d}",
|
|
"anchor_local": f"{year:04d}-{month:02d}-01T12:00:00",
|
|
"planets": snapshot,
|
|
"calculation_profile": {"ayanamsa": ayanamsa, "node_mode": node_mode,
|
|
"position_mode": position_mode, "timezone_offset": tz},
|
|
"status": "parameter_sensitive",
|
|
"source": "local_kp_month_anchor_chart",
|
|
}
|