-
Notifications
You must be signed in to change notification settings - Fork 11
/
ephemcalc.py
executable file
·55 lines (40 loc) · 1.35 KB
/
ephemcalc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import astrology
import chart
import planets
import util
class EphemCalc:
PLANET = 0
DAY = 1
# HOUR = 2
def __init__(self, year, opts):
self.year = year
self.flags = astrology.SEFLG_SPEED+astrology.SEFLG_SWIEPH
self.posArr = []
self.calc(opts)
def calc(self, opts):
ayanamsha = 0.0
if opts.ayanamsha != 0:
swisseph.set_sid_mode(opts.ayanamsha-1, 0, 0)
tim = chart.event.DateTime(self.year, 1, 1, 0, 0, 0, False, chart.event.DateTime.GREGORIAN, chart.event.DateTime.GREENWICH, True, 0, 0, False, None, False)
ayanamsha = swisseph.get_ayanamsa_ut(tim.jd)
plsnum = 7
if opts.transcendental[chart.Chart.TRANSURANUS]:
plsnum += 1
if opts.transcendental[chart.Chart.TRANSNEPTUNE]:
plsnum += 1
if opts.transcendental[chart.Chart.TRANSPLUTO]:
plsnum += 1
#calculating one per day (per hour would be too slow)
for i in range(plsnum):
if i != 1:#moon excepted
y = self.year; m = 1; d = 1
ar = []
for num in range(365):
time = chart.event.DateTime(y, m, d, 0, 0, 0, False, chart.event.DateTime.GREGORIAN, chart.event.DateTime.GREENWICH, True, 0, 0, False, None, False)
pl = planets.Planet(time.jd, i, self.flags)
pos = pl.data[planets.Planet.LONG]
if opts.ayanamsha != 0:
pos = util.normalize(pos-ayanamsha)
ar.append(pos)
y, m, d = util.incrDay(y, m, d)
self.posArr.append(ar)