-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathchart.py
More file actions
1056 lines (845 loc) · 36.4 KB
/
chart.py
File metadata and controls
1056 lines (845 loc) · 36.4 KB
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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# -*- coding: utf-8 -*-
import math
import datetime
import astrology
import planets
import houses
import fixstars
import midpoints
import riseset
import zodpars
import antzodpars
import options
import hours
import almutens
import fortune
# ###########################################
# Roberto change – V 7.3.0
import firdaria
# ###########################################
import munfortune
import arabicparts
import antiscia
import customerpd
import syzygy
import util
import mtexts
# if long is 'E' or/and lat is 'S' -> negate value
class Time:
"""Time of Birth"""
#calendars
GREGORIAN = 0
JULIAN = 1
#times
ZONE = 0
GREENWICH = 1
LOCALMEAN = 2
LOCALAPPARENT = 3
HOURSPERDAY = 24.0
def __init__(self, year, month, day, hour, minute, second, bc, cal, zt, plus, zh, zm, daylightsaving, place, full = True): #zt is zonetime, zh is zonehour, zm is zoneminute, full means to calculate everything e.g. FixedStars, MidPoints, ...
self.year = year
self.month = month
self.day = day
self.origyear = year
self.origmonth = month
self.origday = day
self.hour = hour
self.minute = minute
self.second = second
self.bc = bc
self.cal = cal
self.zt = zt
self.plus = plus
self.zh = zh
self.zm = zm
self.daylightsaving = daylightsaving
self.time = hour+minute/60.0+second/3600.0
self.dyear, self.dmonth, self.dday, self.dhour, self.dmin, self.dsec = year, month, day, hour, minute, second
if self.daylightsaving:
self.time -= 1.0
self.dhour -= 1
#check daylightsaving underflow
if self.time < 0.0:
self.time += Time.HOURSPERDAY
self.year, self.month, self.day = util.decrDay(self.year, self.month, self.day)
self.dhour += int(Time.HOURSPERDAY)
self.dyear, self.dmonth, self.dday = self.year, self.month, self.day
if zt == Time.ZONE:#ZONE
ztime = zh+zm/60.0
if self.plus:
self.time-=ztime
else:
self.time+=ztime
elif zt == Time.LOCALMEAN:#LMT
t = (place.deglon+place.minlon/60.0)*4.0 #long * 4min
if place.east:
self.time-=t/60.0
else:
self.time+=t/60.0
if bc:
self.year = 1-self.year
#check over/underflow
if self.time >= Time.HOURSPERDAY:
self.time -= Time.HOURSPERDAY
self.year, self.month, self.day = util.incrDay(self.year, self.month, self.day)
elif self.time < 0.0:
self.time += Time.HOURSPERDAY
self.year, self.month, self.day = util.decrDay(self.year, self.month, self.day)
calflag = astrology.SE_GREG_CAL
if self.cal == Time.JULIAN:
calflag = astrology.SE_JUL_CAL
self.jd = astrology.swe_julday(self.year, self.month, self.day, self.time, calflag)
if zt == Time.LOCALAPPARENT:#LAT
ret, te, serr = astrology.swe_time_equ(self.jd)
self.jd += te #LMT
#Back to h,m,s(self.time) from julianday fromat
self.year, self.month, self.day, self.time = astrology.swe_revjul(self.jd, calflag)
#To GMT
t = (place.deglon+place.minlon/60.0)*4.0 #long * 4min
if place.east:
self.time-=t/60.0
else:
self.time+=t/60.0
#check over/underflow
if self.time >= Time.HOURSPERDAY:
self.time -= Time.HOURSPERDAY
self.year, self.month, self.day = util.incrDay(self.year, self.month, self.day)
elif self.time < 0.0:
self.time += Time.HOURSPERDAY
self.year, self.month, self.day = util.decrDay(self.year, self.month, self.day)
#GMT in JD (julianday)
self.jd = astrology.swe_julday(self.year, self.month, self.day, self.time, calflag)
self.sidTime = astrology.swe_sidtime(self.jd) #GMT
self.ph = None
if full:
self.calcPHs(place)
self.profy = None
self.profm = None
self.profd = None
self.profho = None
self.profmi = None
self.profse = None
def calcPHs(self, place):
#Planetary day/hour calculation
#self.weekday = datetime.datetime(self.dyear, self.dmonth, self.dday, self.dhour, self.dmin, self.dsec).weekday()#only daylightsaving was subtracted
lon = place.deglon+place.minlon/60.0
if not place.east:
lon *= -1
lat = place.deglat+place.minlat/60.0
if not place.north:
lat *= -1
if self.zt == Time.ZONE: # 표준시
tz_hours = (1 if self.plus else -1) * (self.zh + self.zm/60.0) + (1.0 if self.daylightsaving else 0.0)
elif self.zt == Time.GREENWICH: # GMT
tz_hours = 0.0
elif self.zt == Time.LOCALMEAN: # LMT
tz_hours = place.lon / 15.0
else: # Time.LOCALAPPARENT (LAT = LMT + 방정시)
ret, te, serr = astrology.swe_time_equ(self.jd) # te: day 단위
tz_hours = (place.lon / 15.0) + te*24.0
# --- JD 기반 요일 계산 (달력 독립, Monday=0 ... Sunday=6)
# tz_hours: 현지시 오프셋(시간) → 일수로 환산해 로컬 JD를 만든다
offs = float(tz_hours) / 24.0
jd_local = self.jd + offs
# JD는 정오 기준 증가하므로 +0.5로 자정 경계를 맞춘 뒤 요일 산출
self.weekday = int(math.floor(jd_local + 0.5)) % 7
# --- 끝
self.ph = hours.PlanetaryHours(lon, lat, place.altitude, self.weekday, self.jd, tz_hours)
class Place:
"""Place of Birth"""
def __init__(self, place, deglon, minlon, seclon, east, deglat, minlat, seclat, north, altitude):
self.place = place
self.deglon = deglon
self.minlon = minlon
self.seclon = seclon
self.east = east
self.deglat = deglat
self.minlat = minlat
self.seclat = seclat
self.north = north
self.altitude = altitude
self.lon = deglon+minlon/60.0+seclon/3600.0
self.lat = deglat+minlat/60.0+seclat/3600.0
if not self.north:
self.lat *= -1.0
if not self.east:
self.lon *= -1.0
class Asp:
def __init__(self):
self.typ = Chart.NONE
self.dif = 0.0
self.aspdif = 0.0
self.appl = False
self.parallel = Chart.NONE
self.exact = False
class Chart:
"""Represents a horoscope"""
#types
RADIX = 0
SOLAR = 1
LUNAR = 2
REVOLUTION = 3
TRANSIT = 4
HORARY = 5
PROFECTION = 6
PDINCHART = 7
SIGN_NUM = 12
SIGN_DEG = 30
ARIES = 0
TAURUS = 1
GEMINI = 2
CANCER = 3
LEO = 4
VIRGO = 5
LIBRA = 6
SCORPIO = 7
SAGITTARIUS = 8
CAPRICORNUS = 9
AQUARIUS = 10
PISCES = 11
NONE = -1
CONJUNCTIO = 0
SEMISEXTIL = 1
SEMIQUADRAT = 2
SEXTIL = 3
QUINTILE = 4
QUADRAT = 5
TRIGON = 6
SESQUIQUADRAT = 7
BIQUINTILE = 8
QUINQUNX = 9
OPPOSITIO = 10
PARALLEL = 11
CONTRAPARALLEL = 12
RAPTPAR = 13
RAPTCONTRAPAR = 14
MIDPOINT = 15
DOMICIL = 0
EXAL = 1
PEREGRIN = 2
CASUS = 3
EXIL = 4
Aspects = [0.0, 30.0, 45.0, 60.0, 72.0, 90.0, 120.0, 135.0, 144.0, 150.0, 180.0]
ASPECT_NUM = 11
TRANSURANUS = 0
TRANSNEPTUNE = 1
TRANSPLUTO = 2
#Speculums
PLACIDIAN = 0
REGIOMONTAN = 1
#Lot of Fortune
LFMOONSUN = 0
LFDSUNMOON = 1
LFDMOONSUN = 2
def_fixstarsorb = 1.5
#Profections
YEAR, MONTH, DAY = range(0, 3)
def __init__(self, name, male, time, place, htype, notes, options, full = True, proftype = 0, nolat=False):
self.name = name
self.male = male
self.time = time
self.place = place
self.htype = htype
self.notes = notes
self.options = options
self.full = full
self.proftype = proftype
self.nolat = nolat
d = astrology.swe_deltat(time.jd)
serr, self.obl = astrology.swe_calc(time.jd+d, astrology.SE_ECL_NUT, 0)
#true obliquity of the ecliptic
#mean
#nutation in long
#nutation in obl
astrology.swe_set_topo(place.lon, place.lat, place.altitude)
self.create()
def create(self):
hflag = 0
fsflag = 0
pflag = astrology.SEFLG_SWIEPH+astrology.SEFLG_SPEED
astflag = astrology.SEFLG_SWIEPH
self.ayanamsha = 0.0
if self.options.ayanamsha != 0:
astrology.swe_set_sid_mode(self.options.ayanamsha-1, 0, 0)
self.ayanamsha = astrology.swe_get_ayanamsa_ut(self.time.jd)
#pflag |= astrology.SEFLG_SIDEREAL
if self.options.topocentric:
pflag += astrology.SEFLG_TOPOCTR
self.houses = houses.Houses(self.time.jd, hflag, self.place.lat, self.place.lon, self.options.hsys, self.obl[0], self.options.ayanamsha, self.ayanamsha)
self.raequasc, declequasc, dist = astrology.swe_cotrans(self.houses.ascmc[houses.Houses.EQUASC], 0.0, 1.0, -self.obl[0])
self.planets = planets.Planets(self.time.jd, self.options.meannode, pflag, self.place.lat, self.houses.ascmc2, self.raequasc, self.nolat, self.obl[0])
self.abovehorizonwithorb = self.isAboveHorizonWithOrb()
abovehor = self.planets.planets[astrology.SE_SUN].abovehorizon
if self.options.usedaynightorb:
abovehor = self.abovehorizonwithorb
self.fortune = fortune.Fortune(self.options.lotoffortune, self.houses.ascmc2, self.raequasc, self.planets, self.obl[0], self.place.lat, abovehor)
# ###########################################
# Roberto change V 7.3.0
self.firdaria = None
# ###########################################
self.munfortune = None
self.parts = None
self.fixstars = None
self.midpoints = None
self.riseset = None
self.zodpars = None
self.antiscia = None
self.antzodpars = None
self.cpd = None
self.cpd2 = None
self.syzygy = None
self.almutens = None
mdsun = self.planets.planets[astrology.SE_SUN].speculums[0][planets.Planet.MD]
sasun = self.planets.planets[astrology.SE_SUN].speculums[0][planets.Planet.SA]
if self.full:
# ###########################################
# Roberto change V 7.3.0
self.firdaria = firdaria.Firdaria(self.time.origyear, self.time.origmonth, self.time.origday, self.options, self.abovehorizonwithorb)
# ###########################################
self.munfortune = munfortune.MundaneFortune(self.options.lotoffortune, self.houses.ascmc2, self.planets, self.obl[0], self.place.lat, abovehor)
self.syzygy = syzygy.Syzygy(self)
self.parts = arabicparts.ArabicParts(self.options.arabicparts, self.houses.ascmc, self.planets, self.houses, self.houses.cusps, self.fortune, self.syzygy, self.options, self.ayanamsha)
self.fixstars = fixstars.FixStars(self.time.jd, fsflag, self.options.fixstars, self.obl[0])
self.midpoints = midpoints.MidPoints(self.planets)
# 차트의 시간 설정을 그대로 따른다 (ZONE / GREENWICH / LMT / LAT)
if self.time.zt == Time.ZONE: # 표준시
tz_hours = (1 if self.time.plus else -1) * (self.time.zh + self.time.zm/60.0) + (1.0 if self.time.daylightsaving else 0.0)
elif self.time.zt == Time.GREENWICH: # GMT
tz_hours = 0.0
elif self.time.zt == Time.LOCALMEAN: # LMT = 경도/15h (동경 +, 서경 -)
tz_hours = self.place.lon / 15.0
else: # Time.LOCALAPPARENT (LAT) = LMT + 방정시
_, te, _ = astrology.swe_time_equ(self.time.jd) # te는 '일(day)' 단위
tz_hours = (self.place.lon / 15.0) + te*24.0 # 시간을 시(hour) 단위로
self.riseset = riseset.RiseSet(self.time.jd, self.time.cal, self.place.lon, self.place.lat, self.place.altitude, tz_hours, self.planets)
self.zodpars = zodpars.ZodPars(self.planets, self.obl[0])
self.antiscia = antiscia.Antiscia(self.planets.planets, self.houses.ascmc, self.fortune.fortune, self.obl[0], self.options.ayanamsha, self.ayanamsha)
self.antzodpars = antzodpars.AntZodPars(self.antiscia.plantiscia, self.antiscia.plcontraant, self.obl[0])
self.almutens = almutens.Almutens(self)
if self.options.pdcustomer:
self.cpd = customerpd.CustomerPD(self.options.pdcustomerlon[0], self.options.pdcustomerlon[1], self.options.pdcustomerlon[2], self.options.pdcustomerlat[0], self.options.pdcustomerlat[1], self.options.pdcustomerlat[2], self.options.pdcustomersouthern, self.place.lat, self.houses.ascmc2, self.obl[0], self.raequasc)
if self.options.pdcustomer2:
self.cpd2 = customerpd.CustomerPD(self.options.pdcustomer2lon[0], self.options.pdcustomer2lon[1], self.options.pdcustomer2lon[2], self.options.pdcustomer2lat[0], self.options.pdcustomer2lat[1], self.options.pdcustomer2lat[2], self.options.pdcustomer2southern, self.place.lat, self.houses.ascmc2, self.obl[0], self.raequasc)
astrology.swe_close()
self.calcAspMatrix()
if self.fixstars != None:
self.calcFixStarAspMatrix()
def rebuildFixStars(self):
if self.full:
del self.fixstars
fsflag = 0
self.fixstars = fixstars.FixStars(self.time.jd, fsflag, self.options.fixstars, self.obl[0])
def setHouseSystem(self):
hflag = 0
self.houses = houses.Houses(self.time.jd, hflag, self.place.lat, self.place.lon, self.options.hsys, self.obl[0], self.options.ayanamsha, self.ayanamsha)
def setNodes(self):
# chart.create()와 동일한 규칙으로 pflag 구성
pflag = astrology.SEFLG_SWIEPH | astrology.SEFLG_SPEED
# 시데럴이면 모드 세팅 (플래그는 쓰지 않음; 하위 모듈에서 수동 보정)
if self.options.ayanamsha != 0:
astrology.swe_set_sid_mode(self.options.ayanamsha-1, 0, 0)
self.ayanamsha = astrology.swe_get_ayanamsa_ut(self.time.jd)
# 토포센트릭이면 플래그 부여
if self.options.topocentric:
pflag |= astrology.SEFLG_TOPOCTR
# chart.create()와 동일한 인자 순서/개수로 호출(nolat 포함)
self.planets = planets.Planets(self.time.jd, self.options.meannode,
pflag, self.place.lat, self.houses.ascmc2,
self.raequasc, self.nolat, self.obl[0])
def calcFortune(self):
del self.fortune
self.abovehorizonwithorb = self.isAboveHorizonWithOrb()
abovehor = self.planets.planets[astrology.SE_SUN].abovehorizon
if self.options.usedaynightorb:
abovehor = self.abovehorizonwithorb
self.fortune = fortune.Fortune(self.options.lotoffortune, self.houses.ascmc2, self.raequasc, self.planets, self.obl[0], self.place.lat, abovehor)
self.calcLoFAspMatrix()
def isAboveHorizonWithOrb(self):
mdsun = self.planets.planets[astrology.SE_SUN].speculums[0][planets.Planet.MD]
sasun = self.planets.planets[astrology.SE_SUN].speculums[0][planets.Planet.SA]
abovehorizon = self.planets.planets[astrology.SE_SUN].abovehorizon
# mdsun = self.planets.planets[planets.Planets.SUN].speculums[planets.Planet.PLACIDIAN].speculum[placspec.PlacidianSpeculum.MD]
# sasun = self.planets.planets[planets.Planets.SUN].speculums[planets.Planet.PLACIDIAN].speculum[placspec.PlacidianSpeculum.SA]
# abovehorizon = self.planets.planets[planets.Planets.SUN].speculums[planets.Planet.PLACIDIAN].abovehorizon
if not abovehorizon:
if mdsun < 0.0:
mdsun += 180.0
if sasun < 0.0:
sasun += 180.0
orb = self.options.daynightorbdeg+self.options.daynightorbmin/60.0
if mdsun-orb < sasun:
abovehorizon = True
return abovehorizon
def calcSyzygy(self):
if self.full:
del self.syzygy
self.syzygy = syzygy.Syzygy(self)
def calcArabicParts(self):
if self.full:
del self.parts
self.parts = arabicparts.ArabicParts(self.options.arabicparts, self.houses.ascmc, self.planets, self.houses, self.houses.cusps, self.fortune, self.syzygy, self.options, self.ayanamsha)
def calcAntiscia(self):
if self.antiscia != None:
del self.antiscia
self.antiscia = antiscia.Antiscia(self.planets.planets, self.houses.ascmc, self.fortune.fortune, self.obl[0], self.options.ayanamsha, self.ayanamsha)
def calcAspMatrix(self):
self.calcSpeeds()
self.aspmatrix = [[Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp()],
[Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp()],
[Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp()],
[Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp()],
[Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp()],
[Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp()],
[Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp()],
[Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp()],
[Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp()],
[Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp()],
[Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp()]]
for i in range(self.planets.PLANETS_NUM-1):
for j in range(self.planets.PLANETS_NUM-1):
if i != j:
k = i
l = j
if j > i:
k = j
l = i
#Check parallel-contraparallel
self.aspmatrix[k][l].parallel = Chart.NONE
decl1 = self.planets.planets[i].dataEqu[1]
decl2 = self.planets.planets[j].dataEqu[1]
if (decl1 > 0.0 and decl2 > 0.0) or (decl1 < 0.0 and decl2 < 0.0):
if ((decl1 > 0.0 and (decl1+self.options.orbisplanetspar[i][0]+self.options.orbisplanetspar[j][0] > decl2) and (decl1-(self.options.orbisplanetspar[i][0]+self.options.orbisplanetspar[j][0]) < decl2)) or (decl1 < 0.0 and (decl1+self.options.orbisplanetspar[i][0]+self.options.orbisplanetspar[j][0] > decl2) and (decl1-(self.options.orbisplanetspar[i][0]+self.options.orbisplanetspar[j][0]) < decl2))):
self.aspmatrix[k][l].parallel = Chart.PARALLEL
else:
if decl1 < 0.0:
decl1 *= -1.0
if decl2 < 0.0:
decl2 *= -1.0
if (decl1+self.options.orbisplanetspar[i][1]+self.options.orbisplanetspar[j][1] > decl2) and (decl1-(self.options.orbisplanetspar[i][1]+self.options.orbisplanetspar[j][1]) < decl2):
self.aspmatrix[k][l].parallel = Chart.CONTRAPARALLEL
for a in range(Chart.ASPECT_NUM):
#Check aspects
val1 = self.planets.planets[j].data[0]+self.options.orbis[j][a]+self.options.orbis[i][a]
val2 = self.planets.planets[j].data[0]-(self.options.orbis[j][a]+self.options.orbis[i][a])
if (self.inorbsinister(val1, val2, self.planets.planets[i].data[0], a)):
tmp = util.normalize(self.planets.planets[i].data[0]+Chart.Aspects[a])
dif = math.fabs(tmp-self.planets.planets[j].data[0])
if self.aspmatrix[k][l].typ == Chart.NONE or (self.aspmatrix[k][l].typ != Chart.NONE and self.aspmatrix[k][l].dif > dif):
self.aspmatrix[k][l].typ = a
self.aspmatrix[k][l].aspdif = dif
self.aspmatrix[k][l].appl = self.isApplPlanets(tmp, i, j)
#Check Exact
val1 = self.planets.planets[j].data[0]+self.options.exact
val2 = self.planets.planets[j].data[0]-self.options.exact
if (self.inorbsinister(val1, val2, self.planets.planets[i].data[0], a)):
self.aspmatrix[k][l].exact = True
else:
self.aspmatrix[k][l].exact = False
dif = self.planets.planets[i].data[0]-self.planets.planets[j].data[0]
if self.planets.planets[j].data[0] > self.planets.planets[i].data[0]:
dif = self.planets.planets[j].data[0]-self.planets.planets[i].data[0]
if dif > 180.0:
dif = 360.0-dif
self.aspmatrix[k][l].dif = dif
NODES = 2
# AscMC
self.aspmatrixAscMC = [[Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(), Asp()],
[Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(), Asp()]]
ascmc = [self.houses.ascmc2[houses.Houses.ASC][houses.Houses.DECL], self.houses.ascmc2[houses.Houses.MC][houses.Houses.DECL]]
for i in range(self.planets.PLANETS_NUM-1):
for j in range(2):
#Check parallel-contraparallel
self.aspmatrixAscMC[j][i].parallel = Chart.NONE
decl1 = self.planets.planets[i].dataEqu[1]
decl2 = ascmc[j]
if (decl1 > 0.0 and decl2 > 0.0) or (decl1 < 0.0 and decl2 < 0.0):
if ((decl1 > 0.0 and (decl1+self.options.orbisparAscMC[0]+self.options.orbisplanetspar[i][0] > decl2) and (decl1-(self.options.orbisparAscMC[0]+self.options.orbisplanetspar[i][0]) < decl2)) or (decl1 < 0.0 and (decl1+self.options.orbisparAscMC[0]+self.options.orbisplanetspar[i][0] > decl2) and (decl1-(self.options.orbisparAscMC[0]+self.options.orbisplanetspar[i][0]) < decl2))):
self.aspmatrixAscMC[j][i].parallel = Chart.PARALLEL
else:
if decl1 < 0.0:
decl1 *= -1.0
if decl2 < 0.0:
decl2 *= -1.0
if (decl1+self.options.orbisparAscMC[1]+self.options.orbisplanetspar[i][1] > decl2) and (decl1-(self.options.orbisparAscMC[1]+self.options.orbisplanetspar[i][1]) < decl2):
self.aspmatrixAscMC[j][i].parallel = Chart.CONTRAPARALLEL
for a in range(Chart.ASPECT_NUM):
if i == self.planets.PLANETS_NUM-NODES and a > 0:#exclude the aspects of the nodes
break
#Check aspects
val1 = self.houses.ascmc[j]+self.options.orbisAscMC[a]+self.options.orbis[i][a]
val2 = self.houses.ascmc[j]-(self.options.orbisAscMC[a]+self.options.orbis[i][a])
if (self.inorbsinister(val1, val2, self.planets.planets[i].data[0], a)):
tmp = util.normalize(self.planets.planets[i].data[0]+Chart.Aspects[a])
dif = math.fabs(tmp-self.houses.ascmc[j])
if self.aspmatrixAscMC[j][i].typ == Chart.NONE or (self.aspmatrixAscMC[j][i].typ != Chart.NONE and self.aspmatrixAscMC[j][i].dif > dif):
self.aspmatrixAscMC[j][i].typ = a
self.aspmatrixAscMC[j][i].aspdif = dif
self.aspmatrixAscMC[j][i].appl = tmp > self.houses.ascmc[j]
#Exact
val1 = self.houses.ascmc[j]+self.options.exact
val2 = self.houses.ascmc[j]-self.options.exact
if (self.inorbsinister(val1, val2, self.planets.planets[i].data[0], a)):
self.aspmatrixAscMC[j][i].exact = True
else:
self.aspmatrixAscMC[j][i].exact = False
else:#negativ
if (self.inorbdexter(val1, val2, self.planets.planets[i].data[0], a)):
tmp = util.normalize(self.planets.planets[i].data[0]-Chart.Aspects[a])
dif = math.fabs(tmp-self.houses.ascmc[j])
if self.aspmatrixAscMC[j][i].typ == Chart.NONE or (self.aspmatrixAscMC[j][i].typ != Chart.NONE and self.aspmatrixAscMC[j][i].dif > dif):
self.aspmatrixAscMC[j][i].typ = a
self.aspmatrixAscMC[j][i].aspdif = dif
self.aspmatrixAscMC[j][i].appl = tmp > self.houses.ascmc[j]
#Exact
val1 = self.houses.ascmc[j]+self.options.exact
val2 = self.houses.ascmc[j]-self.options.exact
if (self.inorbdexter(val1, val2, self.planets.planets[i].data[0], a)):
self.aspmatrixAscMC[j][i].exact = True
else:
self.aspmatrixAscMC[j][i].exact = False
dif = self.planets.planets[i].data[0]-self.houses.ascmc[j]
if self.houses.ascmc[j] > self.planets.planets[i].data[0]:
dif = self.houses.ascmc[j]-self.planets.planets[i].data[0]
if dif > 180.0:
dif = 360.0-dif
self.aspmatrixAscMC[j][i].dif = dif
# Houses
hidx = (1, 2, 3, 10, 11, 12)
self.aspmatrixH = [[Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(), Asp()],
[Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(), Asp()],
[Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(), Asp()],
[Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(), Asp()],
[Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(), Asp()],
[Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(), Asp()]]
for i in range(self.planets.PLANETS_NUM-1):
for j in range(len(hidx)):
#Check parallel-contraparallel
self.aspmatrixH[j][i].parallel = Chart.NONE
decl1 = self.planets.planets[i].dataEqu[1]
decl2 = self.houses.cusps2[hidx[j]-1][1]
if (decl1 > 0.0 and decl2 > 0.0) or (decl1 < 0.0 and decl2 < 0.0):
if ((decl1 > 0.0 and (decl1+self.options.orbisparH[0]+self.options.orbisplanetspar[i][0] > decl2) and (decl1-(self.options.orbisparH[0]+self.options.orbisplanetspar[i][0]) < decl2)) or (decl1 < 0.0 and (decl1+self.options.orbisparH[0]+self.options.orbisplanetspar[i][0] > decl2) and (decl1-(self.options.orbisparH[0]+self.options.orbisplanetspar[i][0]) < decl2))):
self.aspmatrixH[j][i].parallel = Chart.PARALLEL
else:
if decl1 < 0.0:
decl1 *= -1.0
if decl2 < 0.0:
decl2 *= -1.0
if (decl1+self.options.orbisparH[1]+self.options.orbisplanetspar[i][1] > decl2) and (decl1-(self.options.orbisparH[1]+self.options.orbisplanetspar[i][1]) < decl2):
self.aspmatrixH[j][i].parallel = Chart.CONTRAPARALLEL
for a in range(Chart.ASPECT_NUM):
if i == self.planets.PLANETS_NUM-NODES and a > 0:#exclude the aspects of the nodes
break
#Check aspects
orbH = self.options.orbisH[a]
val1 = self.houses.cusps[hidx[j]]+orbH+self.options.orbis[i][a]
val2 = self.houses.cusps[hidx[j]]-(orbH+self.options.orbis[i][a])
if (j == 0 or j == 3) and (self.houses.hsys == 'P' or self.houses.hsys == 'K' or self.houses.hsys == 'O' or self.houses.hsys == 'R' or self.houses.hsys == 'C' or self.houses.hsys == 'E' or self.houses.hsys == 'T' or self.houses.hsys == 'B'):
orbH = self.options.orbisAscMC[a]
pllon = self.planets.planets[i].data[0]
if self.options.ayanamsha != 0 and self.houses.hsys == 'W':
pllon = util.normalize(pllon-self.ayanamsha)
if (self.inorbsinister(val1, val2, pllon, a)):
tmp = util.normalize(pllon+Chart.Aspects[a])
dif = math.fabs(tmp-self.houses.cusps[hidx[j]])
if self.aspmatrixH[j][i].typ == Chart.NONE or (self.aspmatrixH[j][i].typ != Chart.NONE and self.aspmatrixH[j][i].dif > dif):
self.aspmatrixH[j][i].typ = a
self.aspmatrixH[j][i].aspdif = dif
self.aspmatrixH[j][i].appl = tmp > self.houses.cusps[hidx[j]]
#Exact
val1 = self.houses.cusps[hidx[j]]+self.options.exact
val2 = self.houses.cusps[hidx[j]]-self.options.exact
if (self.inorbsinister(val1, val2, pllon, a)):
self.aspmatrixH[j][i].exact = True
else:
self.aspmatrixH[j][i].exact = False
else:#negativ
if (j == 0 or j == 3) and (self.houses.hsys == 'P' or self.houses.hsys == 'K' or self.houses.hsys == 'O' or self.houses.hsys == 'R' or self.houses.hsys == 'C' or self.houses.hsys == 'E' or self.houses.hsys == 'T' or self.houses.hsys == 'B'):
orbH = self.options.orbisAscMC[a]
if (self.inorbdexter(val1, val2, pllon, a)):
tmp = util.normalize(pllon-Chart.Aspects[a])
dif = math.fabs(tmp-self.houses.cusps[hidx[j]])
if self.aspmatrixH[j][i].typ == Chart.NONE or (self.aspmatrixH[j][i].typ != Chart.NONE and self.aspmatrixH[j][i].dif > dif):
self.aspmatrixH[j][i].typ = a
self.aspmatrixH[j][i].aspdif = dif
self.aspmatrixH[j][i].appl = tmp > self.houses.cusps[hidx[j]]
#exact
val1 = self.houses.cusps[hidx[j]]+self.options.exact
val2 = self.houses.cusps[hidx[j]]-self.options.exact
if (self.inorbdexter(val1, val2, pllon, a)):
self.aspmatrixH[j][i].exact = True
else:
self.aspmatrixH[j][i].exact = False
dif = pllon-self.houses.cusps[hidx[j]]
if self.houses.cusps[hidx[j]] > pllon:
dif = self.houses.cusps[hidx[j]]-pllon
if dif > 180.0:
dif = 360.0-dif
self.aspmatrixH[j][i].dif = dif
self.calcLoFAspMatrix()
def calcLoFAspMatrix(self):
NODES = 2
lonlof = self.fortune.fortune[fortune.Fortune.LON]
self.aspmatrixLoF = [Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(),Asp(), Asp(), Asp()]
for i in range(self.planets.PLANETS_NUM):#Both nodes (conjunctio only)
#We don't check parallel-contraparallel now
self.aspmatrixLoF[i].parallel = Chart.NONE
for a in range(Chart.ASPECT_NUM):
#only conjunctio in case of the nodes
if i >= self.planets.PLANETS_NUM-NODES and a > 0:
break
#Check aspects
orb = 0.0
if i < self.planets.PLANETS_NUM-1:
orb = self.options.orbis[i][a]
else:
orb = self.options.orbis[i-1][a]
val1 = lonlof+orb
val2 = lonlof-orb
if (self.inorbsinister(val1, val2, self.planets.planets[i].data[0], a)):
tmp = util.normalize(self.planets.planets[i].data[0]+Chart.Aspects[a])
dif = math.fabs(tmp-lonlof)
if self.aspmatrixLoF[i].typ == Chart.NONE or (self.aspmatrixLoF[i].typ != Chart.NONE and self.aspmatrixLoF[i].dif > dif):
self.aspmatrixLoF[i].typ = a
self.aspmatrixLoF[i].aspdif = dif
self.aspmatrixLoF[i].appl = tmp > lonlof #LoF's speed is like that of the Moon but if Sun-Moon then it goes backwards in the signs
#Exact
val1 = lonlof+self.options.exact
val2 = lonlof-self.options.exact
if (self.inorbsinister(val1, val2, self.planets.planets[i].data[0], a)):
self.aspmatrixLoF[i].exact = True
else:
self.aspmatrixLoF[i].exact = False
else:#negativ
if (self.inorbdexter(val1, val2, self.planets.planets[i].data[0], a)):
tmp = util.normalize(self.planets.planets[i].data[0]-Chart.Aspects[a])
dif = math.fabs(tmp-lonlof)
if self.aspmatrixLoF[i].typ == Chart.NONE or (self.aspmatrixLoF[i].typ != Chart.NONE and self.aspmatrixLoF[i].dif > dif):
self.aspmatrixLoF[i].typ = a
self.aspmatrixLoF[i].aspdif = dif
self.aspmatrixLoF[i].appl = tmp > lonlof #LoF's spped is like that of the Moon but if Sun-Moon then it goes backwards in the signs
#exact
val1 = lonlof+self.options.exact
val2 = lonlof-self.options.exact
if (self.inorbdexter(val1, val2, self.planets.planets[i].data[0], a)):
self.aspmatrixLoF[i].exact = True
else:
self.aspmatrixLoF[i].exact = False
dif = self.planets.planets[i].data[0]-lonlof
if lonlof > self.planets.planets[i].data[0]:
dif = lonlof-self.planets.planets[i].data[0]
if dif > 180.0:
dif = 360.0-dif
self.aspmatrixLoF[i].dif = dif
def isApplPlanets(self, tmp, pl1, pl2):
pl1speed = 0
pl2speed = 0
for i in range(self.planets.PLANETS_NUM-1):
if self.speeds[i] == pl1:
pl1speed = i
if self.speeds[i] == pl2:
pl2speed = i
pl1ret = self.planets.planets[pl1].data[3] < 0.0
pl2ret = self.planets.planets[pl2].data[3] < 0.0
#Aspects are checked only forward => pl1 is always before pl2!
if tmp < self.planets.planets[pl2].data[0]:
if pl1speed > pl2speed:
return not pl1ret
else:
return pl2ret
else:
if pl1speed > pl2speed:
return pl1ret
else:
return not pl2ret
def calcSpeeds(self):
self.speeds = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
planetspds = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
for i in range(self.planets.PLANETS_NUM-1):
planetspds[i] = self.planets.planets[i].data[3]
if planetspds[i] < 0.0:
planetspds[i] *= -1.0
for j in range(self.planets.PLANETS_NUM-1):
for i in range(self.planets.PLANETS_NUM-2):
if (planetspds[i] > planetspds[i+1]):
tmp = planetspds[i]
planetspds[i] = planetspds[i+1]
planetspds[i+1] = tmp
a = self.speeds[i]
self.speeds[i] = self.speeds[i+1]
self.speeds[i+1] = a
def dignity(self, pid):
lona = self.planets.planets[pid].data[0]
if self.options.ayanamsha != 0:
lona -= self.ayanamsha
lona = util.normalize(lona)
sign = int(lona/Chart.SIGN_DEG)
val = Chart.PEREGRIN
if pid < astrology.SE_PLUTO+1:
isdom = self.options.dignities[pid][0][sign]
isexal = self.options.dignities[pid][1][sign]
oppsign = (sign + Chart.SIGN_NUM // 2) % Chart.SIGN_NUM
isexil = self.options.dignities[pid][0][oppsign]
iscasus = self.options.dignities[pid][1][oppsign]
if isdom:
val = Chart.DOMICIL
elif isexil:
val = Chart.EXIL
elif isexal:
val = Chart.EXAL
elif iscasus:
val = Chart.CASUS
return val
def calcFixStarAspMatrix(self):
'''Calculates conjunctions of fixstars(planets and AscMC)'''
self.fsaspmatrix = []
self.fsaspmatrixangles = []
self.fsaspmatrixhcs = []
self.fsaspmatrixlof = []
num = len(self.fixstars.data)
for i in range(num):
ar = []
val1 = self.fixstars.data[i][fixstars.FixStars.LON]+self.options.fixstars[self.fixstars.data[i][fixstars.FixStars.NOMNAME]]
val2 = self.fixstars.data[i][fixstars.FixStars.LON]-self.options.fixstars[self.fixstars.data[i][fixstars.FixStars.NOMNAME]]
for j in range(self.planets.PLANETS_NUM):
if (self.inorbsinister(val1, val2, self.planets.planets[j].data[planets.Planet.LONG], Chart.CONJUNCTIO)):
ar.append(j)
if len(ar) != 0:
fsar = (i, ar)
self.fsaspmatrix.append(fsar)
# AscDescMCIC
ASC = self.houses.ascmc[houses.Houses.ASC]
DESC = util.normalize(self.houses.ascmc[houses.Houses.ASC]+180.0)
MC = self.houses.ascmc[houses.Houses.MC]
IC = util.normalize(self.houses.ascmc[houses.Houses.MC]+180.0)
ascmc = [ASC, DESC, MC, IC]
for i in range(num):
ar = []
val1 = self.fixstars.data[i][fixstars.FixStars.LON]+self.options.fixstars[self.fixstars.data[i][fixstars.FixStars.NOMNAME]]
val2 = self.fixstars.data[i][fixstars.FixStars.LON]-self.options.fixstars[self.fixstars.data[i][fixstars.FixStars.NOMNAME]]
for j in range(len(ascmc)):
if (self.inorbsinister(val1, val2, ascmc[j], Chart.CONJUNCTIO)):
ar.append(j)
if len(ar) != 0:
fsar = (i, ar)
self.fsaspmatrixangles.append(fsar)
# Housecusps
for i in range(num):
ar = []
val1 = self.fixstars.data[i][fixstars.FixStars.LON]+self.options.fixstars[self.fixstars.data[i][fixstars.FixStars.NOMNAME]]
val2 = self.fixstars.data[i][fixstars.FixStars.LON]-self.options.fixstars[self.fixstars.data[i][fixstars.FixStars.NOMNAME]]
for j in range(houses.Houses.HOUSE_NUM):
if (j == 0 or j == 3 or j == 6 or j == 9) and (self.houses.hsys == 'P' or self.houses.hsys == 'K' or self.houses.hsys == 'O' or self.houses.hsys == 'R' or self.houses.hsys == 'C' or self.houses.hsys == 'E' or self.houses.hsys == 'T' or self.houses.hsys == 'B'):
continue
if (self.inorbsinister(val1, val2, self.houses.cusps[j+1], Chart.CONJUNCTIO)):
ar.append(j)
if len(ar) != 0:
fsar = (i, ar)
self.fsaspmatrixhcs.append(fsar)
#LoF
lonlof = self.fortune.fortune[fortune.Fortune.LON]
for i in range(num):
val1 = self.fixstars.data[i][fixstars.FixStars.LON]+self.options.fixstars[self.fixstars.data[i][fixstars.FixStars.NOMNAME]]
val2 = self.fixstars.data[i][fixstars.FixStars.LON]-self.options.fixstars[self.fixstars.data[i][fixstars.FixStars.NOMNAME]]
if (self.inorbsinister(val1, val2, lonlof, Chart.CONJUNCTIO)):
self.fsaspmatrixlof.append(i)
def recalc(self):
del self.houses
del self.planets
del self.fortune
del self.fixstars
del self.midpoints
del self.riseset
del self.zodpars
# ###########################################
# Roberto change V 7.3.0
del self.firdaria
# ###########################################
del self.antiscia
del self.antzodpars
del self.syzygy
del self.almutens
del self.parts
del self.cpd
del self.cpd2
self.create()
def recalcAlmutens(self):
del self.almutens
self.almutens = almutens.Almutens(self)
def setCustomer(self, cpd):
if self.cpd != None:
del self.cpd
self.cpd = cpd
def setCustomer2(self, cpd2):
if self.cpd2 != None:
del self.cpd2
self.cpd2 = cpd2
def inorbsinister(self, val1, val2, pos, asp):
'''Checks if inside orb (Pisces-Aries transition also!), val1 is leftorbboundary, val2 is rightorb boundary'''
asppoint = pos+Chart.Aspects[asp]
if (val1 >= 360.0 and val2 < 360.0) or (val1 > 0 and val2 < 0):#left is in Aries, right is in Pisces
if (val1 >= 0 and val2 < 0):
val1 += 360.0
val2 += 360.0
if asp == Chart.CONJUNCTIO and pos < 20.0: # 20.0 is arbitrary, just to see if the planet is close to the Pisces-Aries transition
asppoint += 360.0
else:
val1 = util.normalize(val1)
val2 = util.normalize(val2)
asppoint = util.normalize(asppoint)
if val1 > asppoint and val2 < asppoint:
return True
return False
def inorbdexter(self, val1, val2, pos, asp):
'''Checks if inside orb (Pisces-Aries transition also!), val1 is leftorbboundary, val2 is rightorb boundary'''
asppoint = pos-Chart.Aspects[asp]
asppoint = util.normalize(asppoint)
if (val1 >= 360.0 and val2 < 360.0) or (val1 > 0 and val2 < 0):#left is in Aries, right is in Pisces
asppoint += 360.0
if (val1 >= 0 and val2 < 0):
val1 += 360.0
val2 += 360.0