def __init__(self, cusps, ascmc, hsys): """Initialize object with swe_houses results. >>> cusps, ascmc = swe.houses(2454595, 46.5, 6.5, 'P') >>> res = HousesDataList(cusps, ascmc, 'P') This procedure also computes additional values for descendant and Imum Coeli. :type cusps: sequence :type ascmc: sequence :type hsys: str """ self._hsys = hsys # cusps. get their planet objects if len(cusps) == 12: for i, num in enumerate(range(-100, -112, -1)): self.append(PlanetData(num, cusps[i])) elif len(cusps) == 36: # gauquelin for i, num in enumerate(range(-112, -148, -1)): self.append(PlanetData(num, cusps[i])) else: raise ValueError('Invalid cusps results.') # ascmc for i, num in enumerate(range(-148, -156, -1)): self.append(PlanetData(num, ascmc[i])) # additional dsc, ic self.insert(-6, PlanetData(-156, swe.degnorm(ascmc[0] - 180))) # dsc self.insert(-6, PlanetData(-157, swe.degnorm(ascmc[1] - 180))) # ic
def __init__(self, device, chart): """Paint on device. :type device: QPaintDevice :type chart: BiChart """ QPainter.__init__(self, device) self._chart = chart # set angle to vernal point self._vernalAng = swe.degnorm(chart[0]._houses[0]._longitude - 180) # set canvas self.setWindow(0, 0, 242, 242) # window is 240 x 240, +2 for antialias self.translate(121, 121) # set center at 0;0 self.setRenderHints(QPainter.Antialiasing) # set colors if chart[0].filter._bg_color == 'black': self._bgColor = Qt.black self._drawColor = Qt.white self._lightColor = Qt.darkGray self._middleColor = Qt.gray self._darkColor = Qt.lightGray else: ## white self._bgColor = Qt.white self._drawColor = Qt.black self._lightColor = Qt.lightGray self._middleColor = Qt.gray self._darkColor = Qt.darkGray # fill background color self.fillRect(-121, -121, 242, 242, QBrush(self._bgColor)) # set drawing color self.setPen(self._drawColor) # draw markers before circles to overwrite lighter pixels self.draw_zodiac() self.draw_cusps() self.draw_circles() self.draw_signs() self.draw_houses() # draw visible charts visible = [x for x in self._chart if not x._hidden] lenvisible = len(visible) if lenvisible == 0: ## all hidden return # draw aspects before planets to overwrite if lenvisible == 1: self.draw_aspects(visible[0]._all_draw_aspects(), lenvisible) self.draw_planets(0, lenvisible, visible[0]._all_draw_planets()) else: ## interaspects self.draw_aspects(self._chart._all_draw_aspects(), lenvisible) if self._chart[0]._filter._draw_midp: self.draw_planets(0, lenvisible, self._chart._all_draw_planets(0)) else: self.draw_planets(0, lenvisible, visible[0]._all_draw_planets()) if self._chart[1]._filter._draw_midp: self.draw_planets(1, lenvisible, self._chart._all_draw_planets(1)) else: self.draw_planets(1, lenvisible, visible[1]._all_draw_planets())
def arrange(self): self.sort(self.cmp) ret = list() dist = self.orb() - (self.w / 2.0) for i in range(len(self)): ret.append((self[i], swe.degnorm(self.center - dist))) dist -= self.w return ret
def draw_signs(self): """Draw signs glyphs.""" zodiacdir = os.path.join(_baseDir, 'icons', 'zodiac', _zodiacDir) ang = swe.degnorm(self._vernalAng - 15) for i in range(12): im = QImage(os.path.join(zodiacdir, 'sign_%.2d.png' % (i+1))) x, y = _getPointAt(ang, 111, 8, 8) target = QRect(x, y, 16, 16) self.drawImage(target, im, _iconRect) ang -= 30
def draw_signs(self): """Draw signs glyphs.""" zodiacdir = os.path.join(_baseDir, 'icons', 'zodiac', _zodiacDir) ang = swe.degnorm(self._vernalAng - 15) for i in range(12): im = QImage(os.path.join(zodiacdir, 'sign_%.2d.png' % (i + 1))) x, y = _getPointAt(ang, 111, 8, 8) target = QRect(x, y, 16, 16) self.drawImage(target, im, _iconRect) ang -= 30
def part_of_fortune_rudhyar(cht): """Calculate part of fortune (Rudhyar). :type cht: Chart """ flag = cht._filter.get_calcflag() sun = swe.calc_ut(cht.julday, swe.SUN, flag) moon = swe.calc_ut(cht.julday, swe.MOON, flag) pos = swe.degnorm( cht._houses.get_positions('Asc')._longitude + (swe.difdegn(moon[0], sun[0]))) return (pos, 0, 0, 0, 0, 0)
def part_of_fortune_rudhyar(cht): """Calculate part of fortune (Rudhyar). :type cht: Chart """ flag = cht._filter.get_calcflag() sun = swe.calc_ut(cht.julday, swe.SUN, flag) moon = swe.calc_ut(cht.julday, swe.MOON, flag) pos = swe.degnorm( cht._houses.get_positions('Asc')._longitude + ( swe.difdegn(moon[0], sun[0]))) return (pos, 0, 0, 0, 0, 0)
def calc_ut(self, jd, flag, chart=None): """Return calculations results. Houses cusps are calculated in block (see chartcalc). Parts require that you pass the chart object. :type jd: numeric :type flag: int :type chart: ChartCalc :raise ValueError: invalid planet (houses) """ if self._family == 4: raise ValueError('Cannot calculate houses.') # "inverted objects". Should invert latitude too?? elif self._num == -2: # ketu (mean) r = swe.calc_ut(jd, 10, flag) return (swe.degnorm(r[0]-180), r[1], r[2], r[3], r[4], r[5]) elif self._num == -3: # ketu (true) r = swe.calc_ut(jd, 11, flag) return (swe.degnorm(r[0]-180), r[1], r[2], r[3], r[4], r[5]) elif self._num == -4: # priapus (mean) r = swe.calc_ut(jd, 12, flag) return (swe.degnorm(r[0]-180), r[1], r[2], r[3], r[4], r[5]) elif self._num == -5: # priapus (true) r = swe.calc_ut(jd, 13, flag) return (swe.degnorm(r[0]-180), r[1], r[2], r[3], r[4], r[5]) # planets, asteroids, etc elif self._family in (0, 1, 3): return swe.calc_ut(jd, self._num, flag) # fixed stars elif self._family == 2: return swe.fixstar_ut(self._name, jd, flag) # parts elif self._family == 5: return oroboros.core.parts.calc_ut(self._name, chart)
def updatePandC(date, observer, houses, entries): day = datetime_to_julian(date) obliquity = swisseph.calc_ut(day, swisseph.ECL_NUT)[0] cusps, asmc = swisseph.houses(day, observer.lat, observer.lng) fill_houses(date, observer, houses=houses, data=cusps) for i in range(10): calcs = swisseph.calc_ut(day, i) hom = swisseph.house_pos(asmc[2], observer.lat, obliquity, calcs[0], objlat=calcs[1]) if i == swisseph.SUN or i == swisseph.MOON: retrograde = 'Not Applicable' else: retrograde = str(calcs[3] < 0) entries[i].retrograde = retrograde entries[i].m.longitude = calcs[0] entries[i].m.latitude = calcs[1] entries[i].m.progress = hom % 1.0 entries[i].m.house_info = houses[int(hom-1)] if len(entries) > 10: #add node entries calcs = swisseph.calc_ut(day, swisseph.TRUE_NODE) hom = swisseph.house_pos(asmc[2], observer.lat, obliquity, calcs[0], objlat=calcs[1]) retrograde = "Always" entries[10].retrograde = retrograde entries[10].m.longitude = calcs[0] entries[10].m.latitude = calcs[1] entries[10].m.progress = hom%1.0 entries[10].m.house_info = houses[int(hom-1)] #do some trickery to display the South Node reverse = swisseph.degnorm(calcs[0]-180.0) revhouse = (int(hom)+6)%12 #revprogress = 1-hom%1.0 revprogress = hom%1.0 entries[11].retrograde = retrograde entries[11].m.longitude = reverse entries[11].m.latitude = calcs[1] entries[11].m.progress = revprogress entries[11].m.house_info = houses[int(revhouse-1)] if len(entries) > 12: ascendant = asmc[0] descendant = cusps[6] mc = asmc[1] ic = cusps[3] retrograde = 'Not a Planet' entries[12].m.longitude = ascendant entries[13].m.longitude = descendant entries[14].m.longitude = mc entries[15].m.longitude = ic swisseph.close()
def updatePandC(date, observer, houses, entries): day = datetime_to_julian(date) obliquity = swisseph.calc_ut(day, swisseph.ECL_NUT)[0] cusps, asmc = swisseph.houses(day, observer.lat, observer.lng) fill_houses(date, observer, houses=houses, data=cusps) for i in range(10): calcs = swisseph.calc_ut(day, i) hom = swisseph.house_pos(asmc[2], observer.lat, obliquity, calcs[0], objlat=calcs[1]) if i == swisseph.SUN or i == swisseph.MOON: retrograde = "Not Applicable" else: retrograde = str(calcs[3] < 0) entries[i].retrograde = retrograde entries[i].m.longitude = calcs[0] entries[i].m.latitude = calcs[1] entries[i].m.progress = hom % 1.0 entries[i].m.house_info = houses[int(hom - 1)] if len(entries) > 10: # add node entries calcs = swisseph.calc_ut(day, swisseph.TRUE_NODE) hom = swisseph.house_pos(asmc[2], observer.lat, obliquity, calcs[0], objlat=calcs[1]) retrograde = "Always" entries[10].retrograde = retrograde entries[10].m.longitude = calcs[0] entries[10].m.latitude = calcs[1] entries[10].m.progress = hom % 1.0 entries[10].m.house_info = houses[int(hom - 1)] # do some trickery to display the South Node reverse = swisseph.degnorm(calcs[0] - 180.0) revhouse = (int(hom) + 6) % 12 # revprogress = 1-hom%1.0 revprogress = hom % 1.0 entries[11].retrograde = retrograde entries[11].m.longitude = reverse entries[11].m.latitude = calcs[1] entries[11].m.progress = revprogress entries[11].m.house_info = houses[int(revhouse - 1)] if len(entries) > 12: ascendant = asmc[0] descendant = cusps[6] mc = asmc[1] ic = cusps[3] retrograde = "Not a Planet" entries[12].m.longitude = ascendant entries[13].m.longitude = descendant entries[14].m.longitude = mc entries[15].m.longitude = ic swisseph.close()
def add_pos(self, value): """Add degrees to positions. Chart positions must be computed before. :see: calc() :type value: numeric """ pl = PlanetDataList() value = float(value) for pos in self._planets: ##if pos._planet._family == 4: # houses ##continue pos._longitude = swe.degnorm(pos._longitude + value) pl.append(pos) self._planets = pl # recalc self._calc_aspects() if self._filter._calc_midp: self._calc_midpoints() self._calc_midp_aspects()
def get_signs(date, observer, nodes, axes, prefix=None): entries = [] houses = fill_houses(date, observer) day = datetime_to_julian(date) obliquity = swisseph.calc_ut(day, swisseph.ECL_NUT)[0] cusps, asmc = swisseph.houses(day, observer.lat, observer.lng) for i in range(10): calcs = swisseph.calc_ut(day, i) hom = swisseph.house_pos(asmc[2], observer.lat, obliquity, calcs[0], objlat=calcs[1]) zm = ActiveZodiacalMeasurement(calcs[0], calcs[1], houses[int(hom-1)], progress=hom % 1.0) if i == swisseph.SUN or i == swisseph.MOON: retrograde = 'Not Applicable' else: retrograde = str(calcs[3] < 0) planet = Planet(swisseph.get_planet_name(i), prefix=prefix, m=zm, retrograde=retrograde) entries.append(planet) if nodes: #add node entries calcs = swisseph.calc_ut(day, swisseph.TRUE_NODE) hom = swisseph.house_pos(asmc[2], observer.lat, obliquity, calcs[0], objlat=calcs[1]) zm = ActiveZodiacalMeasurement(calcs[0], calcs[1], houses[int(hom-1)], progress=hom % 1.0) retrograde = "Always" planet = Planet("North Node", prefix=prefix, m=zm, retrograde=retrograde) entries.append(planet) #do some trickery to display the South Node reverse = swisseph.degnorm(calcs[0]+180.0) revhouse = (int(hom)+6) % 12 #revprogress = 1-hom%1.0 revprogress = hom % 1.0 zm = ActiveZodiacalMeasurement(reverse, calcs[1], houses[revhouse-1], progress=revprogress) planet = Planet("South Node", prefix=prefix ,m=zm, retrograde=retrograde) entries.append(planet) if axes: ascendant = asmc[0] descendant = cusps[6] mc = asmc[1] ic = cusps[3] retrograde = 'Not a Planet' zm = ActiveZodiacalMeasurement(ascendant, 0.0, houses[0], progress=0.0) planet = Planet("Ascendant", prefix=prefix, m=zm, retrograde=retrograde) entries.append(planet) zm = ActiveZodiacalMeasurement(descendant, 0.0, houses[6], progress=0.0) planet = Planet("Descendant", prefix=prefix, m=zm, retrograde=retrograde) entries.append(planet) zm = ActiveZodiacalMeasurement(mc, 0.0, houses[9], progress=0.0) planet = Planet("MC", prefix=prefix, m=zm, retrograde=retrograde) entries.append(planet) zm = ActiveZodiacalMeasurement(ic, 0.0, houses[3], progress=0.0) planet = Planet("IC", prefix=prefix, m=zm, retrograde=retrograde) entries.append(planet) #if stars: #print "Todo" swisseph.close() return houses, entries
def get_signs(date, observer, nodes, axes, prefix=None): entries = [] houses = fill_houses(date, observer) day = datetime_to_julian(date) obliquity = swisseph.calc_ut(day, swisseph.ECL_NUT)[0] cusps, asmc = swisseph.houses(day, observer.lat, observer.lng) for i in range(10): calcs = swisseph.calc_ut(day, i) hom = swisseph.house_pos(asmc[2], observer.lat, obliquity, calcs[0], objlat=calcs[1]) zm = ActiveZodiacalMeasurement(calcs[0], calcs[1], houses[int(hom - 1)], progress=hom % 1.0) if i == swisseph.SUN or i == swisseph.MOON: retrograde = "Not Applicable" else: retrograde = str(calcs[3] < 0) planet = Planet(swisseph.get_planet_name(i), prefix=prefix, m=zm, retrograde=retrograde) entries.append(planet) if nodes: # add node entries calcs = swisseph.calc_ut(day, swisseph.TRUE_NODE) hom = swisseph.house_pos(asmc[2], observer.lat, obliquity, calcs[0], objlat=calcs[1]) zm = ActiveZodiacalMeasurement(calcs[0], calcs[1], houses[int(hom - 1)], progress=hom % 1.0) retrograde = "Always" planet = Planet("North Node", prefix=prefix, m=zm, retrograde=retrograde) entries.append(planet) # do some trickery to display the South Node reverse = swisseph.degnorm(calcs[0] + 180.0) revhouse = (int(hom) + 6) % 12 # revprogress = 1-hom%1.0 revprogress = hom % 1.0 zm = ActiveZodiacalMeasurement(reverse, calcs[1], houses[revhouse - 1], progress=revprogress) planet = Planet("South Node", prefix=prefix, m=zm, retrograde=retrograde) entries.append(planet) if axes: ascendant = asmc[0] descendant = cusps[6] mc = asmc[1] ic = cusps[3] retrograde = "Not a Planet" zm = ActiveZodiacalMeasurement(ascendant, 0.0, houses[0], progress=0.0) planet = Planet("Ascendant", prefix=prefix, m=zm, retrograde=retrograde) entries.append(planet) zm = ActiveZodiacalMeasurement(descendant, 0.0, houses[6], progress=0.0) planet = Planet("Descendant", prefix=prefix, m=zm, retrograde=retrograde) entries.append(planet) zm = ActiveZodiacalMeasurement(mc, 0.0, houses[9], progress=0.0) planet = Planet("MC", prefix=prefix, m=zm, retrograde=retrograde) entries.append(planet) zm = ActiveZodiacalMeasurement(ic, 0.0, houses[3], progress=0.0) planet = Planet("IC", prefix=prefix, m=zm, retrograde=retrograde) entries.append(planet) # if stars: # print "Todo" swisseph.close() return houses, entries