-
Notifications
You must be signed in to change notification settings - Fork 11
/
secmotion.py
executable file
·49 lines (39 loc) · 1.45 KB
/
secmotion.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
import math
import astrology
import chart#Time
import planets
import util
class SecMotion:
"""Calculates the secondary motions of a planet for PDs(arc)"""
ST2UTCONV = 0.997269566
def __init__(self, rtime, rplace, pId, arc, lat, ascmc2, topo):
direct = True
if arc < 0.0:
arc *= -1
direct = False
if arc > 180.0:
arc = 360.0-arc
direct = not direct
if not direct and arc > 0.0:
arc *= -1
flag = astrology.SEFLG_SWIEPH+astrology.SEFLG_SPEED
if topo:
flag += astrology.SEFLG_TOPOCTR
#calc new time
rate = arc/15.0
ut = rate*SecMotion.ST2UTCONV
newtime = rtime.time+ut
year, month, day = rtime.year, rtime.month, rtime.day
#check overflow
if newtime >= chart.Time.HOURSPERDAY:
newtime -= chart.Time.HOURSPERDAY
year, month, day = util.incrDay(year, month, day)
elif newtime < 0.0:
newtime += chart.Time.HOURSPERDAY
year, month, day = util.decrDay(year, month, day)
calflag = astrology.SE_GREG_CAL
if rtime.cal == chart.Time.JULIAN:
calflag = astrology.SE_JUL_CAL
tjd_ut = swisseph.julday(year, month, day, newtime, calflag)
#self.planet contains the new position of the planet(it proceeded on its way during the PD(arc))
self.planet = planets.Planet(tjd_ut, pId, flag, lat, ascmc2)