-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathantiscia.py
executable file
·178 lines (137 loc) · 6.86 KB
/
antiscia.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
import astrology
import fortune
import houses
import math
import planets
import swisseph
import util
class Antiscion:
'''Antiscion of a planet, LoF or AscMC'''
ANTISCION = 0
CONTRAANT = 1
DODECATEMORIA = 2
#Ids of planets are from module astrology
#Ids
LOF = astrology.SE_TRUE_NODE+1
ASC = LOF+1
MC = ASC+1
def __init__(self, typ, Id, lon, lat, ra, decl):
self.typ = typ
self.Id = Id
self.lon = lon
self.lat = lat
self.ra = ra
self.decl = decl
class Antiscia:
'''Computes antiscia of the bodies(planets, LoF, Asc and MC)'''
CANCER0 = 90.0
CAPRICORN0 = 270.0
def __init__(self, pls, ascmc, lof, obl, ayanopt, ayan):
self.obl = obl
self.plantiscia = []
self.plcontraant = []
self.pldodecatemoria = []
self.lofant = None
self.lofcontraant = None
self.lofdodec = None
self.ascmcant = []
self.ascmccontraant = []
self.ascmcdodec = []
self.ayanopt = ayanopt
self.ayan = ayan
plcants = []
for i in range(planets.Planets.PLANETS_NUM):
ant, cant = self.calc(pls[i].data[planets.Planet.LONG])
dodec = self.calcDodecatemoria(pls[i].data[planets.Planet.LONG])
lat = pls[i].data[planets.Planet.LAT]
plcants.append((cant, lat))
#self.pldodecatemoria.append((dodec, lat))
# raant, declant = util.getRaDecl(ant, lat, self.obl)
raant, declant, dist = swisseph.cotrans(ant, lat, 1.0, -obl)
self.plantiscia.append(Antiscion(Antiscion.ANTISCION, i, ant, lat, raant, declant))
self.pldodecatemoria.append(Antiscion(Antiscion.DODECATEMORIA, i, dodec, lat, raant, declant))
for i in range(planets.Planets.PLANETS_NUM):
# raant, declant = util.getRaDecl(plcants[i][0], plcants[i][1], self.obl)
raant, declant, dist = swisseph.cotrans(plcants[i][0], plcants[i][1], 1.0, -obl)
self.plcontraant.append(Antiscion(Antiscion.CONTRAANT, i, plcants[i][0], plcants[i][1], raant, declant))
ant, cant = self.calc(lof[fortune.Fortune.LON])
dodec = self.calcDodecatemoria(lof[fortune.Fortune.LON])
# lat = lof[fortune.Fortune.LAT] #=0.0
raant, declant, dist = swisseph.cotrans(ant, 0.0, 1.0, -self.obl)
self.lofant = Antiscion(Antiscion.ANTISCION, Antiscion.LOF, ant, 0.0, raant, declant)
raant, declant, dist = swisseph.cotrans(cant, 0.0, 1.0, -self.obl)
self.lofcontraant = Antiscion(Antiscion.CONTRAANT, Antiscion.LOF, cant, 0.0, raant, declant)
#Afegeixo LOF
raant, declant, dist = swisseph.cotrans(cant, 0.0, 1.0, -self.obl)
self.lofdodec = Antiscion(Antiscion.DODECATEMORIA, Antiscion.LOF, dodec, 0.0, raant, declant)
antasc, cantasc = self.calc(ascmc[houses.Houses.ASC])
raantasc, declantasc, dist = swisseph.cotrans(antasc, 0.0, 1.0, -self.obl)
self.ascmcant.append(Antiscion(Antiscion.ANTISCION, Antiscion.ASC, antasc, 0.0, raantasc, declantasc))
antmc, cantmc = self.calc(ascmc[houses.Houses.MC])
raantmc, declantmc, dist = swisseph.cotrans(antmc, 0.0, 1.0, -self.obl)
self.ascmcant.append(Antiscion(Antiscion.ANTISCION, Antiscion.MC, antmc, 0.0, raantmc, declantmc))
raantasc, declantasc, dist = swisseph.cotrans(cantasc, 0.0, 1.0, -self.obl)
self.ascmccontraant.append(Antiscion(Antiscion.CONTRAANT, Antiscion.ASC, cantasc, 0.0, raantasc, declantasc))
raantmc, declantmc, dist = swisseph.cotrans(cantmc, 0.0, 1.0, -self.obl)
self.ascmccontraant.append(Antiscion(Antiscion.CONTRAANT, Antiscion.MC, cantmc, 0.0, raantmc, declantmc))
dodecasc = self.calcDodecatemoria(ascmc[houses.Houses.ASC])
raantasc, declantasc, dist = swisseph.cotrans(dodecasc, 0.0, 1.0, -self.obl)
self.ascmcdodec.append(Antiscion(Antiscion.DODECATEMORIA, Antiscion.ASC, dodecasc, 0.0, raantasc, declantasc))
dodecmc = self.calcDodecatemoria(ascmc[houses.Houses.MC])
raantmc, declantmc, dist = swisseph.cotrans(antmc, 0.0, 1.0, -self.obl)
self.ascmcdodec.append(Antiscion(Antiscion.DODECATEMORIA, Antiscion.MC, dodecmc, 0.0, raantmc, declantmc))
# self.printants()
def calc(self, lon):
ant = 0.0
#round because the antiscion was a little bit different
# d,m,s = util.decToDeg(lon)
# lon = float(d)+float(m)/60.0+float(s)/3600.0
if lon == Antiscia.CANCER0 or lon == Antiscia.CAPRICORN0:
ant = lon
elif lon > Antiscia.CANCER0 and lon < Antiscia.CAPRICORN0:
ant = util.normalize(Antiscia.CAPRICORN0+(Antiscia.CAPRICORN0-lon))
elif lon < Antiscia.CANCER0:
ant = util.normalize(Antiscia.CANCER0+(Antiscia.CANCER0-lon))
elif lon > Antiscia.CAPRICORN0:
ant = util.normalize(Antiscia.CAPRICORN0-(lon-Antiscia.CAPRICORN0))
if self.ayanopt != 0:
ant -= self.ayan
ant = util.normalize(ant)
cant = util.normalize(ant+180.0)
return ant, cant
def calcDodecatemoria(self, lon):
if self.ayanopt != 0:
lon -= self.ayan
lon = util.normalize(lon)
return self.KeepInZodiac(30*self.getSign(lon) + 12*self.getRelativeLon(lon))
def KeepBetweenLimit(self, lon, lim):
""" Keep the longitude between 0..lim """
""" lon must be positive """
return lon - math.floor(lon / lim) * lim
def KeepInZodiac(self, lon):
""" Keep the longitude between 0..360 """
return self.KeepBetweenLimit(lon, 360)
def getRelativeLon(self, lon):
""" Returns the longitude relative to the zodiac """
""" Ex. lon = 36 will return 6 (Taurus 6)"""
return self.KeepBetweenLimit(lon, 30)
def getSign(self, lon):
""" Returns the sign: 0 - Aries, 1 - Taurus, 2 - Gemini..."""
""" lon must be positive """
return lon // 30
def printants(self):
plstxt = ('Sun', 'Moon', 'Mercury', 'Venus', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune', 'Pluto', 'AscNode', 'DescNode')
anttxt = ('Antiscia', 'Contraantiscia')
print('')
print('Antiscia')
i = 0
for ant in self.antiscia:
if i < planets.Planets.PLANETS_NUM*2:
print('%s %s %f %f %f %f' % (anttxt[ant.typ], plstxt[ant.Id], ant.lon, ant.lat, ant.ra, ant.decl))
elif i == Antiscia.LOFANT or i == Antiscia.LOFCANT:
print('%s %s %f %f %f %f' % (anttxt[ant.typ], 'LoF', ant.lon, ant.lat, ant.ra, ant.decl))
elif i == Antiscia.ASCANT or i == Antiscia.ASCCANT:
print('%s %s %f %f %f %f' % (anttxt[ant.typ], 'Asc', ant.lon, ant.lat, ant.ra, ant.decl))
elif i == Antiscia.MCANT or i == Antiscia.MCCANT:
print('%s %s %f %f %f %f' % (anttxt[ant.typ], 'MC', ant.lon, ant.lat, ant.ra, ant.decl))
i += 1