Files
Jyotisha/scripts/research/kota_chakra_external.py
T
ClaudeandClaude Opus 5.5 ac9be6f88c feat(techniques): port the astrologer upstream skill's missing techniques
Port from yinduzhanxing 5fb8379c (MIT): Naisargika, Kaala, Karaka, Tara,
Lagnamsaka, Yogardha, Mandooka, Paryaaya and Padanadhamsa dashas;
Sarvatobhadra, Kota and Kalanala chakras; Nakshatra Latta; Pachakadi;
Raman Amsayu and Pindayu. Producers and their upstream tests are copied;
scripts/upstream_technique_layers.py feeds them our natal and transit
positions and attaches chart.consultation_native_layers.upstream_techniques.

- dasha_registry: kaala and padanadhamsa keys (35 -> 37); the nine ported
  dashas are served by compute_dasha or fail closed with upstream's reason.
- technique_registry.json: 16 partial entries; README badges follow.
- Evidence lookup section `upstream_techniques` in the consultation tool.
- Boundaries: Kalanala carries no PyJHora (AGPL) grid coordinates;
  Padanadhamsa/Lagnamsaka run on our Narayana engine (no Rath Table 12,
  PVR co-lord variants or second cycle). PyJHora observers and the Amsayu
  worked-example scaffold live in scripts/research (root .py budget).
- PyJHora black-box cross-checks: Naisargika (lords/years) and Kaala
  (seed segment and fraction within 5e-4) on a public chart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
2026-11-07 14:44:37 +08:00

66 lines
4.1 KiB
Python

"""Opt-in process-isolated observation of PyJHora Kota layout constants.
No Qt runtime, date generation, Vedha or fort-entry judgment is involved.
"""
import json
import subprocess
import sys
from copy import deepcopy
PLANETS = ('Sun', 'Moon', 'Mars', 'Mercury', 'Jupiter', 'Venus', 'Saturn', 'Rahu', 'Ketu')
SOURCE = 'https://github.com/naturalstupid/PyJHora/blob/main/src/jhora/ui/chakra.py'
def build_kota_external_report(*, stars, birth_star, birth_star_basis, ayanamsa, timeout=30):
"""stars are computed 1..27 indices; birth-star basis must be explicit."""
if not isinstance(stars, dict) or set(stars) != set(PLANETS):
raise ValueError('all nine planetary star indices required')
if any(type(v) is not int or not 1 <= v <= 27 for v in stars.values()):
raise ValueError('planetary stars must be integers 1..27')
if birth_star_basis not in ('nakshatra_27', 'abhijit_ring_28'):
raise ValueError('explicit birth_star_basis required')
bound = 27 if birth_star_basis == 'nakshatra_27' else 28
if type(birth_star) is not int or not 1 <= birth_star <= bound:
raise ValueError('birth_star outside selected basis')
if not isinstance(ayanamsa, str) or not ayanamsa.strip():
raise ValueError('explicit ayanamsa required')
evidence = dict(technique='kota_chakra', status='blocked', source_url=SOURCE,
variant_profile_id='kota_pyjhora_constants_observation_v1',
birth_star=birth_star, birth_star_basis=birth_star_basis, ayanamsa=ayanamsa,
claim_boundary='External structural layout only; no Kota lord, Paala, Vedha, transit direction or event inference.')
code = ('import json; from jhora import const; from importlib.metadata import version; '
'print(json.dumps(dict(order=const.abhijit_order_of_stars, '
'placements=const.kota_chakra_star_placement_from_birth_star, version=version("PyJHora"))))')
try:
run = subprocess.run([sys.executable, '-c', code], capture_output=True, text=True,
timeout=timeout, check=True)
raw = json.loads(run.stdout)
order, placements = raw['order'], raw['placements']
if sorted(order) != list(range(28)) or list(map(len, placements)) != [8, 8, 8, 4]:
raise ValueError('unexpected upstream grid')
if sorted(v for ring in placements for v in ring) != list(range(1, 29)):
raise ValueError('upstream grid is not a partition')
base = order.index(birth_star - 1) + 1 if birth_star_basis == 'nakshatra_27' else birth_star
rows = []
for ring_index, ring in enumerate(placements):
for position, offset in enumerate(ring):
absolute = (base + offset - 2) % 28
original = order[absolute]
rows.append(dict(ring_index=ring_index, position_index=position,
offset_from_birth=offset - 1, ring_star_index=absolute + 1,
nakshatra_index=original + 1 if original < 27 else None,
is_abhijit=original == 27,
planets=[p for p in PLANETS if stars[p] - 1 == original]))
evidence.update(status='external_observation_only', rows=rows, effective_base_ring_index=base,
pyjhora_version=raw['version'], raw_layout_constants=raw)
except (OSError, subprocess.SubprocessError, ValueError, KeyError, TypeError) as exc:
evidence['reason'] = 'external_kota_layout_unavailable:' + type(exc).__name__
lines = ['# Kota Chakra — external layout', '', evidence['claim_boundary']]
if 'rows' in evidence:
lines += ['', '| Ring (0=outer) | Position | 28-star index | Planets |', '| --- | --- | --- | --- |']
lines += [f'| {r["ring_index"]} | {r["position_index"]} | {r["ring_star_index"]} | {", ".join(r["planets"])} |' for r in evidence['rows']]
else:
lines += ['', evidence['reason']]
return dict(status=evidence['status'], customer_export_admitted=False, evidence_appendix=[evidence],
exports=dict(ai_evidence_bundle=deepcopy(evidence), markdown='\n'.join(lines)))