fix(darakaraka): sort with the existing Jaimini tables (BUG-1478, upstream 45b3b66b)
Calls calc_chara_karaka_7 and calc_chara_karaka_8. jaimini.py is not edited. Co-Authored-By: Grok (agent loop)
This commit is contained in:
co-authored by
Grok (agent loop)
parent
96312893b7
commit
7bede9c99a
@@ -10,6 +10,13 @@ Jaimini系统核心:配偶征象星的多维度深度分析
|
||||
|
||||
from typing import Dict, List, Optional, Tuple
|
||||
from dataclasses import dataclass, field
|
||||
if __package__:
|
||||
from .jaimini import calc_chara_karaka_7, calc_chara_karaka_8
|
||||
else:
|
||||
try:
|
||||
from jaimini import calc_chara_karaka_7, calc_chara_karaka_8
|
||||
except ImportError:
|
||||
from scripts.jaimini import calc_chara_karaka_7, calc_chara_karaka_8
|
||||
|
||||
|
||||
# DK行星特质库
|
||||
@@ -248,31 +255,24 @@ class DarakarakaReader:
|
||||
"""计算Darakaraka行星"""
|
||||
planets = chart_data.get("planets", {})
|
||||
|
||||
# 提取各行星星座内度数
|
||||
# Share the seven/eight-planet ranking with the main Jaimini table.
|
||||
# Rahu's reversed degree and Ketu's exclusion live in those functions.
|
||||
planet_degs = {}
|
||||
for pname, pdata in planets.items():
|
||||
if isinstance(pdata, dict) and "degree" in pdata:
|
||||
deg_in_sign = pdata.get("degree_in_sign", pdata["degree"] % 30)
|
||||
|
||||
# Rahu逆行校正(8星系统)
|
||||
if pname == "Rahu" and use_8_karaka:
|
||||
deg_in_sign = 30.0 - deg_in_sign
|
||||
|
||||
planet_degs[pname] = deg_in_sign
|
||||
|
||||
# 排序(降序)
|
||||
sorted_planets = sorted(planet_degs.items(), key=lambda x: x[1], reverse=True)
|
||||
|
||||
if not sorted_planets:
|
||||
if isinstance(pdata, dict):
|
||||
if "degree_raw" in pdata:
|
||||
planet_degs[pname] = pdata["degree_raw"] % 30
|
||||
elif "degree_in_sign" in pdata:
|
||||
planet_degs[pname] = pdata["degree_in_sign"]
|
||||
elif "degree" in pdata:
|
||||
planet_degs[pname] = pdata["degree"] % 30
|
||||
if not planet_degs:
|
||||
return "Unknown", {}
|
||||
|
||||
if use_8_karaka and len(sorted_planets) >= 8:
|
||||
# 8星系统:第7高(第8颗被排除)
|
||||
dk = sorted_planets[6][0] # 索引6 = 第7高
|
||||
if use_8_karaka:
|
||||
table = calc_chara_karaka_8(planet_degs).get("karaka_table_8", {})
|
||||
else:
|
||||
# 7星系统:最低的
|
||||
dk = sorted_planets[-1][0]
|
||||
|
||||
table = calc_chara_karaka_7(planet_degs).get("karaka_table", {})
|
||||
dk = table.get("Darakaraka", {}).get("planet", "Unknown")
|
||||
return dk, planets.get(dk, {})
|
||||
|
||||
def _fill_planet_traits(self, analysis: DKAnalysis):
|
||||
|
||||
Reference in New Issue
Block a user