fix(bhava): use the named mirrored equal-house strength profile
Upstream a4d4a249. Dig tables, Capricorn's first half, the sputa formula, and the benefic set now match jyotishganit_mirrored_equal_house_v2. Mercury is neutral. The result names that profile and does not call it a classical ruling. BUG-1385. Co-Authored-By: Grok (agent loop) Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Grok (agent loop)
Cursor
parent
e8a7f3ac22
commit
6cbae4ce23
+34
-33
@@ -35,36 +35,34 @@ SIGN_NATURE = {
|
||||
# 宫位力量基于星座性质(BPHS标准,单位Virupas)
|
||||
# 索引0-11对应第1-12宫
|
||||
BHAVA_STRENGTH_FROM_SIGN_NATURE = {
|
||||
'nara': [30, 20, 10, 20, 10, 20, 30, 20, 10, 20, 10, 20],
|
||||
'chatushpada': [30, 20, 10, 20, 10, 20, 30, 20, 10, 20, 10, 20],
|
||||
'jalachara': [20, 30, 10, 30, 10, 30, 20, 30, 10, 30, 10, 30],
|
||||
'keeta': [10, 20, 30, 20, 30, 20, 10, 20, 30, 20, 30, 20],
|
||||
'vanaspati': [20, 10, 20, 10, 20, 30, 20, 10, 20, 10, 20, 30],
|
||||
'nara': [60, 50, 40, 30, 20, 10, 0, 10, 20, 30, 40, 50],
|
||||
'chatushpada': [30, 20, 10, 0, 10, 20, 30, 40, 50, 60, 50, 40],
|
||||
'jalachara': [30, 40, 50, 60, 50, 40, 30, 20, 10, 0, 10, 20],
|
||||
'keeta': [0, 10, 20, 30, 40, 50, 60, 50, 40, 30, 20, 10],
|
||||
}
|
||||
|
||||
# Sputa Drishti值表(基于角距离的连续相位力量)
|
||||
def _get_sputa_drishti(angle_diff: float) -> float:
|
||||
"""基于jxotishganit MIT算法,将精确角距离转换为Sputa Drishti值(0-60)"""
|
||||
ad = angle_diff % 360
|
||||
def _get_sputa_drishti(angle_diff: float, planet: str = 'Sun') -> float:
|
||||
"""jyotishganit 镜像角公式。火、木、土在特殊相位上另有一段。不是本仓方向性 Shadbala。"""
|
||||
ad = abs(angle_diff) % 360
|
||||
if ad > 180:
|
||||
ad = 360 - ad
|
||||
|
||||
if ad <= 1.0: return 60.0
|
||||
if ad <= 3.0: return 57.0
|
||||
if ad <= 7.0: return 51.0
|
||||
if ad <= 10.0: return 45.0
|
||||
if ad <= 15.0: return 40.5
|
||||
if ad <= 20.0: return 30.0
|
||||
if ad <= 25.0: return 22.5
|
||||
if ad <= 30.0: return 15.0
|
||||
if ad <= 40.0: return 12.0
|
||||
if ad <= 50.0: return 9.0
|
||||
if ad <= 60.0: return 6.0
|
||||
if ad <= 75.0: return 4.5
|
||||
if ad <= 90.0: return 3.0
|
||||
if ad <= 120.0: return 2.25
|
||||
if ad <= 150.0: return 1.5
|
||||
return 0.0
|
||||
if ad < 30:
|
||||
strength = 0.0
|
||||
elif ad < 60:
|
||||
strength = (ad - 30) / 2
|
||||
elif ad < 90:
|
||||
strength = ad - 45
|
||||
elif ad < 120:
|
||||
strength = 30 + (120 - ad) / 2
|
||||
elif ad < 150:
|
||||
strength = 150 - ad
|
||||
else:
|
||||
strength = 2 * (ad - 150)
|
||||
for special in {'Mars': (90, 210), 'Jupiter': (120, 240), 'Saturn': (60, 270)}.get(planet, ()):
|
||||
distance = abs(ad - special)
|
||||
if distance <= 15:
|
||||
strength = max(strength, 60 * (1 - distance / 15))
|
||||
return strength
|
||||
|
||||
|
||||
def calc_bhava_adhipathi_bala(house_signs: List[str], planet_shadbala: Dict) -> List[float]:
|
||||
@@ -109,8 +107,8 @@ def calc_bhava_dig_bala(house_signs: List[str], house_degrees: List[float]) -> L
|
||||
|
||||
# 处理双性星座
|
||||
if 'first_half' in nature_key:
|
||||
# Sagittarius前半=nara, Capricorn前半=jalachara
|
||||
real_nature = 'nara' if 'Sagittarius' in nature_key else 'jalachara'
|
||||
# Sagittarius 前半是人象,Capricorn 前半是四足,不是水象。
|
||||
real_nature = 'nara' if 'Sagittarius' in nature_key else 'chatushpada'
|
||||
elif 'second_half' in nature_key:
|
||||
real_nature = 'chatushpada' if 'Sagittarius' in nature_key else 'jalachara'
|
||||
else:
|
||||
@@ -143,7 +141,7 @@ def calc_bhava_drik_bala(house_signs: List[str], house_degrees: List[float],
|
||||
Returns:
|
||||
12个宫位的drik bala值
|
||||
"""
|
||||
BENEFICS = ['Jupiter', 'Venus', 'Mercury']
|
||||
BENEFICS = ['Jupiter', 'Venus', 'Moon']
|
||||
MALEFICS = ['Saturn', 'Mars', 'Sun']
|
||||
|
||||
asc_sign_idx = SIGNS.index(asc_sign) if asc_sign in SIGNS else 0
|
||||
@@ -175,7 +173,7 @@ def calc_bhava_drik_bala(house_signs: List[str], house_degrees: List[float],
|
||||
dist_deg = abs(diff)
|
||||
|
||||
# Sputa Drishti值
|
||||
sputa = _get_sputa_drishti(dist_deg)
|
||||
sputa = _get_sputa_drishti(dist_deg, planet_name)
|
||||
|
||||
if planet_name in BENEFICS:
|
||||
benefic_sputa += sputa
|
||||
@@ -238,8 +236,11 @@ def calc_bhava_bala(house_signs: List[str], house_degrees: List[float],
|
||||
})
|
||||
|
||||
return {
|
||||
'method': 'Bhava Bala三元力量(基于jyotishganit MIT算法)',
|
||||
'version': '1.0',
|
||||
'method': 'jyotishganit_mirrored_equal_house_v2',
|
||||
'version': '2.0',
|
||||
'score_unit': 'Virupas',
|
||||
'method_boundary': '具名实现:镜像相位、吉星固定为月亮木星金星、水星中性、上升等宫中点。不是本仓方向性 Shadbala,也不是经典定论。',
|
||||
'claim_boundary': 'Bhava Bala 只是三分量原始分数,不能单独证明某项人生结果。',
|
||||
'houses': houses,
|
||||
'strongest_house': max(houses, key=lambda h: h['total'])['house'],
|
||||
'weakest_house': min(houses, key=lambda h: h['total'])['house'],
|
||||
@@ -281,7 +282,7 @@ def bhava_bala_from_chart(planets: Dict, asc_sign: str, asc_degree: float, shadb
|
||||
house['lord'] = SIGN_LORDS.get(house['sign'])
|
||||
house['total_rupas'] = round(house['total'] / 60.0, 2)
|
||||
house.pop('level', None)
|
||||
result['method'] = 'Bhava Bala 三分量:Bhavadhipati(宫主 Shadbala)+ Bhava Dig + Bhava Drishti(jyotishganit MIT 算法,等宫)'
|
||||
result['method'] = 'jyotishganit_mirrored_equal_house_v2:宫主 Shadbala + Dig + Drishti。吉星为月亮、木星、金星,水星中性。不是经典定论。'
|
||||
result['unit'] = 'virupa'
|
||||
result['source'] = 'scripts/bhava_bala.py'
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user