Skip to content

Commit ca37f9e

Browse files
committed
Initial support for sidereal zodiac
1 parent 44e05b2 commit ca37f9e

3 files changed

Lines changed: 64 additions & 1 deletion

File tree

flatlib/const.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,17 @@
254254
ALL_ASPECTS = MAJOR_ASPECTS + MINOR_ASPECTS
255255

256256

257+
# === Ayanamsas / Sidereal Zodiac === */
258+
259+
AY_FAGAN_BRADLEY = "Ayanamsa Fagan Bradley"
260+
AY_LAHIRI = "Ayanamsa Lahiri"
261+
AY_DELUCE = "Ayanamsa De Luce"
262+
AY_RAMAN = "Ayanamsa Raman"
263+
AY_KRISHNAMURTI = "Ayanamsa Krishnamurti"
264+
AY_ALDEBARAN_15TAU = "Ayanamsa Aldebaran 15 Taurus"
265+
AY_GALCENTER_5SAG = "Ayanamsa Galactic Eq. 05 Sag"
266+
267+
257268
# === Some Lists === */
258269

259270
LIST_SIGNS = [

flatlib/ephem/swe.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@
5050
const.HOUSES_MORINUS: b'M'
5151
}
5252

53+
# Map ayanamsas
54+
SWE_AYANAMSAS = {
55+
const.AY_FAGAN_BRADLEY: 0,
56+
const.AY_LAHIRI: 1,
57+
const.AY_DELUCE: 2,
58+
const.AY_RAMAN: 3,
59+
const.AY_KRISHNAMURTI: 4,
60+
const.AY_ALDEBARAN_15TAU: 14,
61+
const.AY_GALCENTER_5SAG: 17
62+
}
63+
5364

5465
# ==== Internal functions ==== #
5566

@@ -71,13 +82,15 @@ def sweObject(obj, jd):
7182
'lonspeed': sweList[3],
7283
'latspeed': sweList[4]
7384
}
74-
85+
86+
7587
def sweObjectLon(obj, jd):
7688
""" Returns the longitude of an object. """
7789
sweObj = SWE_OBJECTS[obj]
7890
sweList = swisseph.calc_ut(jd, sweObj)
7991
return sweList[0]
8092

93+
8194
def sweNextTransit(obj, jd, lat, lon, flag):
8295
""" Returns the julian date of the next transit of
8396
an object. The flag should be 'RISE' or 'SET'.
@@ -113,6 +126,7 @@ def sweHouses(jd, lat, lon, hsys):
113126
]
114127
return (houses, angles)
115128

129+
116130
def sweHousesLon(jd, lat, lon, hsys):
117131
""" Returns lists with house and angle longitudes. """
118132
hsys = SWE_HOUSESYS[hsys]
@@ -160,6 +174,7 @@ def solarEclipseGlobal(jd, backward):
160174
'center_line_end': sweList[1][7],
161175
}
162176

177+
163178
def lunarEclipseGlobal(jd, backward):
164179
""" Returns the jd details of previous or next global lunar eclipse. """
165180

@@ -173,3 +188,15 @@ def lunarEclipseGlobal(jd, backward):
173188
'penumbral_begin': sweList[1][6],
174189
'penumbral_end': sweList[1][7],
175190
}
191+
192+
193+
# === Sidereal zodiac === #
194+
195+
def get_ayanamsa(jd, mode):
196+
"""
197+
Returns the distance of the tropical vernal point
198+
from the sidereal zero point of the zodiac.
199+
"""
200+
eph_mode = SWE_AYANAMSAS[mode]
201+
swisseph.set_sid_mode(eph_mode, 0, 0)
202+
return swisseph.get_ayanamsa_ut(jd)

recipes/siderealzodiac.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""
2+
Author: João Ventura <[email protected]>
3+
4+
5+
This recipe shows sample code for creating a chart
6+
with sidereal zodiac
7+
8+
"""
9+
10+
from flatlib import const
11+
from flatlib.chart import Chart
12+
from flatlib.datetime import Datetime
13+
from flatlib.geopos import GeoPos
14+
from flatlib.ephem import swe, eph
15+
16+
# Build a chart for a date and location
17+
date = Datetime('2015/03/13', '17:00', '+00:00')
18+
pos = GeoPos('38n32', '8w54')
19+
chart = Chart(date, pos)
20+
21+
# Update object with the ayanamsa value
22+
asc = chart.get(const.HOUSE10)
23+
new_lon = asc.lon - swe.get_ayanamsa(date.jd, const.AY_LAHIRI)
24+
asc.relocate(new_lon)
25+
print(asc)

0 commit comments

Comments
 (0)