Fix D10 varga benchmark precision
This commit is contained in:
@@ -311,7 +311,9 @@ def compute_chart_data(year, month, day, hour, minute, lat, lon, tz):
|
||||
nak_n, nak_l, _ = NAKSHATRA_LIST[ni % 27]
|
||||
result["planets"][pname] = {
|
||||
"sign": sign, "sign_cn": SIGNS_CN[sign], "degree": round(lon_p, 4),
|
||||
"degree_in_sign": round(d_in_s, 4), "house": house, "status": status,
|
||||
"degree_raw": lon_p,
|
||||
"degree_in_sign": round(d_in_s, 4), "degree_in_sign_raw": d_in_s,
|
||||
"house": house, "status": status,
|
||||
"retrograde": retro, "speed": round(spd, 6),
|
||||
"nakshatra": nak_n, "nakshatra_pada": pada, "nakshatra_lord": nak_l}
|
||||
if pname == 'Rahu':
|
||||
@@ -320,7 +322,8 @@ def compute_chart_data(year, month, day, hour, minute, lat, lon, tz):
|
||||
kn, kl, _ = NAKSHATRA_LIST[kni % 27]
|
||||
result["planets"]["Ketu"] = {
|
||||
"sign": SIGNS[ksi], "sign_cn": SIGNS_CN[SIGNS[ksi]],
|
||||
"degree": round(klon, 4), "degree_in_sign": round(kd, 4),
|
||||
"degree": round(klon, 4), "degree_raw": klon,
|
||||
"degree_in_sign": round(kd, 4), "degree_in_sign_raw": kd,
|
||||
"house": ((ksi - asc_idx) % 12) + 1, "status": "中性",
|
||||
"retrograde": True, "speed": round(spd, 6),
|
||||
"nakshatra": kn, "nakshatra_pada": kp, "nakshatra_lord": kl}
|
||||
@@ -2390,7 +2393,7 @@ def cmd_varga_full(args):
|
||||
except ImportError as e:
|
||||
return {"error": f"varga模块导入失败: {e}"}
|
||||
planets = chart.get('planets', {})
|
||||
planet_lons = {pn: pd['degree'] for pn, pd in planets.items() if isinstance(pd, dict) and 'degree' in pd}
|
||||
planet_lons = {pn: pd.get('degree_raw', pd['degree']) for pn, pd in planets.items() if isinstance(pd, dict) and 'degree' in pd}
|
||||
asc_deg = chart.get('ascendant', {}).get('degree', 0)
|
||||
divisions = [int(d.strip().replace('D','')) for d in args.divisions.split(',')] if args.divisions else None
|
||||
return calc_all_vargas(planet_lons, asc_deg, divisions)
|
||||
@@ -3071,8 +3074,8 @@ def cmd_full_reading(args):
|
||||
planets = chart.get('planets', {})
|
||||
asc_deg = chart.get('ascendant', {}).get('degree', 0)
|
||||
asc_sign = chart.get('ascendant', {}).get('sign', 'Unknown')
|
||||
planet_lons = {pn: pd['degree'] for pn, pd in planets.items() if isinstance(pd, dict) and 'degree' in pd}
|
||||
planet_degs = {pn: pd.get('degree_in_sign', pd['degree'] % 30) for pn, pd in planets.items() if isinstance(pd, dict) and 'degree' in pd}
|
||||
planet_lons = {pn: pd.get('degree_raw', pd['degree']) for pn, pd in planets.items() if isinstance(pd, dict) and 'degree' in pd}
|
||||
planet_degs = {pn: pd.get('degree_in_sign_raw', pd.get('degree_in_sign', pd['degree'] % 30)) for pn, pd in planets.items() if isinstance(pd, dict) and 'degree' in pd}
|
||||
planet_sign_indices = {}
|
||||
for pn, pd in planets.items():
|
||||
if isinstance(pd, dict) and 'sign' in pd:
|
||||
@@ -3122,7 +3125,7 @@ def cmd_full_reading(args):
|
||||
# ── Step 2: Vimshottari Dasha ──
|
||||
try:
|
||||
moon_data = planets.get('Moon', {})
|
||||
moon_lon = moon_data.get('degree', 0)
|
||||
moon_lon = moon_data.get('degree_raw', moon_data.get('degree', 0))
|
||||
nak_idx = int(moon_lon / (360 / 27)) % 27
|
||||
nak_name = NAKSHATRA_LIST[nak_idx][0]
|
||||
nak_lord = NAKSHATRA_LIST[nak_idx][1]
|
||||
|
||||
+7
-7
@@ -57,7 +57,7 @@ def varga_map(si, pi, div):
|
||||
if div==7: return (si+pi)%12 if o else (si+6+pi)%12
|
||||
if div==9:
|
||||
el={0:0,1:9,2:6,3:3}; return (el[si%4]+pi)%12
|
||||
if div==10: return (si+pi)%12 if o else (si+9+pi)%12 # D10: even signs start from 9th (2026-05-03 fix: was +8)
|
||||
if div==10: return (si+pi)%12 if o else (si+8+pi)%12 # D10: even signs count from 9th inclusively => +8 offset
|
||||
if div==12: return (si+pi)%12
|
||||
if div==16: return ((0 if o else 4)+pi)%12 # D16: movable=+0, fixed=+4; dual needs separate (2026-05-03 fix: was +1)
|
||||
if div==20: return ((0 if o else 8)+pi)%12
|
||||
@@ -71,19 +71,19 @@ def varga_map(si, pi, div):
|
||||
|
||||
def calc_varga(lon, div):
|
||||
"""计算行星在指定分盘的位置(星座+精确度数+尊贵状态)"""
|
||||
# 2026-05-03修正:D9 Navamsa使用Harmonic(×9)法而非BPHS映射法
|
||||
# 原因:Harmonic法与主流Jyotish软件(Jagannatha Hora等)结果一致
|
||||
# 且在Einstein等名人案例中与人生事件吻合度更高
|
||||
# BPHS映射法(el={0:0,1:9,2:6,3:3})仍保留在varga_map中作为备选
|
||||
si=_si(lon); d=lon-si*30; ps=30.0/div; pi=int(d/ps)
|
||||
if div == 9:
|
||||
# D9 Navamsa: retain harmonic longitude output to match existing skill/JHora-style readings.
|
||||
nav_lon = (lon * 9) % 360
|
||||
vsi = int(nav_lon / 30) % 12
|
||||
dp = nav_lon - vsi * 30
|
||||
pi = int(dp / (30.0/9)) # approximate pada from harmonic degree
|
||||
pi = int(d / ps)
|
||||
r = {'sign': _sn(vsi), 'sign_idx': vsi, 'degree_in_sign': round(dp, 4),
|
||||
'part_index': pi, 'lord': SIGN_LORDS.get(_sn(vsi), ''), 'pada': pi + 1}
|
||||
return r
|
||||
si=_si(lon); d=lon-si*30; ps=30.0/div; pi=int(d/ps); dp=d-pi*ps
|
||||
# For non-D9 vargas, degree within divisional sign is scaled to 0-30 degrees.
|
||||
# Previous code returned only the within-part remainder (0-part_size), which made D10 degree output non-standard.
|
||||
dp=(d-pi*ps)*div
|
||||
vsi=varga_map(si,pi,div)
|
||||
r={'sign':_sn(vsi),'sign_idx':vsi,'degree_in_sign':round(dp,4),
|
||||
'part_index':pi,'lord':SIGN_LORDS.get(_sn(vsi),'')}
|
||||
|
||||
Reference in New Issue
Block a user