fix(transit): double-transit aspect check counts houses from 1 (upstream 2dd6062a)
Saturn's 7th aspect was judged on the 8th house, Jupiter 5/9 on 6/10, Mars 4/8 on 5/9. Ported from yinduzhanxing 2dd6062a with product authorization (TASK-upstream-sync4-20261002 T2). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N4f2nya58RoRu4yEmJgRGE
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
a18f8d4e1a
commit
42d1582f4c
@@ -13072,7 +13072,7 @@ def _check_pac(planet_name, planet_lon, target_lon, asc_idx):
|
||||
}
|
||||
aspects = planet_aspects.get(planet_name, [7])
|
||||
for offset in aspects:
|
||||
if ((t_house - p_house + 12) % 12) == offset:
|
||||
if ((t_house - p_house + 12) % 12) + 1 == offset:
|
||||
results.append({'type': 'Aspect', 'offset': offset, 'desc': f'{offset}宫相位'})
|
||||
|
||||
return results
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
"""BUG (sync4 T2): _check_pac counted the house distance from 0 but compared it
|
||||
with 1-based aspect numbers, so Saturn's 7th aspect landed on the 8th house.
|
||||
Ported from upstream yinduzhanxing 2dd6062a."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from scripts.jyotish_engine import _check_pac
|
||||
|
||||
|
||||
def _lon(house: int) -> float:
|
||||
return (house - 1) * 30 + 15.0
|
||||
|
||||
|
||||
def _aspect_offsets(planet: str, target_house: int) -> list[int]:
|
||||
rows = _check_pac(planet, _lon(1), _lon(target_house), 0)
|
||||
return [row["offset"] for row in rows if row["type"] == "Aspect"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("planet,hits", [
|
||||
("Saturn", {3, 7, 10}), ("Jupiter", {5, 7, 9}), ("Mars", {4, 7, 8}), ("Venus", {7}),
|
||||
])
|
||||
def test_aspect_lands_on_the_numbered_house(planet: str, hits: set[int]) -> None:
|
||||
for house in range(2, 13):
|
||||
offsets = _aspect_offsets(planet, house)
|
||||
if house in hits:
|
||||
assert offsets == [house], (planet, house, offsets)
|
||||
else:
|
||||
assert offsets == [], (planet, house, offsets)
|
||||
Reference in New Issue
Block a user