Product 2026-11-07: stay in sync with the astrologer's latest (5fb8379c..ea2a9d65). - Method layer: mirror SKILL.md re-imported with import_yinduzhanxing.py from a clean ea2a9d65 clone (import record, manifest, import plan); root SKILL.md body equals the mirror again (nine-lord editorial reference line). Router and sub-skills unchanged upstream except her rectification skill, which is the protected commercial skill here. - 7b43eaf2: rectification question templates say they are templates (basis, timing status, answer impact), no regression_hint +5 bias, low confidence cap, blocked/external execution status in the audit table, invalid answers ignored by the selector, calculation_profile echoed; API rejects a partial lat/lon/tz and event rectification without a place. - a4b4b267: BPHS 27.19 Drik weighting readings as diagnostic variants in scripts/shadbala_reference/drik_profiles.py (shadbala.py is frozen, ERR-110; default quarter and BPHS piecewise geometry unchanged, BUG-1586 / BUG-1623); oracle audit compares rupa with rupa; VP Jain benchmark prints by default. - bb26dc2d: /api/jaimini special mode carries the Goel fields, no invented Aries ascendant. - d66d13ce: annual report exposes tajika_named_yoga_structures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
154 lines
6.4 KiB
Python
154 lines
6.4 KiB
Python
#!/usr/bin/env python3
|
|
"""Compare the native Shadbala chain with PyJHora's VP Jain-attributed fixture."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import argparse
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
PLANETS = ("Sun", "Moon", "Mars", "Mercury", "Jupiter", "Venus", "Saturn")
|
|
EXPECTED = {
|
|
"sthana": (172.04, 77.17, 184.94, 238.16, 152.98, 198.08, 206.31),
|
|
"dig": (6.59, 12.22, 20.99, 31.97, 31.99, 53.29, 26.67),
|
|
"kala": (81.80, 205.85, 158.08, 210.68, 144.22, 135.89, 139.56),
|
|
"chesta": (0.0, 0.0, 20.93, 28.76, 8.43, 28.18, 5.05),
|
|
"naisargika": (60.0, 51.43, 17.14, 25.71, 34.29, 42.86, 8.57),
|
|
"drik": (11.24, -0.32, -5.10, 4.29, 4.32, -2.86, 5.82),
|
|
}
|
|
LOCAL_KEYS = {
|
|
"sthana": ("sthana_bala", "total"),
|
|
"dig": ("dig_bala",),
|
|
"kala": ("kala_bala", "total"),
|
|
"chesta": ("chesta_bala",),
|
|
"naisargika": ("naisargika_bala",),
|
|
"drik": ("drik_bala",),
|
|
}
|
|
|
|
|
|
def _native_output() -> dict:
|
|
command = [
|
|
sys.executable, str(ROOT / "scripts" / "jyotish_engine.py"), "shadbala",
|
|
"--year", "1981", "--month", "9", "--day", "13",
|
|
"--hour", "1", "--minute", "30", "--lat", "28.65",
|
|
"--lon", "77.2166666667", "--tz", "5.5", "--ayanamsa", "lahiri",
|
|
]
|
|
return json.loads(subprocess.check_output(command, cwd=ROOT, text=True))
|
|
|
|
|
|
def _value(row: dict, path: tuple[str, ...]) -> float:
|
|
value = row
|
|
for key in path:
|
|
value = value[key]
|
|
return float(value)
|
|
|
|
|
|
def _variant(component: str, planet: str) -> str:
|
|
# #166 (astrologer 2026-11-04): the engine default is the named BPHS version;
|
|
# this fixture is Raman-family (PyJHora). Labels name the convention that differs.
|
|
if component == "sthana":
|
|
if planet in {"Sun", "Mercury"}:
|
|
# Fixture counts the whole Moolatrikona sign; Mercury also moves with the
|
|
# BPHS Saptavargaja values (BUG-1584).
|
|
return "moolatrikona_degree_range_vs_whole_sign"
|
|
return "saptavargaja_bphs_vs_raman" # BUG-1584: 20/15/10/4/2 vs 22.5/15/7.5/3.75/1.875
|
|
if component == "drik":
|
|
return "drik_bphs_26_piecewise_vs_raman_bonus" # BUG-1585 / BUG-1586
|
|
if component == "kala" and planet == "Sun":
|
|
# BUG-1582: the fixture doubles the Sun's Ayana in Kala and gives Chesta 0;
|
|
# the engine counts A in Kala + A as Chesta. Kala + Chesta equals the fixture's.
|
|
return "sun_ayana_convention"
|
|
if component == "kala" and planet == "Mercury":
|
|
return "mercury_nature_convention" # BUG-1585: Mercury with Saturn is a malefic, Paksha 60 - P
|
|
if component == "kala" and planet == "Moon":
|
|
# BUG-1557: the fixture doubles the Moon's Paksha (Raman GBB) and gives her
|
|
# Chesta 0; the engine follows BPHS-Santhanam 27.10-11 + 27.18 (P in Kala,
|
|
# P again as Chesta). The Moon's Paksha total is 2P on both sides.
|
|
return "moon_paksha_convention"
|
|
if planet in {"Sun", "Moon"}:
|
|
return "luminary_chesta_policy"
|
|
return "mean_motion_seeghrochcha_variant"
|
|
|
|
|
|
def build_report() -> dict:
|
|
packet = _native_output()
|
|
views = packet.get('engine_views') or {}
|
|
local_view = views.get('local_legacy') or {}
|
|
if local_view.get('planets'):
|
|
actual = local_view['planets']
|
|
selected_view = 'engine_views.local_legacy'
|
|
else:
|
|
actual = packet.get('planets') or {}
|
|
external_default = (views.get('default') == 'pyjhora_jhora' or
|
|
(packet.get('canonical_output') or {}).get('status') == 'canonical_ready' or
|
|
any('pyjhora' in str(row.get('source', '')).lower() for row in actual.values()))
|
|
if external_default or not actual:
|
|
raise ValueError('local Shadbala view unavailable; external canonical output is not a native benchmark')
|
|
selected_view = 'planets_local_fallback'
|
|
rows = []
|
|
for component, expected_values in EXPECTED.items():
|
|
for planet, expected in zip(PLANETS, expected_values):
|
|
local = _value(actual[planet], LOCAL_KEYS[component])
|
|
delta = round(local - expected, 4)
|
|
matched = abs(delta) <= 1.0
|
|
rows.append({
|
|
"component": component,
|
|
"planet": planet,
|
|
"unit": "Virupa",
|
|
"published_value": expected,
|
|
"local_value": local,
|
|
"delta": delta,
|
|
"tolerance": 1.0,
|
|
"status": "within_tolerance" if matched else "method_variant",
|
|
"variant": None if matched else _variant(component, planet),
|
|
})
|
|
matched = sum(row["status"] == "within_tolerance" for row in rows)
|
|
return {
|
|
'comparison_engine': {'engine': 'native_local', 'selected_view': selected_view,
|
|
'cli_default_view': views.get('default', 'local')},
|
|
"case": {
|
|
"name": "VP Jain-attributed Shadbala fixture",
|
|
"birth": "1981-09-13T01:30:00+05:30",
|
|
"latitude": 28.65,
|
|
"longitude": 77.2166666667,
|
|
"ayanamsa": "Lahiri",
|
|
},
|
|
"source": {
|
|
"upstream": "PyJHora V4.8.7 pvr_tests.py::shadbala_VPJainBook_tests",
|
|
"upstream_commit": "ca22995709bd60e371e7820a1a5efc80ce4cf821",
|
|
"upstream_url": "https://github.com/naturalstupid/PyJHora/blob/ca22995709bd60e371e7820a1a5efc80ce4cf821/src/jhora/tests/pvr_tests.py#L6853",
|
|
"upstream_issue": None,
|
|
"license_boundary": "AGPL-3.0 process-isolated numeric expectations only; no implementation copied.",
|
|
"truth_status": "candidate_attributed_fixture_replay_not_independent_arbitration",
|
|
},
|
|
"summary": {
|
|
"row_count": len(rows),
|
|
"classified_count": len(rows),
|
|
"within_tolerance_count": matched,
|
|
"method_variant_count": len(rows) - matched,
|
|
"absolute_parity": False,
|
|
},
|
|
"rows": rows,
|
|
}
|
|
|
|
|
|
def main(argv=None) -> None:
|
|
# Upstream a4b4b267: read-only JSON on stdout unless an output path is given.
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument('--output', type=Path, help='Explicit output path; default is read-only JSON on stdout')
|
|
args = parser.parse_args(argv)
|
|
payload = json.dumps(build_report(), ensure_ascii=False, indent=2) + '\n'
|
|
if args.output:
|
|
args.output.write_text(payload, encoding='utf-8', newline='\n')
|
|
print(args.output)
|
|
else:
|
|
print(payload, end='')
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|