comparison V5/synastry.py @ 24:d2bd074d9284

fixing sextile range and allowing save of raw files to save repull every time new class structure
author DaveM
date Mon, 09 Apr 2018 16:07:05 +0100
parents 11d4e438045e
children 585edbea35b1
comparison
equal deleted inserted replaced
23:11d4e438045e 24:d2bd074d9284
276 self.angleB = random.random()*360 276 self.angleB = random.random()*360
277 277
278 278
279 class planetPositions: 279 class planetPositions:
280 aspectDict = {'conjunction':0,'semi-square':45,'sextile':60,'square':90,'trine':120,'opposition':180} 280 aspectDict = {'conjunction':0,'semi-square':45,'sextile':60,'square':90,'trine':120,'opposition':180}
281 aspectRange = {'conjunction':10,'semi-square':2,'sextile':4,'square':10,'trine':10,'opposition':10}
281 # zodiacAngle = {'aries':0,'taurus':30,'gemini':60,'cancer':90,'leo':120,'virgo':150,'libra':180,'scorpio':210,'sagittarius':240,'capricorn':270,'aquarius':300,'pisces':330} 282 # zodiacAngle = {'aries':0,'taurus':30,'gemini':60,'cancer':90,'leo':120,'virgo':150,'libra':180,'scorpio':210,'sagittarius':240,'capricorn':270,'aquarius':300,'pisces':330}
282 # Taken from https://en.wikipedia.org/wiki/Astrological_sign, with reference from https://en.wikipedia.org/wiki/Astrological_symbols#Signs_of_the_zodiac 283 # Taken from https://en.wikipedia.org/wiki/Astrological_sign, with reference from https://en.wikipedia.org/wiki/Astrological_symbols#Signs_of_the_zodiac
283 planetNames = ['sun','moon','mercury','venus','mars','jupiter','saturn','uranus','neptune','pluto','node','lilith','chiron','asc','ic','dsc','mc','asc/mc','sun/moon'] 284 planetNames = ['sun','moon','mercury','venus','mars','jupiter','saturn','uranus','neptune','pluto','node','lilith','chiron','asc','ic','dsc','mc','asc/mc','sun/moon']
284 def __init__(self): 285 def __init__(self):
285 self.planets = {} 286 self.planets = {}
290 def test_random(self): 291 def test_random(self):
291 for planet in self.planets: 292 for planet in self.planets:
292 self.planets[planet].test_random() 293 self.planets[planet].test_random()
293 294
294 def calcAngle(self,componentA,componentB): 295 def calcAngle(self,componentA,componentB):
295 print componentA,componentB
296 self.angle = abs(self.planets[componentA].angleA - self.planets[componentB].angleB) 296 self.angle = abs(self.planets[componentA].angleA - self.planets[componentB].angleB)
297 self.angleRange = self.angle-10,self.angle+10
298 297
299 def calcAspect(self,componentA,componentB): 298 def calcAspect(self,componentA,componentB):
300 self.calcAngle(componentA,componentB) 299 self.calcAngle(componentA,componentB)
301 # print componentA,componentB,self.angle,self.planets[componentA].angleA,self.planets[componentB].angleB
302 for aspect in planetPositions.aspectDict: 300 for aspect in planetPositions.aspectDict:
303 if self.angleRange[0] < planetPositions.aspectDict[aspect] and self.angleRange[1] > planetPositions.aspectDict[aspect]: 301 if self.angle-self.aspectRange[aspect] < self.aspectDict[aspect] and self.angle+self.aspectRange[aspect] > self.aspectDict[aspect]:
304 # print aspect#,componentA,componentB,self.angle
305 aspectDiff = round(abs(self.angle - planetPositions.aspectDict[aspect]),2) 302 aspectDiff = round(abs(self.angle - planetPositions.aspectDict[aspect]),2)
306 self.aspect[componentA,componentB] = (aspect,aspectDiff) 303 self.aspect[componentA,componentB] = (aspect,aspectDiff)
307 print componentA,componentB,self.angle,aspect,aspectDiff 304 print componentA,self.planets[componentA].angleA,componentB,self.planets[componentB].angleB,self.angle,aspect,aspectDiff
308 return aspect,aspectDiff 305 return aspect,aspectDiff
309 return None,None 306 return None,None
310 307
311 def isInHouse(self,component,houseNo): 308 def isInHouse(self,component,houseNo):
312 # print (self.planets[component].houseA,self.planets[component].houseB,houseNo) 309 # print (self.planets[component].houseA,self.planets[component].houseB,houseNo)