Files
Jyotisha/scripts/kp_monthly_transits.py
T
ClaudeandClaude Opus 5.5 aadba9dc61 feat(chat): the astrologer's KP monthly packet with the multi-system window in chat timing — KP sub-chain in the KP profile, packet segments as strip cut points, per-period domain activations instead of K1 / K2, KP windows on the KP periods said as 「前后」 (BUG-2333)
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
2026-11-24 21:07:35 +08:00

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",
}