Skip to content

Refactor Enochian astrology into modular engine with dynamic guardians, personalized Sigillum, and data-driven mappings#520

Merged
kentang2017 merged 2 commits into
mainfrom
copilot/create-enochian-astrology-module
Jun 5, 2026
Merged

Refactor Enochian astrology into modular engine with dynamic guardians, personalized Sigillum, and data-driven mappings#520
kentang2017 merged 2 commits into
mainfrom
copilot/create-enochian-astrology-module

Conversation

Copilot AI commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

This PR turns astro/enochian from a mostly static implementation into a modular, data-driven Enochian system that produces personalized outputs from natal chart dynamics (Ascendant, chart ruler, strongest planet) rather than fixed angel assignments. It also formalizes Sigillum/Watchtower/Aethyr mappings and aligns computation with existing Western chart infrastructure.

  • Modular architecture

    • Introduced dedicated modules:
      • astro/enochian/enochian.py (core computation)
      • astro/enochian/visualization.py (SVG renderers)
      • astro/enochian/interpretations.py (bilingual narrative builders)
      • astro/enochian/data/* (JSON mapping/rule tables + cached loaders)
    • Kept backward compatibility by converting:
      • astro/enochian/calculator.py -> re-export wrapper
      • astro/enochian/renderer.py -> re-export wrapper
    • Updated package exports in astro/enochian/__init__.py.
  • Dynamic guardian angel model

    • Expanded guardian derivation beyond Sun/Moon to include:
      • Ascendant angel
      • Chart ruler angel
      • Strongest-planet angel
    • Added richer card payloads in chart output:
      • chart_ruler_angel, strongest_planet_angel, guardian_angel_cards
    • Added role-aware angel metadata for downstream UI rendering.
  • Personalized Sigillum Dei Aemeth

    • Added rule-driven Sigillum generation using:
      • Heptagram node definitions (sigillum_rules.json)
      • Activation logic from major chart roles (angels.json)
    • Added structured Sigillum output:
      • sigillum_nodes
      • sigillum_active_angels
      • sigillum_personal_number
    • Included activation support for angel sets like TZADKIEL / TZAPHKIEL.
  • Watchtower + Aethyr integration

    • Moved weighting knobs into data (watchtower_aethyr_rules.json) to support tuning without code edits.
    • Preserved existing Watchtower/Aethyr scoring flow while enabling role-aware prioritization and extensibility for deeper 30-Aethyr interpretations.
  • Western chart reuse + bilingual output

    • compute_enochian_chart now reuses compute_western_chart results directly (planets/houses/angles) instead of duplicating Swiss Ephemeris work.
    • Centralized bilingual synthesis in interpretations.py:
      • spiritual path
      • magical purpose
      • invocation (invocation_en, invocation_zh)
  • Visualization upgrades

    • Added render_element_balance_svg and integrated it into the Streamlit Enochian tab.
    • Updated UI to display the expanded guardian angel set (including chart ruler + strongest planet).
from astro.enochian import compute_enochian_chart

chart = compute_enochian_chart(1990, 6, 15, 14, 30, 8.0, 25.033, 121.565, "Taipei")

print(chart.chart_ruler_angel.name)        # dynamic (from western chart ruler)
print(chart.strongest_planet_angel.name)   # dynamic (scored from natal strength)
print(chart.sigillum_active_angels)        # personalized activation set
print([(n.node_index, n.planet, n.angel, n.is_activated) for n in chart.sigillum_nodes])

@kentang2017
kentang2017 marked this pull request as ready for review June 5, 2026 16:22
Copilot AI review requested due to automatic review settings June 5, 2026 16:22
@kentang2017
kentang2017 merged commit ad25a53 into main Jun 5, 2026
1 check failed
Copilot stopped work on behalf of kentang2017 due to an error June 5, 2026 16:22
Copilot AI requested a review from kentang2017 June 5, 2026 16:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors astro/enochian into a more modular, data-driven Enochian Astrology subsystem: a standalone computation engine (enochian.py), SVG visualization utilities (visualization.py), interpretation builders (interpretations.py), and JSON-backed rule tables with cached loaders (data/). It also updates the Streamlit tab to surface the expanded guardian angel model and a new elemental-balance SVG.

Changes:

  • Introduces a new compute_enochian_chart() engine that reuses compute_western_chart() outputs and adds dynamic guardian roles (ASC / chart ruler / strongest planet) plus personalized Sigillum data.
  • Adds new SVG renderers (including render_element_balance_svg) and wires them into the Enochian Streamlit UI.
  • Moves rule/config surfaces into JSON data files and keeps backward compatibility via thin re-export wrappers (calculator.py, renderer.py).

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
ui/handlers/tab_enochian/render.py Updates Enochian Streamlit UI to show additional guardian cards and elemental-balance SVG rendering.
astro/enochian/visualization.py New consolidated SVG rendering module for Sigillum/Watchtower/Aethyr/summary/element-balance visuals.
astro/enochian/renderer.py Backward-compatible re-export wrapper pointing to visualization.py.
astro/enochian/interpretations.py New helpers to generate bilingual spiritual path / magical purpose / invocation text.
astro/enochian/enochian.py New main computation engine with dynamic guardians, Sigillum nodes/activation, and Western chart reuse.
astro/enochian/data/watchtower_aethyr_rules.json Introduces tunable weights intended to influence scoring behavior.
astro/enochian/data/sigillum_rules.json Defines heptagram node mapping and activation-window settings for personalized Sigillum logic.
astro/enochian/data/angels.json Adds angel tables and invocation templates used by the engine.
astro/enochian/data/init.py Adds cached JSON loaders with clear runtime errors for missing/invalid data files.
astro/enochian/calculator.py Backward-compatible re-export wrapper pointing to enochian.py.
astro/enochian/init.py Updates package exports to point to the new engine/visualization/data loader APIs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +696 to +698
# 天使:優先用行星對應,其次用星座對應
angel_name = planet_data.get("angel", sign_data.get("angel", "RAPHAEL"))
angel_zh = planet_data.get("angel_zh", sign_data.get("angel_zh", "拉斐爾"))
Comment on lines +640 to +666
計算完整的 Enochian 占星命盤。

此函式為純函式(pure function),無任何 Streamlit 依賴,
可安全用於 API 端點和測試。

Args:
year, month, day: 出生年月日
hour, minute: 出生時間(24小時制)
timezone: 時區偏移(UTC+N,如台灣為 8.0)
latitude, longitude: 出生地緯度、經度
location_name: 地點名稱(可選)

Returns:
EnochianChart: 完整的 Enochian 分析結果
"""
# 1-3. 重用西方命盤計算(共享 pyswisseph 結果)
western_chart = compute_western_chart(
year=year,
month=month,
day=day,
hour=hour,
minute=minute,
timezone=timezone,
latitude=latitude,
longitude=longitude,
location_name=location_name,
)
Comment on lines +550 to +555
def _compute_strongest_planet(western_chart: WesternChart) -> str:
"""Score planets by angularity, luminary priority, dignity, and retrograde state."""
rules = load_watchtower_aethyr_rules().get("watchtower_weights", {})
angular_bonus = float(rules.get("angular_house_bonus", 0.4))
luminary_bonus = float(rules.get("luminary_bonus", 0.3))
scores: Dict[str, float] = {}
Comment on lines +17 to +27
import math
from typing import Dict, List, Optional

from .calculator import EnochianChart, EnochianPlanetPoint
from .constants import (
AETHYRS,
WATCHTOWERS,
SIGILLUM_DEI_AEMETH,
ELEMENT_TABLE,
ENOCHIAN_PLANETS,
)
Comment on lines +134 to +141
# 七芒星連線(每個頂點連接隔2個)
hept_path_pts = []
for i in range(7):
hept_path_pts.append(hept_points[i])
hept_path_pts.append(hept_points[(i * 2) % 7])
# 繪製七芒星各邊
star_path = " ".join(f"{p[0]:.1f},{p[1]:.1f}" for p in hept_points)
# 重新繪製為兩個交錯三角形
Comment on lines +3 to +7
{"index": 1, "planet": "Saturn", "default_angel": "ZAPHKIEL"},
{"index": 2, "planet": "Jupiter", "default_angel": "TZADKIEL"},
{"index": 3, "planet": "Mars", "default_angel": "CAMAEL"},
{"index": 4, "planet": "Sun", "default_angel": "MICHAEL"},
{"index": 5, "planet": "Venus", "default_angel": "HANAEL"},
"Sun": {"angel": "MICHAEL", "angel_zh": "米迦勒"},
"Moon": {"angel": "GABRIEL", "angel_zh": "加百列"},
"Mercury": {"angel": "RAPHAEL", "angel_zh": "拉斐爾"},
"Venus": {"angel": "HANAEL", "angel_zh": "哈納爾"},
Comment on lines +469 to +471
st.markdown("---")
st.markdown("**Elemental Balance SVG**")
st.components.v1.html(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants