Mercurial > hg > horiscopes
comparison V4/synastry.py @ 15:50a95089414d
updating to allow for all aspects to be calculated, and remove default value passing for people.
author | DaveM |
---|---|
date | Sun, 04 Mar 2018 17:09:50 +0000 |
parents | b253748dbb11 |
children | b11cff4b7f83 |
comparison
equal
deleted
inserted
replaced
14:a0c217ee4168 | 15:50a95089414d |
---|---|
10 self.cob = personDict['COB'] | 10 self.cob = personDict['COB'] |
11 self.p_dob = personDict['pDOB'] | 11 self.p_dob = personDict['pDOB'] |
12 self.p_tob = personDict['pTOB'] | 12 self.p_tob = personDict['pTOB'] |
13 self.p_cob = personDict['pCOB'] | 13 self.p_cob = personDict['pCOB'] |
14 self.horiscope = None | 14 self.horiscope = None |
15 | |
16 def identifyIssues(self): | |
17 if self.id is None: | |
18 return 'id' | |
19 elif self.dob is None: | |
20 return 'dob' | |
21 elif self.tob is None: | |
22 return 'tob' | |
23 elif self.cob is None: | |
24 return 'cob' | |
25 elif self.p_dob is None: | |
26 return 'p_dob' | |
27 elif self.p_tob is None: | |
28 return 'p_tob' | |
29 elif self.p_cob is None: | |
30 return 'p_cob' | |
31 else: | |
32 return None | |
15 | 33 |
16 def makePayload(self): | 34 def makePayload(self): |
17 if type(self.cob) is str: | 35 if type(self.cob) is str: |
18 cob_0 = float(self.cob.split(',')[0][1:]) | 36 cob_0 = float(self.cob.split(',')[0][1:]) |
19 cob_1 = float(self.cob.split(',')[1]) | 37 cob_1 = float(self.cob.split(',')[1]) |
79 'zena_narozeni_timezone_form':'auto', | 97 'zena_narozeni_timezone_form':'auto', |
80 'zena_narozeni_timezone_dst_form':'auto', | 98 'zena_narozeni_timezone_dst_form':'auto', |
81 'switch_interpretations':'0', | 99 'switch_interpretations':'0', |
82 'house_system':'placidus', | 100 'house_system':'placidus', |
83 'uhel_orbis':'#tabs_redraw'} | 101 'uhel_orbis':'#tabs_redraw'} |
84 # return R | |
85 | 102 |
86 | 103 |
87 class planetRelation: | 104 class planetRelation: |
105 noHouseList = ['asc','ic','dsc','mc','asc/mc','sun/moon'] | |
88 def __init__(self,planetName): | 106 def __init__(self,planetName): |
89 self.name = planetName | 107 self.name = planetName |
90 self.angleA = None | 108 self.angleA = None |
91 self.angleB = None | 109 self.angleB = None |
110 if planetName not in planetRelation.noHouseList: | |
111 self.houseA = None | |
112 self.houseB = None | |
92 | 113 |
93 def setLocation(self,A,B): | 114 def setLocation(self,A,B): |
94 self.angleA = '.'.join(A.encode('ascii','replace').split('?'))[:-1] | 115 self.angleA = float('.'.join(A.encode('ascii','replace').split('?'))[:-1]) |
95 self.angleB = '.'.join(B.encode('ascii','replace').split('?'))[:-1] | 116 self.angleB = float('.'.join(B.encode('ascii','replace').split('?'))[:-1]) |
117 # print self.angleA,self.angleB | |
96 | 118 |
119 def setHouse(self,A,B): | |
120 self.houseA = int(A.encode('ascii','ignore')) | |
121 self.houseB = int(B.encode('ascii','ignore')) | |
122 # print self.houseA,self.houseB | |
97 | 123 |
98 def test_random(self): | 124 def test_random(self): |
99 self.angleA = random.random()*360 | 125 self.angleA = random.random()*360 |
100 self.angleB = random.random()*360 | 126 self.angleB = random.random()*360 |
101 | 127 |
102 | 128 |
103 class planetPositions: | 129 class planetPositions: |
104 aspectDict = {'conjunct':0,'semi-square':45,'sextile':60,'square':90,'trine':120,'opposite':180} | 130 aspectDict = {'conjunction':0,'semi-square':45,'sextile':60,'square':90,'trine':120,'opposite':180} |
105 planetNames = ['sun','moon','mercury','venus','mars','jupiter','saturn','uranus','neptune','pluto','node','lilith','chiron','asc','ic','dsc','mc','asc_mc','sun_moon'] | 131 planetNames = ['sun','moon','mercury','venus','mars','jupiter','saturn','uranus','neptune','pluto','node','lilith','chiron','asc','ic','dsc','mc','asc/mc','sun/moon'] |
106 def __init__(self): | 132 def __init__(self): |
107 self.planets = {} | 133 self.planets = {} |
108 for i in range(len(planetPositions.planetNames)): | 134 for p in planetPositions.planetNames: |
109 self.planets[planetPositions.planetNames[i]] = planetRelation(planetPositions.planetNames[i]) | 135 self.planets[p] = planetRelation(p) |
110 self.aspect = {} | 136 self.aspect = {} |
111 | 137 |
112 def test_random(self): | 138 def test_random(self): |
113 for planet in self.planets: | 139 for planet in self.planets: |
114 self.planets[planet].test_random() | 140 self.planets[planet].test_random() |
120 def calcAspect(self,componentA,componentB): | 146 def calcAspect(self,componentA,componentB): |
121 self.calcAngle(componentA,componentB) | 147 self.calcAngle(componentA,componentB) |
122 for aspect in planetPositions.aspectDict: | 148 for aspect in planetPositions.aspectDict: |
123 if self.angleRange[0] < planetPositions.aspectDict[aspect] and self.angleRange[1] > planetPositions.aspectDict[aspect]: | 149 if self.angleRange[0] < planetPositions.aspectDict[aspect] and self.angleRange[1] > planetPositions.aspectDict[aspect]: |
124 self.aspect[componentA,componentB] = aspect | 150 self.aspect[componentA,componentB] = aspect |
125 return aspect | 151 self.aspectDiff = abs(self.angle - planetPositions.aspectDict[aspect]) |
152 return self.aspect,self.aspectDiff | |
153 | |
154 def calcAllAspects(self): | |
155 for p1 in planetPositions.planetNames: | |
156 for p2 in planetPositions.planetNames: | |
157 self.calcAspect(p1,p2) | |
158 | |
159 def printPositions(self): | |
160 for p in planetPositions.planetNames: | |
161 if p in planetRelation.noHouseList: | |
162 print p,self.planets[p].angleA,self.planets[p].angleB | |
163 else: | |
164 print p,self.planets[p].angleA,self.planets[p].angleB,self.planets[p].houseA,self.planets[p].houseB | |
126 | 165 |
127 | 166 |
128 | 167 |
129 | 168 |
130 | 169 |
131 | |
132 | |
133 | |
134 |