Files
Jyotisha/scripts/functional_layer.py
T
ClaudeandClaude Opus 5.5 17d932a517 fix(rectification): PVR functional default + source-version Narayana, reseal round5_pvr_narayana_2026_11_08 (BUG-1759)
Product approved 2026-11-08 (astrologer round-5 rulings 1, 3; same basis as
the report and the chat card):
- functional roles: drop the bphs_exception_profile pin at the three scoring
  call sites (+ research mirror); default pvr_table_30 with Moon paksha.
- Narayana: narayana_rath.calc_narayana_rath (two cycles) / antardasha, ages
  via narayana_age from the candidate birth moment; probes date from the birth
  moment. A blocked source step makes the layer unavailable, never the old
  algorithm. Blocked count on all three datasets: 0.
- Reseal: sealed 20, offset 900, live v5 231 under the new tag; identical to
  measurement variant (c) trial by trial. float_split / 166d kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
2026-11-08 13:12:03 +08:00

57 lines
2.2 KiB
Python

"""One functional benefic/malefic snapshot for the engine, API, and MCP.
This module is not ``functional_benefics.py``. Every product surface,
rectification scoring included (BUG-1759, product 2026-11-08), takes the
default ``pvr_table_30``; ``bphs_exception_profile`` is a comparison only.
"""
from __future__ import annotations
from typing import Any
def functional_layer_for_ascendant(
ascendant: Any,
planets: Any = None,
*,
functional_profile: str | None = None,
) -> dict[str, Any]:
"""Return the functional layer for an ascendant payload.
A dict uses its ``sign``. Anything else is a missing sign and follows
the normal ``derive_functional_benefic_malefic`` blocked result.
Import or calculation failures return the engine's blocked shape.
The exception text stays inside ``effect_on_confidence`` because that
field already did; callers must not write this dict to a log.
占星师 2026-11-08 第五轮裁定 3: the default profile is PVR Table 30
(``functional_benefics.DEFAULT_FUNCTIONAL_PROFILE``). ``planets`` (Sun and
Moon longitudes) gives the Moon's paksha, which Table 30's note needs for
Aries / Libra / Capricorn lagnas.
"""
try:
try:
import functional_benefics as fb
except ModuleNotFoundError:
from scripts import functional_benefics as fb
sign = ascendant.get("sign") if isinstance(ascendant, dict) else None
return fb.derive_functional_benefic_malefic(
sign,
functional_profile=functional_profile or fb.DEFAULT_FUNCTIONAL_PROFILE,
moon_paksha=fb.moon_paksha_from_planets(planets),
)
except Exception as exc:
sign = ascendant.get("sign") if isinstance(ascendant, dict) else None
return {
"status": "blocked",
"ascendant": sign,
"functional_benefics": [],
"functional_malefics": [],
"functional_neutrals": [],
"yogakarakas": [],
"owned_houses": {},
"effect_on_confidence": f"未完成功能性吉凶星判定,需降低高严谨结论置信度: {exc}",
"source": "strict_functional_benefic_malefic_v2",
}