Files
astrololo/services/logic/tests/test_points.py
gitea a8c3072e62 Węzły księżycowe, mean Lilith i wykrywanie stacji (LOG-02/03)
Punkty wirtualne (LOG-02):
- engine/points.py: mean Node (Ω) i mean Lilith (apogeum) wzorami Meeusa;
  prędkości numerycznie. SN = NN + 180° (ta sama prędkość), zawsze Rx.
- DEFAULT_OBJECTS + North Node / South Node / Lilith — automatycznie dostają
  domy, aspekty i A/S. Parzystość silnika B: swe.MEAN_NODE / swe.MEAN_APOG
  (uwaga: stała pyswisseph to MEAN_APOG, nie MEAN_APOGEE).
- significators: tokeny [NN / [SN / [Lilith (zgodne z SIGNIFICATORS KEY).

Stacje (LOG-03):
- engine/stations.py: skan prędkości (krok 4 dni, okno ±800 dni — pokrywa
  najdłuższe przerwy Marsa/Wenus) + bisekcja; klasyfikacja SD/SR; poprzednia/
  następna stacja (dni, data, stopień w znaku) + flaga station_soon (<7 dni).
- /chart/positions: opt-in stations:true; UI: checkbox + tabela stacji.

Walidacja:
- mean NN vs astro-seek (Gem 8°09'24"): Δ=0,3'; vs swisseph: Δ=17";
  mean Lilith vs swisseph: Δ=1,5'. NN dom 12 / SN dom 6 zgodnie z astro-seek.
- Stacje Marsa 1984 trafiają w historię: SR 5.04.1984, SD 19.06.1984;
  samospójność |speed|<0,01°/d w znalezionych momentach; flaga "blisko"
  działa (Merkury +5,3d, Jowisz -0,6d).
- E2E na realnej bazie: [SN 134 rekordy, trafienie w 6. domu. 54 testy przechodzą.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-08 10:51:29 +02:00

51 lines
1.8 KiB
Python

"""Testy punktów wirtualnych (LOG-02): mean Node, mean Lilith.
Referencje dla 30.04.1984 07:35 UT:
- astro-seek (notes3): North Node (M) = Gem 8°09'24" = 68.1567°
- wyrocznia swisseph (MEAN_NODE / MEAN_APOG, tryb Moshiera):
NN = 68.1569°, Lilith = 345.6840°
"""
import pytest
from app.engine.formats import norm360
def _delta_arcmin(a: float, b: float) -> float:
return abs(((a - b + 180.0) % 360.0) - 180.0) * 60.0
@pytest.fixture(scope="module")
def by_name(own_engine, reference_moment):
return {p.name: p for p in own_engine.positions(reference_moment)}
def test_mean_node_matches_references(by_name):
nn = by_name["North Node"]
assert _delta_arcmin(nn.longitude, 68.1567) < 2.0 # astro-seek
assert _delta_arcmin(nn.longitude, 68.1569) < 2.0 # swisseph
assert nn.sign == "Gemini"
def test_nodes_always_retrograde_and_opposed(by_name):
nn, sn = by_name["North Node"], by_name["South Node"]
assert nn.retrograde and sn.retrograde # mean node zawsze Rx
assert _delta_arcmin(sn.longitude, norm360(nn.longitude + 180.0)) < 0.01
assert abs(nn.speed - sn.speed) < 1e-9 # ta sama prędkość
def test_mean_lilith_matches_swisseph(by_name):
li = by_name["Lilith"]
assert _delta_arcmin(li.longitude, 345.6840) < 3.0 # wyrocznia swisseph
assert li.sign == "Pisces"
assert li.speed > 0 and not li.retrograde # mean Lilith zawsze direct
def test_points_join_houses_and_chart(own_engine, reference_moment):
from app.engine.chart import build_chart
chart = build_chart(own_engine, reference_moment)
by = {p["name"]: p for p in chart["positions"]}
# NN w Gem -> 12. dom Whole Sign (Asc w Raku); zgodnie z tabelą astro-seek w notes3
assert by["North Node"]["house"] == 12
assert by["Lilith"]["house"] == 9 # Pis -> 9. dom