-
Notifications
You must be signed in to change notification settings - Fork 10
/
placidiancommonpd.py
executable file
·380 lines (287 loc) · 11.7 KB
/
placidiancommonpd.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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
import math
import astrology
import primdirs
import planets
import chart
import fixstars
import fortune
import syzygy
import secmotion
import customerpd
import util
class PlacidianCommonPD(primdirs.PrimDirs):
'Implements Placidian Common(semiarc, utp) Primary Directions'
def __init__(self, chrt, options, pdrange, direction, abort):
primdirs.PrimDirs.__init__(self, chrt, options, pdrange, direction, abort)
def calc2HouseCusps(self, mundane):
'''Calculates directions of Promissors to intermediate house cusps'''
#aspects of proms to HCs in Zodiacal!?
for i in range(len(self.chart.planets.planets)):
if not self.options.promplanets[i]:
continue
if self.abort.abort:
return
pl = self.chart.planets.planets[i]
rapl = pl.speculums[primdirs.PrimDirs.PLACSPECULUM][planets.Planet.RA]
dsa = pl.speculums[primdirs.PrimDirs.PLACSPECULUM][planets.Planet.SA]
nsa = pl.speculums[primdirs.PrimDirs.PLACSPECULUM][planets.Planet.SA]
if dsa < 0.0:
dsa = 180.0+dsa
nsa *= -1
else:
nsa = 180.0-dsa
if not mundane and self.options.subzodiacal != primdirs.PrimDirs.SZPROMISSOR and self.options.subzodiacal != primdirs.PrimDirs.SZBOTH:
rapl, declpl, dist = swisseph.cotrans(pl.data[planets.Planet.LONG], 0.0, 1.0, -self.chart.obl[0])
val = math.tan(math.radians(self.chart.place.lat))*math.tan(math.radians(declpl))
if math.fabs(val) > 1.0:
continue
adlat = math.degrees(math.asin(val))
dsa = 90.0+adlat
nsa = 90.0-adlat
self.toHCs(mundane, i, rapl, dsa, nsa, chart.Chart.CONJUNCTIO)
def calcZodPromAsps2HCs(self):
'''Calclucates zodiacal directions of the aspects of promissors to housecusps'''
NODES = 2
SINISTER = 0
DEXTER = 1
for p in range(len(self.chart.planets.planets)-NODES):
if not self.options.promplanets[p]:
continue
plprom = self.chart.planets.planets[p]
pllat = plprom.speculums[primdirs.PrimDirs.PLACSPECULUM][planets.Planet.LAT]
# raprom = plprom.speculums[primdirs.PrimDirs.PLACSPECULUM][planets.Planet.RA]
# adprom = plprom.speculums[primdirs.PrimDirs.PLACSPECULUM][planets.Planet.ADLAT]
for psidx in range(chart.Chart.CONJUNCTIO+1, chart.Chart.OPPOSITIO+1):
if not self.options.pdaspects[psidx]:
continue
if self.abort.abort:
return
for k in range(DEXTER+1):
aspect = chart.Chart.Aspects[psidx]
if k == DEXTER:
if psidx == chart.Chart.OPPOSITIO:
break
aspect *= -1
lon = plprom.data[planets.Planet.LONG]+aspect
lon = util.normalize(lon)
raprom, adprom = 0.0, 0.0
if self.options.subzodiacal == primdirs.PrimDirs.SZPROMISSOR or self.options.subzodiacal == primdirs.PrimDirs.SZBOTH:
latprom = 0.0
if self.options.bianchini:
val = self.getBianchini(pllat, chart.Chart.Aspects[psidx])
if math.fabs(val) > 1.0:
continue
latprom = math.degrees(math.asin(val))
else:
latprom = pllat
#calc real(wahre)ra and adlat
# raprom, declprom = util.getRaDecl(lon, latprom, self.chart.obl[0])
raprom, declprom, dist = swisseph.cotrans(lon, latprom, 1.0, -self.chart.obl[0])
val = math.tan(math.radians(self.chart.place.lat))*math.tan(math.radians(declprom))
if math.fabs(val) > 1.0:
continue
adprom = math.degrees(math.asin(val))
else:
raprom, declprom, dist = swisseph.cotrans(lon, 0.0, 1.0, -self.chart.obl[0])
val = math.tan(math.radians(self.chart.place.lat))*math.tan(math.radians(declprom))
if math.fabs(val) > 1.0:
continue
adprom = math.degrees(math.asin(val))
dsa = 90.0+adprom
nsa = 90.0-adprom
self.toHCs(False, p, raprom, dsa, nsa, psidx, aspect)
def calcCustomer2HouseCusps(self, mundane):
'''Calculates directions of Customer-Promissor to intermediate house cusps'''
lonpl = self.chart.cpd.speculums[primdirs.PrimDirs.PLACSPECULUM][customerpd.CustomerPD.LONG]
rapl = self.chart.cpd.speculums[primdirs.PrimDirs.PLACSPECULUM][customerpd.CustomerPD.RA]
dsa = self.chart.cpd.speculums[primdirs.PrimDirs.PLACSPECULUM][customerpd.CustomerPD.SA]
nsa = self.chart.cpd.speculums[primdirs.PrimDirs.PLACSPECULUM][customerpd.CustomerPD.SA]
if dsa < 0.0:
dsa = 180.0+dsa
nsa *= -1
else:
nsa = 180.0-dsa
if not mundane and self.options.subzodiacal != primdirs.PrimDirs.SZPROMISSOR and self.options.subzodiacal != primdirs.PrimDirs.SZBOTH:
rapl, declpl, dist = swisseph.cotrans(lonpl, 0.0, 1.0, -self.chart.obl[0])
val = math.tan(math.radians(self.chart.place.lat))*math.tan(math.radians(declpl))
if math.fabs(val) > 1.0:
return
adlat = math.degrees(math.asin(val))
dsa = 90.0+adlat
nsa = 90.0-adlat
self.toHCs(mundane, primdirs.PrimDir.CUSTOMERPD, rapl, dsa, nsa, chart.Chart.CONJUNCTIO)
def calcAntiscia2HouseCusps(self, mundane):
'''Calculates directions of Promissors to intermediate house cusps'''
self.calcAntiscia2HouseCuspsSub(mundane, self.chart.antiscia.plantiscia, primdirs.PrimDir.ANTISCION)
self.calcAntiscia2HouseCuspsSub(mundane, self.chart.antiscia.plcontraant, primdirs.PrimDir.CONTRAANT)
def calcAntiscia2HouseCuspsSub(self, mundane, pls, offs):
#aspects of proms to HCs in Zodiacal!?
for i in range(len(pls)):
if not self.options.promplanets[i]:
continue
if self.abort.abort:
return
pl = pls[i]
lonpl = pl.lon
rapl = pl.ra
declpl = pl.decl
if not mundane and self.options.subzodiacal != primdirs.PrimDirs.SZPROMISSOR and self.options.subzodiacal != primdirs.PrimDirs.SZBOTH:
rapl, declpl, dist = swisseph.cotrans(lonpl, 0.0, 1.0, -self.chart.obl[0])
val = math.tan(math.radians(self.chart.place.lat))*math.tan(math.radians(declpl))
if math.fabs(val) > 1.0:
continue
adlat = math.degrees(math.asin(val))
dsa = 90.0+adlat
nsa = 90.0-adlat
self.toHCs(mundane, i+offs, rapl, dsa, nsa, chart.Chart.CONJUNCTIO)
def calcZodFixStars2HouseCusps(self):
'''Calculates zodiacal directions of fixstars to HCs'''
OFFS = primdirs.PrimDir.FIXSTAR
for i in range(len(self.chart.fixstars.data)):
if not self.options.pdfixstarssel[self.chart.fixstars.mixed[i]]:
continue
if self.abort.abort:
return
star = self.chart.fixstars.data[i]
lonstar = star[fixstars.FixStars.LON]
rastar = star[fixstars.FixStars.RA]
declstar = star[fixstars.FixStars.DECL]
if self.options.subzodiacal != primdirs.PrimDirs.SZPROMISSOR and self.options.subzodiacal != primdirs.PrimDirs.SZBOTH:
rastar, declstar, dist = swisseph.cotrans(lonstar, 0.0, 1.0, -self.chart.obl[0])
val = math.tan(math.radians(self.chart.place.lat))*math.tan(math.radians(declstar))
if math.fabs(val) > 1.0:
continue
adstar = math.degrees(math.asin(val))
dsa = 90.0+adstar
nsa = 90.0-adstar
self.toHCs(False, i+OFFS, rastar, dsa, nsa, chart.Chart.CONJUNCTIO)
def calcZodLoF2HouseCusps(self):
'''Calculates zodiacal LoF to housecusps'''
ralof = self.chart.fortune.fortune[fortune.Fortune.RA]
decllof = self.chart.fortune.fortune[fortune.Fortune.DECL]
val = math.tan(math.radians(self.chart.place.lat))*math.tan(math.radians(decllof))
if math.fabs(val) > 1.0:
return
adlat = math.degrees(math.asin(val))
dsa = 90.0+adlat
nsa = 90.0-adlat
self.toHCs(False, primdirs.PrimDir.LOF, ralof, dsa, nsa, chart.Chart.CONJUNCTIO)
def toHCs(self, mundane, idprom, raprom, dsa, nsa, aspect, asp=0.0):
#day-house, night-house length
dh = dsa/3.0
nh = nsa/3.0
#ra rise, ra set
rar = self.ramc+dsa
ras = self.raic+nsa
rar = util.normalize(rar)
ras = util.normalize(ras)
#ra housecusps
rahcps = ((primdirs.PrimDir.HC2, rar+nh), (primdirs.PrimDir.HC3, rar+2*nh), (primdirs.PrimDir.HC5, self.raic+nh), (primdirs.PrimDir.HC6, self.raic+2*nh), (primdirs.PrimDir.HC8, ras+dh), (primdirs.PrimDir.HC9, ras+2*dh), (primdirs.PrimDir.HC11, self.ramc+dh), (primdirs.PrimDir.HC12, self.ramc+2*dh))
for h in range(len(rahcps)):
rahcp = rahcps[h][1]
rahcp = util.normalize(rahcp)
arc = raprom-rahcp
ok = True
if idprom == astrology.SE_MOON and self.options.pdsecmotion:
for itera in range(self.options.pdsecmotioniter+1):
ok, arc = self.calcHArcWithSM(mundane, idprom, h, arc, aspect, asp)
if not ok:
break
if ok:
self.create(mundane, idprom, primdirs.PrimDir.NONE, rahcps[h][0], aspect, chart.Chart.CONJUNCTIO, arc)
def calcMP(self, ra, decl, pl):
eastern = True
if self.ramc > self.raic:
if ra > self.raic and ra < self.ramc:
eastern = False
else:
if (ra > self.raic and ra < 360.0) or (ra < self.ramc and ra > 0.0):
eastern = False
#adlat
val = math.tan(math.radians(self.chart.place.lat))*math.tan(math.radians(decl))
if math.fabs(val) > 1.0:
return False, 0.0
adlat = math.degrees(math.asin(val))
#md
med = math.fabs(self.ramc-ra)
if med > 180.0:
med = 360.0-med
icd = math.fabs(self.raic-ra)
if icd > 180.0:
icd = 360.0-icd
md = med
if icd < med:
md = icd
#sa (southern hemisphere!?)
dsa = 90.0+adlat
nsa = 90.0-adlat
abovehorizon = True
if med > dsa:
abovehorizon = False
sa = dsa
if not abovehorizon:
sa = nsa
if not abovehorizon and eastern:
pmp = 90.0-90.0*(md/sa)
elif not abovehorizon and not eastern:
pmp = 90.0+90.0*(md/sa)
elif abovehorizon and not eastern:
pmp = 270.0-90.0*(md/sa)
elif abovehorizon and eastern:
pmp = 270.0+90.0*(md/sa)
return True, pmp
##################################### Sec. Motion of the Moon
def calcHArcWithSM(self, mundane, idprom, h, arc, aspect, asp=0.0):
sm = secmotion.SecMotion(self.chart.time, self.chart.place, idprom, arc, self.chart.place.lat, self.chart.houses.ascmc2, self.options.topocentric)
lonprom = sm.planet.speculums[primdirs.PrimDirs.PLACSPECULUM][planets.Planet.LONG]
pllat = sm.planet.speculums[primdirs.PrimDirs.PLACSPECULUM][planets.Planet.LAT]
raprom = sm.planet.speculums[primdirs.PrimDirs.PLACSPECULUM][planets.Planet.RA]
dsa = sm.planet.speculums[primdirs.PrimDirs.PLACSPECULUM][planets.Planet.SA]
nsa = sm.planet.speculums[primdirs.PrimDirs.PLACSPECULUM][planets.Planet.SA]
if dsa < 0.0:
dsa = 180.0+dsa
nsa *= -1
else:
nsa = 180.0-dsa
if not mundane:
lonprom += asp
lonprom = util.normalize(lonprom)
latprom, raprom, adprom = 0.0, 0.0, 0.0
if self.options.subzodiacal == primdirs.PrimDirs.SZPROMISSOR or self.options.subzodiacal == primdirs.PrimDirs.SZBOTH:
latprom = 0.0
if self.options.bianchini:
val = self.getBianchini(pllat, chart.Chart.Aspects[aspect])
if math.fabs(val) > 1.0:
return False, 0.0
latprom = math.degrees(math.asin(val))
else:
latprom = pllat
#calc real(wahre)ra and adlat
# raprom, declprom = util.getRaDecl(lonprom, latprom, self.chart.obl[0])
raprom, declprom, dist = swisseph.cotrans(lonprom, latprom, 1.0, -self.chart.obl[0])
val = math.tan(math.radians(self.chart.place.lat))*math.tan(math.radians(declprom))
if math.fabs(val) > 1.0:
return False, 0.0
adprom = math.degrees(math.asin(val))
else:
raprom, declprom, dist = swisseph.cotrans(lonprom, 0.0, 1.0, -self.chart.obl[0])
val = math.tan(math.radians(self.chart.place.lat))*math.tan(math.radians(declprom))
if math.fabs(val) > 1.0:
return False, 0.0
adprom = math.degrees(math.asin(val))
dsa = 90.0+adprom
nsa = 90.0-adprom
#day-house, night-house length
dh = dsa/3.0
nh = nsa/3.0
#ra rise, ra set
rar = self.ramc+dsa
ras = self.raic+nsa
rar = util.normalize(rar)
ras = util.normalize(ras)
#ra housecusps
rahcps = ((primdirs.PrimDir.HC2, rar+nh), (primdirs.PrimDir.HC3, rar+2*nh), (primdirs.PrimDir.HC5, self.raic+nh), (primdirs.PrimDir.HC6, self.raic+2*nh), (primdirs.PrimDir.HC8, ras+dh), (primdirs.PrimDir.HC9, ras+2*dh), (primdirs.PrimDir.HC11, self.ramc+dh), (primdirs.PrimDir.HC12, self.ramc+2*dh))
rahcp = rahcps[h][1]
rahcp = util.normalize(rahcp)
arc = raprom-rahcp
return True, arc