fix(dignity): Rahu/Ketu have no own sign; yoga main path uses fixed Scorpio/Aquarius lords (T5, BUG-1211)

Astrologer ruling 甲12. jyotish_engine._get_dignity_level drops the Rahu-Virgo /
Ketu-Pisces OWN_SIGN clause (fed the D1 status column, Vimsopaka and
varga_dignity); no node exaltation/debilitation added. yoga_engine.YogaContext
resolves Scorpio -> Mars and Aquarius -> Saturn by default (as the lord chain,
functional roles and frontend SIGN_LORDS do); _stronger_co_lord and
RAHU_KETU_OWNED_SIGN_INDEX stay for Jaimini variants (dynamic_co_lords=True) only.
narayana_dasha co-lord rules unchanged. Separate commit so it can be reverted alone;
v5 / reported-offset results in PROGRESS.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N4f2nya58RoRu4yEmJgRGE
This commit is contained in:
Jesse_Chen
2026-10-03 12:47:12 +08:00
co-authored by Claude Opus 5.5
parent 6feb1a4aaa
commit b0329ef03e
3 changed files with 83 additions and 6 deletions
+4 -1
View File
@@ -660,7 +660,10 @@ def _get_dignity_level(planet, sign, deg_in_sign=None, planets_data=None):
if deg_in_sign is not None and mt[1] <= deg_in_sign < mt[2]:
return 'MOOLATRIKONA'
if SIGN_LORDS.get(sign) == planet or (planet == 'Rahu' and sign == 'Virgo') or (planet == 'Ketu' and sign == 'Pisces'):
# BUG-1211 (ruling 甲12): Rahu and Ketu have no traditional own sign. The old
# Rahu-Virgo / Ketu-Pisces "own sign" fed the D1 status column, Vimsopaka and
# varga_dignity; neither Virgo nor Aquarius is shown as Rahu's own sign now.
if SIGN_LORDS.get(sign) == planet:
return 'OWN_SIGN'
if DEBILITATION.get(planet) == sign:
+14 -5
View File
@@ -67,6 +67,7 @@ FIXED_SIGNS = ['Taurus', 'Leo', 'Scorpio', 'Aquarius']
DUAL_SIGNS = ['Gemini', 'Virgo', 'Sagittarius', 'Pisces']
ALL_PLANETS = ['Sun', 'Moon', 'Mars', 'Mercury', 'Jupiter', 'Venus', 'Saturn', 'Rahu', 'Ketu']
PLANET_INDEX = {planet: idx for idx, planet in enumerate(ALL_PLANETS)}
# Jaimini co-lord comparison only (_stronger_co_lord); not a traditional own sign (BUG-1211).
RAHU_KETU_OWNED_SIGN_INDEX = {'Rahu': 10, 'Ketu': 7}
# Planets that form the solar / lunar neighbour yogas (BUG-1187, BUG-1206).
FIVE_TRUE_PLANETS = ('Mars', 'Mercury', 'Jupiter', 'Venus', 'Saturn')
@@ -200,9 +201,11 @@ class YogaContext:
self.panchanga = self.context.get("panchanga", {}) if isinstance(self.context, dict) else {}
self.upagraha = self.context.get("upagraha", {}) if isinstance(self.context, dict) else {}
# 预计算 D1 宫主星。v6.0.39: Scorpio/Aquarius follow PyJHora's dynamic co-lord resolver
# (Scorpio: stronger of Mars/Ketu; Aquarius: stronger of Saturn/Rahu), while SIGN_LORDS stays
# as the classical fixed fallback for dignity tables and non-Jaimini contexts.
# 预计算 D1 宫主星。BUG-1211 (ruling 甲12): the main detection path uses the
# fixed traditional lords (Scorpio -> Mars, Aquarius -> Saturn), as the lord
# chain, functional roles and the frontend do. The v6.0.39 PyJHora "stronger
# co-lord" resolver (_stronger_co_lord) is kept for Jaimini variants only and
# runs only when a caller asks for dynamic_co_lords=True.
self._house_lords: Dict[int, str] = {}
for h in range(1, 13):
sign = SIGNS[(self.asc_idx + h - 1) % 12]
@@ -239,7 +242,13 @@ class YogaContext:
return [SIGNS.index(s) for s in DUAL_SIGNS if SIGNS.index(s) != sign_idx]
def _stronger_co_lord(self, planet1: str, planet2: str) -> str:
"""Approximate PyJHora stronger_planet_from_planet_positions() for Sc/Aq co-lords."""
"""Approximate PyJHora stronger_planet_from_planet_positions() for Sc/Aq co-lords.
Jaimini-variant only (BUG-1211): reached only through
`_resolve_sign_lord(..., dynamic_co_lords=True)`; no main-path caller.
RAHU_KETU_OWNED_SIGN_INDEX is this comparison's internal convention, not a
traditional own sign.
"""
h1 = self._sign_index_of_planet(planet1)
h2 = self._sign_index_of_planet(planet2)
if h1 is None:
@@ -314,7 +323,7 @@ class YogaContext:
return planet1 if degree1 > degree2 else planet2
return planet1
def _resolve_sign_lord(self, sign: str, dynamic_co_lords: bool = True) -> Optional[str]:
def _resolve_sign_lord(self, sign: str, dynamic_co_lords: bool = False) -> Optional[str]:
if not dynamic_co_lords:
return SIGN_LORDS.get(sign)
if sign == 'Scorpio':