flatangle / flatlib

Python library for Traditional Astrology
MIT License
289 stars 105 forks source link

No support for decanes #85

Closed milanpredic closed 10 months ago

milanpredic commented 11 months ago

Here are some helpful functions to calculate decanes based on Chaldean order. Maybe you could merge it into code.

Cheers

from flatlib import const

# Decane rulers based on the Chaldean order
DECANE_RULERS = [
    # Aries
    const.MARS, const.SUN, const.VENUS,
    # Taurus
    const.VENUS, const.MERCURY, const.MOON,
    # Gemini
    const.MERCURY, const.MOON, const.SATURN,
    # Cancer
    const.MOON, const.SATURN, const.JUPITER,
    # Leo
    const.SUN, const.VENUS, const.MERCURY,
    # Virgo
    const.MERCURY, const.MOON, const.SATURN,
    # Libra
    const.VENUS, const.MERCURY, const.MOON,
    # Scorpio
    const.MARS, const.SUN, const.VENUS,
    # Sagittarius
    const.JUPITER, const.MARS, const.SUN,
    # Capricorn
    const.SATURN, const.JUPITER, const.MARS,
    # Aquarius
    const.SATURN, const.JUPITER, const.MARS,
    # Pisces
    const.JUPITER, const.MARS, const.SUN
]

# === Private functions === #

def getDecaneNumber(object):
    return int(object.signlon / 10)

def getDecaneRuler(object):
    decaneNumber = getDecaneNumber(object)
    decaneIndex = (const.LIST_SIGNS.index(object.sign) * 3) + decaneNumber
    return DECANE_RULERS[decaneIndex]

def getChartDecaneInfo(chart):
    results = {}
    for obj in chart.objects:
        results[obj.id] = getObjectDecaneInfo(obj)
    return results

def getObjectDecaneInfo(obj):
    return {
        'number': getDecaneNumber(obj),
        'ruler': getDecaneRuler(obj),
    }
joaoventura commented 10 months ago

Hi @milanpredic, I have lots of functions and tables regarding essential dignities (decane rules included) at https://github.com/flatangle/flatlib/tree/master/flatlib/dignities. You can find everything in those files..