Mercurial > hg > horiscopes
diff 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 |
line wrap: on
line diff
--- a/V4/synastry.py Sun Mar 04 15:03:15 2018 +0000 +++ b/V4/synastry.py Sun Mar 04 17:09:50 2018 +0000 @@ -13,6 +13,24 @@ self.p_cob = personDict['pCOB'] self.horiscope = None + def identifyIssues(self): + if self.id is None: + return 'id' + elif self.dob is None: + return 'dob' + elif self.tob is None: + return 'tob' + elif self.cob is None: + return 'cob' + elif self.p_dob is None: + return 'p_dob' + elif self.p_tob is None: + return 'p_tob' + elif self.p_cob is None: + return 'p_cob' + else: + return None + def makePayload(self): if type(self.cob) is str: cob_0 = float(self.cob.split(',')[0][1:]) @@ -81,19 +99,27 @@ 'switch_interpretations':'0', 'house_system':'placidus', 'uhel_orbis':'#tabs_redraw'} - # return R class planetRelation: + noHouseList = ['asc','ic','dsc','mc','asc/mc','sun/moon'] def __init__(self,planetName): self.name = planetName self.angleA = None self.angleB = None + if planetName not in planetRelation.noHouseList: + self.houseA = None + self.houseB = None def setLocation(self,A,B): - self.angleA = '.'.join(A.encode('ascii','replace').split('?'))[:-1] - self.angleB = '.'.join(B.encode('ascii','replace').split('?'))[:-1] + self.angleA = float('.'.join(A.encode('ascii','replace').split('?'))[:-1]) + self.angleB = float('.'.join(B.encode('ascii','replace').split('?'))[:-1]) + # print self.angleA,self.angleB + def setHouse(self,A,B): + self.houseA = int(A.encode('ascii','ignore')) + self.houseB = int(B.encode('ascii','ignore')) + # print self.houseA,self.houseB def test_random(self): self.angleA = random.random()*360 @@ -101,12 +127,12 @@ class planetPositions: - aspectDict = {'conjunct':0,'semi-square':45,'sextile':60,'square':90,'trine':120,'opposite':180} - planetNames = ['sun','moon','mercury','venus','mars','jupiter','saturn','uranus','neptune','pluto','node','lilith','chiron','asc','ic','dsc','mc','asc_mc','sun_moon'] + aspectDict = {'conjunction':0,'semi-square':45,'sextile':60,'square':90,'trine':120,'opposite':180} + planetNames = ['sun','moon','mercury','venus','mars','jupiter','saturn','uranus','neptune','pluto','node','lilith','chiron','asc','ic','dsc','mc','asc/mc','sun/moon'] def __init__(self): self.planets = {} - for i in range(len(planetPositions.planetNames)): - self.planets[planetPositions.planetNames[i]] = planetRelation(planetPositions.planetNames[i]) + for p in planetPositions.planetNames: + self.planets[p] = planetRelation(p) self.aspect = {} def test_random(self): @@ -122,13 +148,22 @@ for aspect in planetPositions.aspectDict: if self.angleRange[0] < planetPositions.aspectDict[aspect] and self.angleRange[1] > planetPositions.aspectDict[aspect]: self.aspect[componentA,componentB] = aspect - return aspect + self.aspectDiff = abs(self.angle - planetPositions.aspectDict[aspect]) + return self.aspect,self.aspectDiff + def calcAllAspects(self): + for p1 in planetPositions.planetNames: + for p2 in planetPositions.planetNames: + self.calcAspect(p1,p2) + def printPositions(self): + for p in planetPositions.planetNames: + if p in planetRelation.noHouseList: + print p,self.planets[p].angleA,self.planets[p].angleB + else: + print p,self.planets[p].angleA,self.planets[p].angleB,self.planets[p].houseA,self.planets[p].houseB - -