def cmp(self, x, y): t1 = swe.difdeg2n(x, self.center) t2 = swe.difdeg2n(y, self.center) if t1 > t2: return 1 elif t1 < t2: return -1 else: return 0
def calc_center(self): tmp = 0 for p1 in self[:-1]: for p2 in self[1:]: dist = abs(swe.difdeg2n(p1, p2)) if dist >= tmp: maxw = (p1, p2) tmp = dist self.center = swe.deg_midp(*maxw)
def synastry_aspect(self, user1, pl_us1, user2, pl_us2): """ Calculates the aspects between the 2 users. Args: first user object, first list of planets and houses, second user objcet, second list of planets and houses. """ distance = abs( swe.difdeg2n(self.pl_ho_info1[pl_us1]["abs_pos"], self.pl_ho_info2[pl_us2]["abs_pos"])) if int(distance) <= 10: aspect = "Conjuction" return True, aspect, distance elif 172 <= int(distance) <= 188: aspect = "Oposition" return True, aspect, distance - 180 elif 85 <= int(distance) <= 95: aspect = "Square" return True, aspect, distance - 90 elif 113 <= int(distance) <= 127: aspect = "Trigon" return True, aspect, distance - 120 elif 57 <= int(distance) <= 63: aspect = "Sextil" return True, aspect, distance - 60 elif 28 <= int(distance) <= 32: aspect = "Semisextil" return True, aspect, distance - 30 elif 43 <= int(distance) <= 47: aspect = "Semisquare" return True, aspect, distance - 45 elif 133 <= int(distance) <= 137: aspect = "Sesquiquadrate" return True, aspect, distance - 135 elif 149 <= int(distance) <= 151: aspect = "Quincunx" return True, aspect, distance - 150 elif 71.5 <= int(distance) <= 72.5: aspect = "Quintile" return True, aspect, distance - 72 elif 143.5 <= int(distance) <= 144.5: aspect = "BiQuintile" return True, aspect, distance - 144 elif (self.pl_ho_info1[pl_us1]["name"] == "Sun" and self.pl_ho_info2[pl_us2]["name"] == "Sun" and self.pl_ho_info1[pl_us1]["quality"] == self.pl_ho_info2[pl_us2]["quality"]): aspect = "DESTINO" return False, aspect, distance else: return False, None, None
def draw_houses(self): """Draw houses glyphs.""" cuspsdir = os.path.join(_baseDir, 'icons', 'cusps', _cuspsDir) if self._chart[0].filter._hsys != 'G': ## traditional houses houses = self._chart[0]._houses[:12] for i in range(12): im = QImage(os.path.join(cuspsdir, 'cusp_%.2d.png' % (i+1))) diff = swe.difdeg2n(houses[i]._longitude, houses[i-11]._longitude) / 2.0 a = self._vernalAng - (houses[i]._longitude - diff) x, y = _getPointAt(a, 87, 5, 5) target = QRect(x, y, 10, 10) self.drawImage(target, im, _iconRect) else: ## Gauquelin sectors houses = self._chart[0]._houses[:36] for i in range(36): im = QImage(os.path.join(cuspsdir, 'sector_%.2d.png' % (i+1))) diff = swe.difdeg2n(houses[i]._longitude, houses[i-35]._longitude) / 2.0 a = self._vernalAng - (houses[i]._longitude - diff) x, y = _getPointAt(a, 87, 5, 5) target = QRect(x, y, 10, 10) self.drawImage(target, im, _iconRect)
def draw_houses(self): """Draw houses glyphs.""" cuspsdir = os.path.join(_baseDir, 'icons', 'cusps', _cuspsDir) if self._chart[0].filter._hsys != 'G': ## traditional houses houses = self._chart[0]._houses[:12] for i in range(12): im = QImage(os.path.join(cuspsdir, 'cusp_%.2d.png' % (i + 1))) diff = swe.difdeg2n(houses[i]._longitude, houses[i - 11]._longitude) / 2.0 a = self._vernalAng - (houses[i]._longitude - diff) x, y = _getPointAt(a, 87, 5, 5) target = QRect(x, y, 10, 10) self.drawImage(target, im, _iconRect) else: ## Gauquelin sectors houses = self._chart[0]._houses[:36] for i in range(36): im = QImage(os.path.join(cuspsdir, 'sector_%.2d.png' % (i + 1))) diff = swe.difdeg2n(houses[i]._longitude, houses[i - 35]._longitude) / 2.0 a = self._vernalAng - (houses[i]._longitude - diff) x, y = _getPointAt(a, 87, 5, 5) target = QRect(x, y, 10, 10) self.drawImage(target, im, _iconRect)
def asp_calc(self, point_one, point_two): """ Calculates the aspects between the 2 points. Args: first point, second point. """ distance = abs(swe.difdeg2n(point_one, point_two)) if int(distance) <= 10: aspect = "Conjuction" aid = 0 color = "#7FFF00" return True, aspect, distance, aid, color elif 172 <= int(distance) <= 188: aspect = "Oposition" aid = 180 color = "#ff0000" return True, aspect, distance - 180, aid, color elif 85 <= int(distance) <= 95: aspect = "Square" aid = 90 color = "#ff0000" return True, aspect, distance - 90, aid, color elif 113 <= int(distance) <= 127: aspect = "Trigon" aid = 120 color = "#7FFF00" return True, aspect, distance - 120, aid, color elif 57 <= int(distance) <= 63: aspect = "Sextil" aid = 60 color = "#7FFF00" return True, aspect, distance - 60, aid, color elif 28 <= int(distance) <= 32: aspect = "Semisextil" aid = 30 color = "#7FFF00" return True, aspect, distance - 30, aid, color elif 43 <= int(distance) <= 47: aspect = "Semisquare" aid = 45 color = "#ff0000" return True, aspect, distance - 45, aid, color elif 133 <= int(distance) <= 137: aspect = "Sesquiquadrate" aid = 135 color = "#ff0000" return True, aspect, distance - 135, aid, color elif 149 <= int(distance) <= 151: aspect = "Quincunx" aid = 150 color = "#505050" return True, aspect, distance - 150, aid, color elif 71.5 <= int(distance) <= 72.5: aspect = "Quintile" aid = 72 color = "#505050" return True, aspect, distance - 72, aid, color elif 143.5 <= int(distance) <= 144.5: aspect = "BiQuintile" aid = 144 color = "#505050" return True, aspect, distance - 144, aid, color else: return False, None, None, None, None