Issue #94 T1. Place goel_jaimini_strength, trikona_raman, sthira_brahma_goel_short_method, and trikona_dasha from upstream 5fb8379c under scripts/. The only local edit is the SOURCE book citation. Raise ROOT_PY_BUDGET from 448 to 452. Co-Authored-By: Grok (agent loop) Co-authored-by: Cursor <cursoragent@cursor.com>
113 lines
4.5 KiB
Python
113 lines
4.5 KiB
Python
"""Source-bounded Brahma selector for the Goel/Rao short-method profile.
|
|
|
|
This is intentionally explicit-input only. It implements the short method
|
|
described in the local Jaimini transcriptions: choose the stronger of Lagna
|
|
and the seventh sign, inspect the 6th/8th/12th lords from that anchor, exclude
|
|
Saturn, then rank the remaining candidates by declared strength and degree.
|
|
It does not implement the separate odd/back-rising or BPHS override clauses.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
|
|
SIGNS = (
|
|
"Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo",
|
|
"Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces",
|
|
)
|
|
SIGN_LORDS = {
|
|
0: "Mars", 1: "Venus", 2: "Mercury", 3: "Moon",
|
|
4: "Sun", 5: "Mercury", 6: "Venus", 7: "Mars",
|
|
8: "Jupiter", 9: "Saturn", 10: "Saturn", 11: "Jupiter",
|
|
}
|
|
PROFILE_ID = "goel_rao_short_brahma_method_v1"
|
|
|
|
|
|
def _candidate(
|
|
*,
|
|
house: int,
|
|
anchor_sign_index: int,
|
|
planets: dict[str, dict[str, Any]],
|
|
strengths: dict[str, float],
|
|
) -> dict[str, Any]:
|
|
sign_index = (anchor_sign_index + house - 1) % 12
|
|
lord = SIGN_LORDS[sign_index]
|
|
planet = planets.get(lord) if isinstance(planets.get(lord), dict) else {}
|
|
degree = planet.get("degree_in_sign", planet.get("degree"))
|
|
return {
|
|
"source_house": house,
|
|
"source_sign_index": sign_index,
|
|
"source_sign": SIGNS[sign_index],
|
|
"planet": lord,
|
|
"planet_sign_index": planet.get("sign_index", planet.get("sign_idx")),
|
|
"planet_sign": planet.get("sign"),
|
|
"degree_in_sign": float(degree) if isinstance(degree, (int, float)) else None,
|
|
"declared_strength": strengths.get(lord),
|
|
"saturn_excluded": lord == "Saturn",
|
|
}
|
|
|
|
|
|
def select_brahma_goel_short_method(
|
|
*,
|
|
lagna_sign_index: int,
|
|
planets: dict[str, dict[str, Any]],
|
|
planet_strengths: dict[str, float],
|
|
lagna_strength: float,
|
|
seventh_strength: float,
|
|
) -> dict[str, Any]:
|
|
"""Select Brahma under the explicit Goel/Rao short-method profile."""
|
|
if not 0 <= int(lagna_sign_index) < 12:
|
|
return {"status": "blocked", "reason": "lagna_sign_index must be 0..11", "candidates": []}
|
|
if not isinstance(planets, dict) or not isinstance(planet_strengths, dict):
|
|
return {"status": "blocked", "reason": "planets and planet_strengths are required", "candidates": []}
|
|
if not isinstance(lagna_strength, (int, float)) or not isinstance(seventh_strength, (int, float)):
|
|
return {"status": "blocked", "reason": "lagna_strength and seventh_strength are required", "candidates": []}
|
|
|
|
anchor = int(lagna_sign_index) if float(lagna_strength) >= float(seventh_strength) else (int(lagna_sign_index) + 6) % 12
|
|
candidates = [
|
|
_candidate(house=house, anchor_sign_index=anchor, planets=planets, strengths=planet_strengths)
|
|
for house in (6, 8, 12)
|
|
]
|
|
eligible = [row for row in candidates if not row["saturn_excluded"] and row["declared_strength"] is not None]
|
|
if not eligible:
|
|
return {
|
|
"profile_id": PROFILE_ID,
|
|
"status": "blocked",
|
|
"confidence_status": "parameter_sensitive",
|
|
"reason": "No non-Saturn candidate has a declared strength.",
|
|
"anchor": {"sign_index": anchor, "sign": SIGNS[anchor], "selected_by": "lagna_vs_seventh_strength"},
|
|
"candidates": candidates,
|
|
}
|
|
eligible.sort(
|
|
key=lambda row: (
|
|
float(row["declared_strength"]),
|
|
float(row["degree_in_sign"]) if row["degree_in_sign"] is not None else -1.0,
|
|
),
|
|
reverse=True,
|
|
)
|
|
selected = eligible[0]
|
|
return {
|
|
"profile_id": PROFILE_ID,
|
|
"status": "executed",
|
|
"confidence_status": "parameter_sensitive",
|
|
"verification_status": "source_bounded_explicit_input",
|
|
"anchor": {
|
|
"sign_index": anchor,
|
|
"sign": SIGNS[anchor],
|
|
"selected_by": "stronger_of_lagna_and_seventh",
|
|
"lagna_strength": float(lagna_strength),
|
|
"seventh_strength": float(seventh_strength),
|
|
},
|
|
"candidates": candidates,
|
|
"selected": selected,
|
|
"source_rule": (
|
|
"Goel/Rao short method: strongest of 6th, 8th, and 12th lords from "
|
|
"the stronger Lagna/7th anchor, excluding Saturn."
|
|
),
|
|
"unresolved": [
|
|
"odd_sign_and_back_rising_filter_not_applied",
|
|
"BPHS_verse_172_karaka_and_saturn_node_override_not_applied",
|
|
"strength_source_is_declared_input_not_recomputed_here",
|
|
],
|
|
}
|