def __init__(self, pchrts, step12, rownum): self.dates = [] y = pchrts[0][1] + rownum m = pchrts[0][2] d = pchrts[0][3] if (not util.checkDate(y, m, d)): y, m, d = util.incrDay(y, m, d) #calc dat = (y, m, d) self.dates.append(dat) idx = 12 mon = 30.4368492 if not step12: idx = 13 mon = 28.0955531 calflag = astrology.SE_GREG_CAL if pchrts[0][0].time.cal == chart.Time.JULIAN: calflag = astrology.SE_JUL_CAL jdval = astrology.swe_julday(y, m, d, pchrts[0][0].time.time, calflag) for i in range(idx - 1): jdval += mon jy, jm, jd, jh = astrology.swe_revjul(jdval, calflag) # d, m, s = util.decToDeg(jh) dat = (jy, jm, jd) self.dates.append(dat)
def __init__(self, pchrts, step12, rownum): self.dates = [] y = pchrts[0][1] + rownum m = pchrts[0][2] d = pchrts[0][3] if not util.checkDate(y, m, d): y, m, d = util.incrDay(y, m, d) # calc dat = (y, m, d) self.dates.append(dat) idx = 12 mon = 30.4368492 if not step12: idx = 13 mon = 28.0955531 calflag = astrology.SE_GREG_CAL if pchrts[0][0].time.cal == chart.Time.JULIAN: calflag = astrology.SE_JUL_CAL jdval = astrology.swe_julday(y, m, d, pchrts[0][0].time.time, calflag) for i in range(idx - 1): jdval += mon jy, jm, jd, jh = astrology.swe_revjul(jdval, calflag) # d, m, s = util.decToDeg(jh) dat = (jy, jm, jd) self.dates.append(dat)
def calcTimes(self): #the date we get from julianday is the same as year, month day in Time-class but we didn't pass it to the init function. oyear, omonth, oday, otim = astrology.swe_revjul(self.jd, self.calflag) numangles = len(RiseSet.Angles) for i in range(planets.Planets.PLANETS_NUM):#Nodes are excluded ar = [] #Rise ret, JDRise, serr = astrology.swe_rise_trans(self.jd, i, "", astrology.SEFLG_SWIEPH, RiseSet.Angles[RiseSet.RISE], self.lon, self.lat, self.alt, 0.0, 10.0) tyear, tmonth, tday, ttim = astrology.swe_revjul(JDRise, self.calflag) if oyear != tyear or omonth != tmonth or oday != tday: ret, JDRise, serr = astrology.swe_rise_trans(self.jd-1.0, i, "", astrology.SEFLG_SWIEPH, RiseSet.Angles[RiseSet.RISE], self.lon, self.lat, self.alt, 0.0, 10.0) #MC ret, JDMC, serr = astrology.swe_rise_trans(self.jd, i, "", astrology.SEFLG_SWIEPH, RiseSet.Angles[RiseSet.MC], self.lon, self.lat, self.alt, 0.0, 10.0) tyear, tmonth, tday, ttim = astrology.swe_revjul(JDMC, self.calflag) if oyear != tyear or omonth != tmonth or oday != tday: ret, JDMC, serr = astrology.swe_rise_trans(self.jd-1.0, i, "", astrology.SEFLG_SWIEPH, RiseSet.Angles[RiseSet.MC], self.lon, self.lat, self.alt, 0.0, 10.0) #Set ret, JDSet, serr = astrology.swe_rise_trans(self.jd, i, "", astrology.SEFLG_SWIEPH, RiseSet.Angles[RiseSet.SET], self.lon, self.lat, self.alt, 0.0, 10.0) tyear, tmonth, tday, ttim = astrology.swe_revjul(JDSet, self.calflag) if oyear != tyear or omonth != tmonth or oday != tday: ret, JDSet, serr = astrology.swe_rise_trans(self.jd-1.0, i, "", astrology.SEFLG_SWIEPH, RiseSet.Angles[RiseSet.SET], self.lon, self.lat, self.alt, 0.0, 10.0) #IC ret, JDIC, serr = astrology.swe_rise_trans(self.jd, i, "", astrology.SEFLG_SWIEPH, RiseSet.Angles[RiseSet.IC], self.lon, self.lat, self.alt, 0.0, 10.0) tyear, tmonth, tday, ttim = astrology.swe_revjul(JDIC, self.calflag) if oyear != tyear or omonth != tmonth or oday != tday: ret, JDIC, serr = astrology.swe_rise_trans(self.jd-1.0, i, "", astrology.SEFLG_SWIEPH, RiseSet.Angles[RiseSet.IC], self.lon, self.lat, self.alt, 0.0, 10.0) #From GMT to Local # JDRise += self.offs year, month, day, hr = astrology.swe_revjul(JDRise, self.calflag) ar.append(hr) # JDMC += self.offs year, month, day, hr = astrology.swe_revjul(JDMC, self.calflag) ar.append(hr) # JDSet += self.offs year, month, day, hr = astrology.swe_revjul(JDSet, self.calflag) ar.append(hr) # JDIC += self.offs year, month, day, hr = astrology.swe_revjul(JDIC, self.calflag) ar.append(hr) self.times.append(ar)
def __init__(self, radix, da): placelon = radix.place.lon placelat = radix.place.lat #negative on SH? # calflag = astrology.SE_GREG_CAL # if radix.time.cal == chart.Time.JULIAN: # calflag = astrology.SE_JUL_CAL jdN = radix.time.jd #astrology.swe_julday(y, m, d, t, calflag) ramc = radix.houses.ascmc2[houses.Houses.MC][houses.Houses.RA] declAsc = radix.houses.ascmc2[houses.Houses.ASC][houses.Houses.DECL] oaAsc = util.normalize(ramc + 90.0) val = math.tan(math.radians(declAsc)) * math.tan( math.radians(placelat)) adlatAsc = 0.0 if math.fabs(val) <= 1.0: adlatAsc = math.degrees(math.asin(val)) dsalatAsc = 90.0 + adlatAsc nsalatAsc = 90.0 - adlatAsc dhlatAsc = dsalatAsc / 3.0 #diurnal house nhlatAsc = nsalatAsc / 3.0 #nocturnal house deltaSdT = 240.0 * da #in sec # t1 = int(deltaSdT/3600.0) # t2 = deltaSdT-t1*3600.0 # t2 = int(t2/60.0) # t3 = deltaSdT-(t1*3600.0+t2*60.0) # print 'deltaSdT=%f' % deltaSdT # print 'deltaSdT=%02d:%02d:%02d' % (t1, t2, t3) deltaSrT = 0.9972695664 * deltaSdT #sec # t1 = int(deltaSrT/3600.0) # t2 = deltaSrT-t1*3600.0 # t2 = int(t2/60.0) # t3 = deltaSrT-(t1*3600.0+t2*60.0) # print 'deltaSrT=%f' % deltaSrT # print 'deltaSrT=%02d:%02d:%02d' % (t1, t2, t3) jdZ = jdN + deltaSrT / 86400.0 # print 'jdZ=%f' % jdZ self.yz, self.mz, self.dz, self.tz = astrology.swe_revjul( jdZ, 1) #cast a chart with this date and time for the natal place
def __init__(self, radix, da): placelon = radix.place.lon placelat = radix.place.lat #negative on SH? # calflag = astrology.SE_GREG_CAL # if radix.time.cal == chart.Time.JULIAN: # calflag = astrology.SE_JUL_CAL jdN = radix.time.jd #astrology.swe_julday(y, m, d, t, calflag) ramc = radix.houses.ascmc2[houses.Houses.MC][houses.Houses.RA] declAsc = radix.houses.ascmc2[houses.Houses.ASC][houses.Houses.DECL] oaAsc = util.normalize(ramc+90.0) val = math.tan(math.radians(declAsc))*math.tan(math.radians(placelat)) adlatAsc = 0.0 if math.fabs(val) <= 1.0: adlatAsc = math.degrees(math.asin(val)) dsalatAsc = 90.0+adlatAsc nsalatAsc = 90.0-adlatAsc dhlatAsc = dsalatAsc/3.0 #diurnal house nhlatAsc = nsalatAsc/3.0 #nocturnal house deltaSdT = 240.0*da #in sec # t1 = int(deltaSdT/3600.0) # t2 = deltaSdT-t1*3600.0 # t2 = int(t2/60.0) # t3 = deltaSdT-(t1*3600.0+t2*60.0) # print 'deltaSdT=%f' % deltaSdT # print 'deltaSdT=%02d:%02d:%02d' % (t1, t2, t3) deltaSrT = 0.9972695664*deltaSdT #sec # t1 = int(deltaSrT/3600.0) # t2 = deltaSrT-t1*3600.0 # t2 = int(t2/60.0) # t3 = deltaSrT-(t1*3600.0+t2*60.0) # print 'deltaSrT=%f' % deltaSrT # print 'deltaSrT=%02d:%02d:%02d' % (t1, t2, t3) jdZ = jdN+deltaSrT/86400.0 # print 'jdZ=%f' % jdZ self.yz, self.mz, self.dz, self.tz = astrology.swe_revjul(jdZ, 1) #cast a chart with this date and time for the natal place
def onShowBtn(self, event): if (self.Validate() and self.sdate.Validate()): if util.checkDate(int(self.year.GetValue()), int(self.month.GetValue()), int(self.day.GetValue())): arc = 0.0 date = 2000.5 direct = self.positiverb.GetValue() if (self.arcrb.GetValue()): arc = float(self.da.GetValue()) jd, age = self.calcTime(arc, direct) y, m, d, h = astrology.swe_revjul(jd, 1) ho, mi, se = util.decToDeg(h) self.year.SetValue(str(y)) self.month.SetValue(str(m)) self.day.SetValue(str(d)) self.hour.SetValue(str(ho)) self.minute.SetValue(str(mi)) self.second.SetValue(str(se)) else: y = int(self.year.GetValue()) m = int(self.month.GetValue()) d = int(self.day.GetValue()) ho = int(self.hour.GetValue()) mi = int(self.minute.GetValue()) se = int(self.second.GetValue()) t = float(ho)+float(mi)/60.0+float(se)/3600.0 calflag = astrology.SE_GREG_CAL if self.chart.time.cal == chart.Time.JULIAN: calflag = astrology.SE_JUL_CAL jd = astrology.swe_julday(y, m, d, t, calflag) if self.chart.time.jd >= jd: dlgm = wx.MessageDialog(None, mtexts.txts['TimeSmallerThanBirthTime'], mtexts.txts['Error'], wx.OK|wx.ICON_EXCLAMATION) dlgm.ShowModal() dlgm.Destroy() return False arc = self.calcArc(jd, direct) self.da.SetValue(str(arc)) da = arc if not direct: da *= -1 pdinch = pdsinchart.PDsInChart(self.chart, da) #self.yz, mz, dz, tz ==> chart pdh, pdm, pds = util.decToDeg(pdinch.tz) cal = chart.Time.GREGORIAN if self.chart.time.cal == chart.Time.JULIAN: cal = chart.Time.JULIAN tim = chart.Time(pdinch.yz, pdinch.mz, pdinch.dz, pdh, pdm, pds, self.chart.time.bc, cal, chart.Time.GREENWICH, True, 0, 0, False, self.chart.place, False) if not self.terrestrial: if self.options.pdincharttyp == pdsinchartdlgopts.PDsInChartsDlgOpts.FROMMUNDANEPOS: pdchart = chart.Chart(self.chart.name, self.chart.male, tim, self.chart.place, chart.Chart.PDINCHART, '', self.options, False)#, proftype, nolat) pdchartpls = chart.Chart(self.chart.name, self.chart.male, self.chart.time, self.chart.place, chart.Chart.PDINCHART, '', self.options, False) #modify planets ... if self.options.primarydir == primdirs.PrimDirs.PLACIDIANSEMIARC or self.options.primarydir == primdirs.PrimDirs.PLACIDIANUNDERTHEPOLE: pdchart.planets.calcMundaneProfPos(pdchart.houses.ascmc2, pdchartpls.planets.planets, self.chart.place.lat, self.chart.obl[0]) else: pdchart.houses = houses.Houses(tim.jd, 0, pdchart.place.lat, pdchart.place.lon, 'R', pdchart.obl[0], self.options.ayanamsha, pdchart.ayanamsha) pdchart.planets.calcRegioPDsInChartsPos(pdchart.houses.ascmc2, pdchartpls.planets.planets, self.chart.place.lat, self.chart.obl[0]) #modify lof if self.options.primarydir == primdirs.PrimDirs.PLACIDIANSEMIARC or self.options.primarydir == primdirs.PrimDirs.PLACIDIANUNDERTHEPOLE: pdchart.fortune.calcMundaneProfPos(pdchart.houses.ascmc2, pdchartpls.fortune, self.chart.place.lat, self.chart.obl[0]) else: pdchart.fortune.calcRegioPDsInChartsPos(pdchart.houses.ascmc2, pdchartpls.fortune, self.chart.place.lat, self.chart.obl[0]) elif self.options.pdincharttyp == pdsinchartdlgopts.PDsInChartsDlgOpts.FROMZODIACALPOS: pdchart = chart.Chart(self.chart.name, self.chart.male, tim, self.chart.place, chart.Chart.PDINCHART, '', self.options, False, chart.Chart.YEAR, True) pdchartpls = chart.Chart(self.chart.name, self.chart.male, self.chart.time, self.chart.place, chart.Chart.PDINCHART, '', self.options, False, chart.Chart.YEAR, True) #modify planets ... if self.options.primarydir == primdirs.PrimDirs.PLACIDIANSEMIARC or self.options.primarydir == primdirs.PrimDirs.PLACIDIANUNDERTHEPOLE: pdchart.planets.calcMundaneProfPos(pdchart.houses.ascmc2, pdchartpls.planets.planets, self.chart.place.lat, self.chart.obl[0]) else: pdchart.houses = houses.Houses(tim.jd, 0, pdchart.place.lat, pdchart.place.lon, 'R', pdchart.obl[0], self.options.ayanamsha, pdchart.ayanamsha) pdchart.planets.calcRegioPDsInChartsPos(pdchart.houses.ascmc2, pdchartpls.planets.planets, self.chart.place.lat, self.chart.obl[0]) #modify lof if self.options.primarydir == primdirs.PrimDirs.PLACIDIANSEMIARC or self.options.primarydir == primdirs.PrimDirs.PLACIDIANUNDERTHEPOLE: pdchart.fortune.calcMundaneProfPos(pdchart.houses.ascmc2, pdchartpls.fortune, self.chart.place.lat, self.chart.obl[0]) else: pdchart.fortune.calcRegioPDsInChartsPos(pdchart.houses.ascmc2, pdchartpls.fortune, self.chart.place.lat, self.chart.obl[0]) else:#Full Astronomical Procedure pdchart = chart.Chart(self.chart.name, self.chart.male, tim, self.chart.place, chart.Chart.PDINCHART, '', self.options, False)#, proftype, nolat) pdchartpls = chart.Chart(self.chart.name, self.chart.male, self.chart.time, self.chart.place, chart.Chart.PDINCHART, '', self.options, False) pdpls = pdchartpls.planets.planets if self.options.pdinchartsecmotion: pdpls = pdchart.planets.planets raequasc, declequasc, dist = astrology.swe_cotrans(pdchart.houses.ascmc[houses.Houses.EQUASC], 0.0, 1.0, -self.chart.obl[0]) pdchart.planets.calcFullAstronomicalProc(da, self.chart.obl[0], pdpls, pdchart.place.lat, pdchart.houses.ascmc2, raequasc) #planets pdchart.fortune.calcFullAstronomicalProc(pdchartpls.fortune, da, self.chart.obl[0]) else: if self.options.pdinchartterrsecmotion: pdchart = chart.Chart(self.chart.name, self.chart.male, tim, self.chart.place, chart.Chart.PDINCHART, '', self.options, False)#, proftype, nolat) else: pdchart = chart.Chart(self.chart.name, self.chart.male, self.chart.time, self.chart.place, chart.Chart.PDINCHART, '', self.options, False)#, proftype, nolat) raequasc, declequasc, dist = astrology.swe_cotrans(pdchart.houses.ascmc[houses.Houses.EQUASC], 0.0, 1.0, -self.chart.obl[0]) pdchart.planets.calcMundaneWithoutSM(da, self.chart.obl[0], pdchart.place.lat, pdchart.houses.ascmc2, raequasc) pdchart.fortune.recalcForMundaneChart(self.chart.fortune.fortune[fortune.Fortune.LON], self.chart.fortune.fortune[fortune.Fortune.LAT], self.chart.fortune.fortune[fortune.Fortune.RA], self.chart.fortune.fortune[fortune.Fortune.DECL], pdchart.houses.ascmc2, pdchart.raequasc, pdchart.obl[0], pdchart.place.lat) keytxt = mtexts.typeListDyn[self.options.pdkeyd] if not self.options.pdkeydyn: keytxt = mtexts.typeListStat[self.options.pdkeys] txtdir = mtexts.txts['D'] if not direct: txtdir = mtexts.txts['C'] self.parent.change(pdchart, y, m, d, ho, mi, se, mtexts.typeListDirs[self.options.primarydir], keytxt, txtdir, math.fabs(da)) else: dlgm = wx.MessageDialog(None, mtexts.txts['InvalidDate']+' ('+self.year.GetValue()+'.'+self.month.GetValue()+'.'+self.day.GetValue()+'.)', mtexts.txts['Error'], wx.OK|wx.ICON_EXCLAMATION) dlgm.ShowModal() dlgm.Destroy()
def logCalc(self, tjd): #in GMT! jy, jm, jd, jh = astrology.swe_revjul(tjd, 1) d, m, s = util.decToDeg(jh) print 'GMT: %d.%d.%d %d:%d:%d' % (jy,jm,jd, d, m, s)
def revTime(self, tjd): jy, jm, jd, jh = astrology.swe_revjul(tjd, 1) d, m, s = util.decToDeg(jh) return (d, m, s)
def drawline(self, draw, x, y, idx, clr): #bottom horizontal line draw.line((x, y+self.LINE_HEIGHT, x+self.TABLE_WIDTH, y+self.LINE_HEIGHT), fill=clr) #vertical lines and PD offs = (0, self.SMALL_CELL_WIDTH, self.CELL_WIDTH, self.SMALL_CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH, self.BIG_CELL_WIDTH) BOR = PrimDirsListWnd.BORDER summa = 0 txtclr = self.options.clrtexts if self.bw: txtclr = (0,0,0) for i in range(self.COLUMN_NUM+1): draw.line((x+summa+offs[i], y, x+summa+offs[i], y+self.LINE_HEIGHT), fill=clr) #pd if i == 1:#M/Z mtxt = mtexts.txts['M'] if not self.pds.pds[idx].mundane: mtxt = mtexts.txts['Z'] w,h = draw.textsize(mtxt, self.fntText) draw.text((x+summa+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), mtxt, fill=txtclr, font=self.fntText) elif i == 2:#Prom if self.pds.pds[idx].promasp == chart.Chart.MIDPOINT or self.pds.pds[idx].sigasp == chart.Chart.RAPTPAR or self.pds.pds[idx].sigasp == chart.Chart.RAPTCONTRAPAR: promtxt = common.common.Planets[self.pds.pds[idx].prom] prom2txt = common.common.Planets[self.pds.pds[idx].prom2] wp,hp = draw.textsize(promtxt, self.fntMorinus) wsp,hsp = draw.textsize(' ', self.fntText) wp2,hp2 = draw.textsize(prom2txt, self.fntMorinus) offset = (offs[i]-(wp+wsp+wp2))/2 tclr = (0,0,0) if not self.bw: if self.options.useplanetcolors: objidx = self.pds.pds[idx].prom if objidx > astrology.SE_MEAN_NODE: objidx = astrology.SE_MEAN_NODE tclr = self.options.clrindividual[objidx] else: tclr = self.clrs[self.chart.dignity(self.pds.pds[idx].prom)] draw.text((x+summa+offset, y+(self.LINE_HEIGHT-hp)/2), promtxt, fill=tclr, font=self.fntMorinus) tclr = (0,0,0) if not self.bw: if self.options.useplanetcolors: objidx = self.pds.pds[idx].prom2 if objidx > astrology.SE_MEAN_NODE: objidx = astrology.SE_MEAN_NODE tclr = self.options.clrindividual[objidx] else: tclr = self.clrs[self.chart.dignity(self.pds.pds[idx].prom2)] draw.text((x+summa+offset+wp+wsp, y+(self.LINE_HEIGHT-hp2)/2), prom2txt, fill=tclr, font=self.fntMorinus) elif self.pds.pds[idx].prom >= primdirs.PrimDir.ANTISCION and self.pds.pds[idx].prom < primdirs.PrimDir.TERM: promasptxt = '' wspa = 0 wsp,hsp = draw.textsize(' ', self.fntText) if self.pds.pds[idx].promasp != chart.Chart.CONJUNCTIO: promasptxt += common.common.Aspects[self.pds.pds[idx].promasp] wspa = wsp wa,ha = draw.textsize(promasptxt, self.fntAspects) anttxt = mtexts.txts['Antis'] if self.pds.pds[idx].prom >= primdirs.PrimDir.CONTRAANT: anttxt = mtexts.txts['ContraAntis'] wt,ht = draw.textsize(anttxt, self.fntText) promtxt = '' promfnt = None antoffs = 0 tclr = (0,0,0) if self.pds.pds[idx].prom == primdirs.PrimDir.ANTISCIONLOF or self.pds.pds[idx].prom == primdirs.PrimDir.CONTRAANTLOF: promtxt = common.common.fortune promfnt = self.fntMorinus if not self.bw: if self.options.useplanetcolors: tclr = self.options.clrindividual[astrology.SE_MEAN_NODE+1] else: tclr = self.options.clrperegrin elif self.pds.pds[idx].prom == primdirs.PrimDir.ANTISCIONASC or self.pds.pds[idx].prom == primdirs.PrimDir.CONTRAANTASC: promtxt = mtexts.txts['Asc'] promfnt = self.fntText if not self.bw: tclr = txtclr elif self.pds.pds[idx].prom == primdirs.PrimDir.ANTISCIONMC or self.pds.pds[idx].prom == primdirs.PrimDir.CONTRAANTMC: promtxt = mtexts.txts['MC'] promfnt = self.fntText if not self.bw: tclr = txtclr else: antoffs = primdirs.PrimDir.ANTISCION if self.pds.pds[idx].prom >= primdirs.PrimDir.CONTRAANT: antoffs = primdirs.PrimDir.CONTRAANT promtxt = common.common.Planets[self.pds.pds[idx].prom-antoffs] promfnt = self.fntMorinus if not self.bw: if self.options.useplanetcolors: objidx = self.pds.pds[idx].prom-antoffs if objidx == astrology.SE_MEAN_NODE+1: objidx = astrology.SE_MEAN_NODE elif objidx > astrology.SE_MEAN_NODE+1: objidx = astrology.SE_MEAN_NODE+1 tclr = self.options.clrindividual[objidx] else: tclr = self.clrs[self.chart.dignity(self.pds.pds[idx].prom-antoffs)] wp,hp = draw.textsize(promtxt, promfnt) offset = (offs[i]-(wa+wspa+wt+wsp+wp))/2 if promasptxt != '': clrasp = (0,0,0) if not self.bw: if self.pds.pds[idx].promasp == chart.Chart.PARALLEL or self.pds.pds[idx].promasp == chart.Chart.CONTRAPARALLEL: clrasp = self.options.clrperegrin else: clrasp = self.options.clraspect[self.pds.pds[idx].promasp] draw.text((x+summa+offset, y+(self.LINE_HEIGHT-ha)/2), promasptxt, fill=clrasp, font=self.fntAspects) draw.text((x+summa+offset+wa+wspa, y+(self.LINE_HEIGHT-ht)/2), anttxt, fill=txtclr, font=self.fntText) draw.text((x+summa+offset+wa+wspa+wt+wsp, y+(self.LINE_HEIGHT-hp)/2), promtxt, fill=tclr, font=promfnt) elif self.pds.pds[idx].prom >= primdirs.PrimDir.TERM and self.pds.pds[idx].prom < primdirs.PrimDir.FIXSTAR: signs = common.common.Signs1 if not self.options.signs: signs = common.common.Signs2 promtxt = signs[self.pds.pds[idx].prom-primdirs.PrimDir.TERM] prom2txt = common.common.Planets[self.pds.pds[idx].prom2] wp,hp = draw.textsize(promtxt, self.fntMorinus) wsp,hsp = draw.textsize(' ', self.fntText) wp2,hp2 = draw.textsize(prom2txt, self.fntMorinus) offset = (offs[i]-(wp+wsp+wp2))/2 sclr = (0,0,0) if not self.bw: sclr = self.options.clrsigns draw.text((x+summa+offset, y+(self.LINE_HEIGHT-hp)/2), promtxt, fill=sclr, font=self.fntMorinus) tclr = (0,0,0) if not self.bw: if self.options.useplanetcolors: objidx = self.pds.pds[idx].prom2 if objidx > astrology.SE_MEAN_NODE: objidx = astrology.SE_MEAN_NODE tclr = self.options.clrindividual[objidx] else: tclr = self.clrs[self.chart.dignity(self.pds.pds[idx].prom2)] draw.text((x+summa+offset+wp+wsp, y+(self.LINE_HEIGHT-hp2)/2), prom2txt, fill=tclr, font=self.fntMorinus) elif self.pds.pds[idx].prom >= primdirs.PrimDir.FIXSTAR: promtxt = self.chart.fixstars.data[self.pds.pds[idx].prom-primdirs.PrimDir.FIXSTAR][fixstars.FixStars.NOMNAME] if self.options.usetradfixstarnamespdlist: tradname = self.chart.fixstars.data[self.pds.pds[idx].prom-primdirs.PrimDir.FIXSTAR][fixstars.FixStars.NAME].strip() if tradname != '': promtxt = tradname w,h = draw.textsize(promtxt, self.fntText) draw.text((x+summa+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), promtxt, fill=txtclr, font=self.fntText) elif self.pds.pds[idx].prom == primdirs.PrimDir.LOF: lofclr = (0,0,0) if not self.bw: if self.options.useplanetcolors: lofclr = self.options.clrindividual[astrology.SE_MEAN_NODE+1] else: lofclr = self.options.clrperegrin promtxt = common.common.fortune wp,hp = draw.textsize(promtxt, self.fntMorinus) offset = (offs[i]-wp)/2 draw.text((x+summa+offset, y+(self.LINE_HEIGHT-hp)/2), promtxt, fill=lofclr, font=self.fntMorinus) elif self.pds.pds[idx].prom == primdirs.PrimDir.CUSTOMERPD: promtxt = mtexts.txts['Customer2'] wp,hp = draw.textsize(promtxt, self.fntText) offset = (offs[i]-wp)/2 draw.text((x+summa+offset, y+(self.LINE_HEIGHT-hp)/2), promtxt, fill=txtclr, font=self.fntText) elif self.pds.pds[idx].prom == primdirs.PrimDir.ASC or self.pds.pds[idx].prom == primdirs.PrimDir.MC: promasptxt = '' if self.pds.pds[idx].promasp != chart.Chart.CONJUNCTIO: promasptxt += common.common.Aspects[self.pds.pds[idx].promasp] promtxt = mtexts.txts['Asc'] if self.pds.pds[idx].prom == primdirs.PrimDir.MC: promtxt = mtexts.txts['MC'] wa,ha = draw.textsize(promasptxt, self.fntAspects) wsp,hsp = draw.textsize(' ', self.fntText) ws,hs = draw.textsize(promtxt, self.fntText) offset = (offs[i]-(wa+wsp+ws))/2 clrasp = (0,0,0) if not self.bw: if self.pds.pds[idx].promasp == chart.Chart.PARALLEL or self.pds.pds[idx].promasp == chart.Chart.CONTRAPARALLEL: clrasp = self.options.clrperegrin else: clrasp = self.options.clraspect[self.pds.pds[idx].promasp] draw.text((x+summa+offset, y+(self.LINE_HEIGHT-ha)/2), promasptxt, fill=clrasp, font=self.fntAspects) draw.text((x+summa+offset+wa+wsp, y+(self.LINE_HEIGHT-hs)/2), promtxt, fill=txtclr, font=self.fntText) elif self.pds.pds[idx].prom >= primdirs.PrimDir.HC2 and self.pds.pds[idx].prom < primdirs.PrimDir.LOF:#Sig is HC HCs = (mtexts.txts['HC2'], mtexts.txts['HC3'], mtexts.txts['HC5'], mtexts.txts['HC6'], mtexts.txts['HC8'], mtexts.txts['HC9'], mtexts.txts['HC11'], mtexts.txts['HC12']) hctxt = HCs[self.pds.pds[idx].sig-primdirs.PrimDir.HC2] ws,hs = draw.textsize(hctxt, self.fntText) offset = (offs[i]-ws)/2 draw.text((x+summa+offset, y+(self.LINE_HEIGHT-hs)/2), hctxt, fill=txtclr, font=self.fntText) else: promtxt = common.common.Planets[self.pds.pds[idx].prom] promasptxt = '' if self.pds.pds[idx].promasp != chart.Chart.CONJUNCTIO: promasptxt += common.common.Aspects[self.pds.pds[idx].promasp] wp,hp = draw.textsize(promtxt, self.fntMorinus) wa,ha = draw.textsize(promasptxt, self.fntAspects) wsp,hsp = draw.textsize(' ', self.fntText) wspa = 0 if promasptxt != '': wspa = wsp offset = (offs[i]-(wa+wspa+wp+wsp))/2 tclr = (0,0,0) if promasptxt != '': clrasp = (0,0,0) if not self.bw: if self.pds.pds[idx].promasp == chart.Chart.PARALLEL or self.pds.pds[idx].promasp == chart.Chart.CONTRAPARALLEL: clrasp = self.options.clrperegrin else: clrasp = self.options.clraspect[self.pds.pds[idx].promasp] draw.text((x+summa+offset, y+(self.LINE_HEIGHT-ha)/2), promasptxt, fill=clrasp, font=self.fntAspects) if not self.bw: if self.options.useplanetcolors: objidx = self.pds.pds[idx].prom if objidx > astrology.SE_MEAN_NODE: objidx = astrology.SE_MEAN_NODE tclr = self.options.clrindividual[objidx] else: tclr = self.clrs[self.chart.dignity(self.pds.pds[idx].prom)] draw.text((x+summa+offset+wa+wspa, y+(self.LINE_HEIGHT-hp)/2), promtxt, fill=tclr, font=self.fntMorinus) elif i == 3:#D/C dirtxt = mtexts.txts['D'] if not self.pds.pds[idx].direct: dirtxt = mtexts.txts['C'] w,h = draw.textsize(dirtxt, self.fntText) wsp,hsp = draw.textsize(' ', self.fntText) warr,harr = draw.textsize('-', self.fntSymbol) offset = (offs[i]-(w+wsp+warr))/2 draw.text((x+summa+offset, y+(self.LINE_HEIGHT-h)/2), dirtxt, fill=txtclr, font=self.fntText) draw.text((x+summa+offset+w+wsp, y+(self.LINE_HEIGHT-harr)/2), '-', fill=txtclr, font=self.fntSymbol) elif i == 4:#Sig #AscMC(+asp), HC, Planet, Asp of a planet, parallel, contraparallel, raptparallel #Display aspect(conjuntio also!!) except for Asc,MC,HC if self.pds.pds[idx].sigasp == chart.Chart.PARALLEL or self.pds.pds[idx].sigasp == chart.Chart.CONTRAPARALLEL: #Par Sig(Asc,Desc,MC,IC) partxt = 'X' if self.pds.pds[idx].parallelaxis == 0 and self.pds.pds[idx].sigasp == chart.Chart.CONTRAPARALLEL: partxt = 'Y' wp,hp = draw.textsize(partxt, self.fntAspects) sigtxt = common.common.Planets[self.pds.pds[idx].sig] ws,hs = draw.textsize(sigtxt, self.fntMorinus) wsp,hsp = draw.textsize(' ', self.fntText) angles = ('('+mtexts.txts['Asc']+')', '('+mtexts.txts['Dsc']+')', '('+mtexts.txts['MC']+')', '('+mtexts.txts['IC']+')') angletxt = '' if self.pds.pds[idx].parallelaxis != 0: angletxt = angles[self.pds.pds[idx].parallelaxis-primdirs.PrimDir.OFFSANGLES] wa,ha = draw.textsize(angletxt, self.fntText) offset = (offs[i]-(wp+wsp+ws+wsp+wa))/2 pclr = (0,0,0) if not self.bw: pclr = self.options.clrperegrin draw.text((x+summa+offset, y+(self.LINE_HEIGHT-hp)/2), partxt, fill=pclr, font=self.fntAspects) tclr = (0,0,0) if not self.bw: if self.options.useplanetcolors: objidx = self.pds.pds[idx].sig if objidx > astrology.SE_MEAN_NODE: objidx = astrology.SE_MEAN_NODE tclr = self.options.clrindividual[objidx] else: tclr = self.clrs[self.chart.dignity(self.pds.pds[idx].sig)] draw.text((x+summa+offset+wp+wsp, y+(self.LINE_HEIGHT-hs)/2), sigtxt, fill=tclr, font=self.fntMorinus) draw.text((x+summa+offset+wp+wsp+ws+wsp, y+(self.LINE_HEIGHT-ha)/2), angletxt, fill=txtclr, font=self.fntText) elif self.pds.pds[idx].sigasp == chart.Chart.RAPTPAR or self.pds.pds[idx].sigasp == chart.Chart.RAPTCONTRAPAR: #R Par (Asc,Desc,MC,IC) rapttxt = 'R' partxt = 'X' wr,hr = draw.textsize(rapttxt, self.fntText) wp,hp = draw.textsize(partxt, self.fntAspects) wsp,hsp = draw.textsize(' ', self.fntText) angles = ('('+mtexts.txts['Asc']+')', '('+mtexts.txts['Dsc']+')', '('+mtexts.txts['MC']+')', '('+mtexts.txts['IC']+')') angletxt = angles[self.pds.pds[idx].parallelaxis-primdirs.PrimDir.OFFSANGLES] wa,ha = draw.textsize(angletxt, self.fntText) offset = (offs[i]-(wr+wp+wsp+wsp+wa))/2 draw.text((x+summa+offset, y+(self.LINE_HEIGHT-hr)/2), rapttxt, fill=txtclr, font=self.fntText) pclr = (0,0,0) if not self.bw: pclr = self.options.clrperegrin draw.text((x+summa+offset+wr, y+(self.LINE_HEIGHT-hp)/2), partxt, fill=pclr, font=self.fntAspects) draw.text((x+summa+offset+wr+wp+wsp, y+(self.LINE_HEIGHT-ha)/2), angletxt, fill=txtclr, font=self.fntText) elif self.pds.pds[idx].sig == primdirs.PrimDir.LOF: lofclr = (0,0,0) if not self.bw: if self.options.useplanetcolors: lofclr = self.options.clrindividual[astrology.SE_MEAN_NODE+1] else: lofclr = self.options.clrperegrin sigtxt = common.common.fortune wp,hp = draw.textsize(sigtxt, self.fntMorinus) extra = 0 offset = (offs[i]-(wp+extra))/2 if self.pds.pds[idx].mundane: sigasptxt = common.common.Aspects[self.pds.pds[idx].sigasp] wa,ha = draw.textsize(sigasptxt, self.fntAspects) wsp,hsp = draw.textsize(' ', self.fntText) extra = wa+wsp offset = (offs[i]-(wp+extra))/2 clrasp = (0,0,0) if not self.bw: clrasp = self.options.clraspect[self.pds.pds[idx].sigasp] draw.text((x+summa+offset, y+(self.LINE_HEIGHT-ha)/2), sigasptxt, fill=clrasp, font=self.fntAspects) draw.text((x+summa+offset+extra, y+(self.LINE_HEIGHT-hp)/2), sigtxt, fill=lofclr, font=self.fntMorinus) elif self.pds.pds[idx].sig == primdirs.PrimDir.SYZ: sigtxt = mtexts.txts['Syzygy'] wp,hp = draw.textsize(sigtxt, self.fntText) offset = (offs[i]-wp)/2 draw.text((x+summa+offset, y+(self.LINE_HEIGHT-hp)/2), sigtxt, fill=txtclr, font=self.fntText) elif self.pds.pds[idx].sig == primdirs.PrimDir.CUSTOMERPD: sigtxt = mtexts.txts['User2'] wp,hp = draw.textsize(sigtxt, self.fntText) offset = (offs[i]-wp)/2 draw.text((x+summa+offset, y+(self.LINE_HEIGHT-hp)/2), sigtxt, fill=txtclr, font=self.fntText) elif self.pds.pds[idx].sig >= primdirs.PrimDir.OFFSANGLES and self.pds.pds[idx].sig < primdirs.PrimDir.LOF:#Sig is Asc,MC or HC if self.pds.pds[idx].sig <= primdirs.PrimDir.IC: angles = (mtexts.txts['Asc'], mtexts.txts['Dsc'], mtexts.txts['MC'], mtexts.txts['IC']) anglestxt = angles[self.pds.pds[idx].sig-primdirs.PrimDir.OFFSANGLES] ws,hs = draw.textsize(anglestxt, self.fntText) offset = (offs[i]-ws)/2 draw.text((x+summa+offset, y+(self.LINE_HEIGHT-hs)/2), anglestxt, fill=txtclr, font=self.fntText) else: #=>HC HCs = (mtexts.txts['HC2'], mtexts.txts['HC3'], mtexts.txts['HC5'], mtexts.txts['HC6'], mtexts.txts['HC8'], mtexts.txts['HC9'], mtexts.txts['HC11'], mtexts.txts['HC12']) hctxt = HCs[self.pds.pds[idx].sig-primdirs.PrimDir.HC2] ws,hs = draw.textsize(hctxt, self.fntText) offset = (offs[i]-ws)/2 draw.text((x+summa+offset, y+(self.LINE_HEIGHT-hs)/2), hctxt, fill=txtclr, font=self.fntText) else:#interplanetary sigasptxt = '' if self.pds.pds[idx].sigasp != chart.Chart.CONJUNCTIO: sigasptxt = common.common.Aspects[self.pds.pds[idx].sigasp] wa,ha = draw.textsize(sigasptxt, self.fntAspects) wsp,hsp = draw.textsize(' ', self.fntText) wspa = 0 if sigasptxt != '': wspa = wsp sigtxt = common.common.Planets[self.pds.pds[idx].sig] ws,hs = draw.textsize(sigtxt, self.fntMorinus) offset = (offs[i]-(wa+wspa+ws))/2 clrasp = (0,0,0) if not self.bw: clrasp = self.options.clraspect[self.pds.pds[idx].sigasp] draw.text((x+summa+offset, y+(self.LINE_HEIGHT-ha)/2), sigasptxt, fill=clrasp, font=self.fntAspects) tclr = (0,0,0) if not self.bw: if self.options.useplanetcolors: objidx = self.pds.pds[idx].sig if objidx > astrology.SE_MEAN_NODE: objidx = astrology.SE_MEAN_NODE tclr = self.options.clrindividual[objidx] else: tclr = self.clrs[self.chart.dignity(self.pds.pds[idx].sig)] draw.text((x+summa+offset+wa+wspa, y+(self.LINE_HEIGHT-hs)/2), sigtxt, fill=tclr, font=self.fntMorinus) elif i == 5:#Arc arc = (int(self.pds.pds[idx].arc*1000))/1000.0 arctxt = str(arc) w,h = draw.textsize(arctxt, self.fntText) offset = (offs[i]-w)/2 draw.text((x+summa+offset, y+(self.LINE_HEIGHT-h)/2), arctxt, fill=txtclr, font=self.fntText) elif i == 6:#Date year, month, day, h = astrology.swe_revjul(self.pds.pds[idx].time, 1) # ho, mi, se = util.decToDeg(h) # year, month, day, extraday = util.revConvDate(self.pds.pds[idx].time) txt = (str(year)).rjust(4)+'.'+(str(month)).zfill(2)+'.'+(str(day)).zfill(2) w,h = draw.textsize(txt, self.fntText) offset = (offs[i]-w)/2 draw.text((x+summa+offset, y+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText) summa += offs[i]
def compute(self): y = self.chart.time.year m = self.chart.time.month d = self.chart.time.day hour = self.chart.time.hour minute = self.chart.time.minute second = self.chart.time.second hr = 0.0 #GMT to LocalMean t = (self.chart.place.deglon + self.chart.place.minlon / 60.0) * 4 #long * 4min meantime = 0.0 if self.chart.place.east: meantime = self.chart.time.time + t / 60.0 else: meantime = self.chart.time.time - t / 60.0 #check over/underflow HOURSPERDAY = 24.0 if meantime >= HOURSPERDAY: meantime -= HOURSPERDAY y, m, d = util.incrDay(y, m, d) elif meantime < 0.0: meantime += HOURSPERDAY y, m, d = util.decrDay(y, m, d) if self.soltime: calflag = astrology.SE_GREG_CAL if self.chart.time.cal == chart.Time.JULIAN: calflag = astrology.SE_JUL_CAL yt = y if self.chart.time.bc: yt = -y jdmean = astrology.swe_julday(yt, m, d, meantime, calflag) #Get jdapp ret, te, serr = astrology.swe_time_equ(jdmean) jdapp = jdmean - te y, m, d, hr = astrology.swe_revjul(jdapp, calflag) hour, minute, second = util.decToDeg(hr) # print '%d:%02d:%02d' % (hour,minute,second) else: hour, minute, second = util.decToDeg(meantime) for i in range(self.age): if self.direct: y, m, d = util.incrDay(y, m, d) else: y, m, d = util.decrDay(y, m, d) if self.soltime: #Back to meantime on the last day yt = y if self.chart.time.bc: yt = -y calflag = astrology.SE_GREG_CAL if self.chart.time.cal == chart.Time.JULIAN: calflag = astrology.SE_JUL_CAL jdapp = astrology.swe_julday(yt, m, d, hr, calflag) ret, te, serr = astrology.swe_time_equ(jdapp) jdmean = jdapp + te y, m, d, hr = astrology.swe_revjul(jdmean, calflag) hour, minute, second = util.decToDeg(hr) # print '%d:%02d:%02d' % (hour,minute,second) return y, m, d, hour, minute, second
def __init__(self, year, month, day, hour, minute, second, bc, cal, zt, plus, zh, zm, daylightsaving, place, full = True): #zt is zonetime, zh is zonehour, zm is zoneminute, full means to calculate everything e.g. FixedStars, MidPoints, ... self.year = year self.month = month self.day = day self.origyear = year self.origmonth = month self.origday = day self.hour = hour self.minute = minute self.second = second self.bc = bc self.cal = cal self.zt = zt self.plus = plus self.zh = zh self.zm = zm self.daylightsaving = daylightsaving self.time = hour+minute/60.0+second/3600.0 self.dyear, self.dmonth, self.dday, self.dhour, self.dmin, self.dsec = year, month, day, hour, minute, second if self.daylightsaving: self.time -= 1.0 self.dhour -= 1 #check daylightsaving underflow if self.time < 0.0: self.time += Time.HOURSPERDAY self.year, self.month, self.day = util.decrDay(self.year, self.month, self.day) self.dhour += int(Time.HOURSPERDAY) self.dyear, self.dmonth, self.dday = self.year, self.month, self.day if zt == Time.ZONE:#ZONE ztime = zh+zm/60.0 if self.plus: self.time-=ztime else: self.time+=ztime elif zt == Time.LOCALMEAN:#LMT t = (place.deglon+place.minlon/60.0)*4.0 #long * 4min if place.east: self.time-=t/60.0 else: self.time+=t/60.0 if bc: self.year = 1-self.year #check over/underflow if self.time >= Time.HOURSPERDAY: self.time -= Time.HOURSPERDAY self.year, self.month, self.day = util.incrDay(self.year, self.month, self.day) elif self.time < 0.0: self.time += Time.HOURSPERDAY self.year, self.month, self.day = util.decrDay(self.year, self.month, self.day) calflag = astrology.SE_GREG_CAL if self.cal == Time.JULIAN: calflag = astrology.SE_JUL_CAL self.jd = astrology.swe_julday(self.year, self.month, self.day, self.time, calflag) if zt == Time.LOCALAPPARENT:#LAT ret, te, serr = astrology.swe_time_equ(self.jd) self.jd += te #LMT #Back to h,m,s(self.time) from julianday fromat self.year, self.month, self.day, self.time = astrology.swe_revjul(self.jd, calflag) #To GMT t = (place.deglon+place.minlon/60.0)*4.0 #long * 4min if place.east: self.time-=t/60.0 else: self.time+=t/60.0 #check over/underflow if self.time >= Time.HOURSPERDAY: self.time -= Time.HOURSPERDAY self.year, self.month, self.day = util.incrDay(self.year, self.month, self.day) elif self.time < 0.0: self.time += Time.HOURSPERDAY self.year, self.month, self.day = util.decrDay(self.year, self.month, self.day) #GMT in JD (julianday) self.jd = astrology.swe_julday(self.year, self.month, self.day, self.time, calflag) self.sidTime = astrology.swe_sidtime(self.jd) #GMT self.ph = None if full: self.calcPHs(place) self.profy = None self.profm = None self.profd = None self.profho = None self.profmi = None self.profse = None
def onShowBtn(self, event): if (self.Validate() and self.sdate.Validate()): if util.checkDate(int(self.year.GetValue()), int(self.month.GetValue()), int(self.day.GetValue())): arc = 0.0 date = 2000.5 direct = self.positiverb.GetValue() if (self.arcrb.GetValue()): arc = float(self.da.GetValue()) jd, age = self.calcTime(arc, direct) y, m, d, h = astrology.swe_revjul(jd, 1) ho, mi, se = util.decToDeg(h) self.year.SetValue(str(y)) self.month.SetValue(str(m)) self.day.SetValue(str(d)) self.hour.SetValue(str(ho)) self.minute.SetValue(str(mi)) self.second.SetValue(str(se)) else: y = int(self.year.GetValue()) m = int(self.month.GetValue()) d = int(self.day.GetValue()) ho = int(self.hour.GetValue()) mi = int(self.minute.GetValue()) se = int(self.second.GetValue()) t = float(ho) + float(mi) / 60.0 + float(se) / 3600.0 calflag = astrology.SE_GREG_CAL if self.chart.time.cal == chart.Time.JULIAN: calflag = astrology.SE_JUL_CAL jd = astrology.swe_julday(y, m, d, t, calflag) if self.chart.time.jd >= jd: dlgm = wx.MessageDialog( None, mtexts.txts['TimeSmallerThanBirthTime'], mtexts.txts['Error'], wx.OK | wx.ICON_EXCLAMATION) dlgm.ShowModal() dlgm.Destroy() return False arc = self.calcArc(jd, direct) self.da.SetValue(str(arc)) da = arc if not direct: da *= -1 pdinch = pdsinchart.PDsInChart( self.chart, da) #self.yz, mz, dz, tz ==> chart pdh, pdm, pds = util.decToDeg(pdinch.tz) cal = chart.Time.GREGORIAN if self.chart.time.cal == chart.Time.JULIAN: cal = chart.Time.JULIAN tim = chart.Time(pdinch.yz, pdinch.mz, pdinch.dz, pdh, pdm, pds, self.chart.time.bc, cal, chart.Time.GREENWICH, True, 0, 0, False, self.chart.place, False) if not self.terrestrial: if self.options.pdincharttyp == pdsinchartdlgopts.PDsInChartsDlgOpts.FROMMUNDANEPOS: pdchart = chart.Chart(self.chart.name, self.chart.male, tim, self.chart.place, chart.Chart.PDINCHART, '', self.options, False) #, proftype, nolat) pdchartpls = chart.Chart(self.chart.name, self.chart.male, self.chart.time, self.chart.place, chart.Chart.PDINCHART, '', self.options, False) #modify planets ... if self.options.primarydir == primdirs.PrimDirs.PLACIDIANSEMIARC or self.options.primarydir == primdirs.PrimDirs.PLACIDIANUNDERTHEPOLE: pdchart.planets.calcMundaneProfPos( pdchart.houses.ascmc2, pdchartpls.planets.planets, self.chart.place.lat, self.chart.obl[0]) else: pdchart.houses = houses.Houses( tim.jd, 0, pdchart.place.lat, pdchart.place.lon, 'R', pdchart.obl[0], self.options.ayanamsha, pdchart.ayanamsha) pdchart.planets.calcRegioPDsInChartsPos( pdchart.houses.ascmc2, pdchartpls.planets.planets, self.chart.place.lat, self.chart.obl[0]) #modify lof if self.options.primarydir == primdirs.PrimDirs.PLACIDIANSEMIARC or self.options.primarydir == primdirs.PrimDirs.PLACIDIANUNDERTHEPOLE: pdchart.fortune.calcMundaneProfPos( pdchart.houses.ascmc2, pdchartpls.fortune, self.chart.place.lat, self.chart.obl[0]) else: pdchart.fortune.calcRegioPDsInChartsPos( pdchart.houses.ascmc2, pdchartpls.fortune, self.chart.place.lat, self.chart.obl[0]) elif self.options.pdincharttyp == pdsinchartdlgopts.PDsInChartsDlgOpts.FROMZODIACALPOS: pdchart = chart.Chart(self.chart.name, self.chart.male, tim, self.chart.place, chart.Chart.PDINCHART, '', self.options, False, chart.Chart.YEAR, True) pdchartpls = chart.Chart( self.chart.name, self.chart.male, self.chart.time, self.chart.place, chart.Chart.PDINCHART, '', self.options, False, chart.Chart.YEAR, True) #modify planets ... if self.options.primarydir == primdirs.PrimDirs.PLACIDIANSEMIARC or self.options.primarydir == primdirs.PrimDirs.PLACIDIANUNDERTHEPOLE: pdchart.planets.calcMundaneProfPos( pdchart.houses.ascmc2, pdchartpls.planets.planets, self.chart.place.lat, self.chart.obl[0]) else: pdchart.houses = houses.Houses( tim.jd, 0, pdchart.place.lat, pdchart.place.lon, 'R', pdchart.obl[0], self.options.ayanamsha, pdchart.ayanamsha) pdchart.planets.calcRegioPDsInChartsPos( pdchart.houses.ascmc2, pdchartpls.planets.planets, self.chart.place.lat, self.chart.obl[0]) #modify lof if self.options.primarydir == primdirs.PrimDirs.PLACIDIANSEMIARC or self.options.primarydir == primdirs.PrimDirs.PLACIDIANUNDERTHEPOLE: pdchart.fortune.calcMundaneProfPos( pdchart.houses.ascmc2, pdchartpls.fortune, self.chart.place.lat, self.chart.obl[0]) else: pdchart.fortune.calcRegioPDsInChartsPos( pdchart.houses.ascmc2, pdchartpls.fortune, self.chart.place.lat, self.chart.obl[0]) else: #Full Astronomical Procedure pdchart = chart.Chart(self.chart.name, self.chart.male, tim, self.chart.place, chart.Chart.PDINCHART, '', self.options, False) #, proftype, nolat) pdchartpls = chart.Chart(self.chart.name, self.chart.male, self.chart.time, self.chart.place, chart.Chart.PDINCHART, '', self.options, False) pdpls = pdchartpls.planets.planets if self.options.pdinchartsecmotion: pdpls = pdchart.planets.planets raequasc, declequasc, dist = astrology.swe_cotrans( pdchart.houses.ascmc[houses.Houses.EQUASC], 0.0, 1.0, -self.chart.obl[0]) pdchart.planets.calcFullAstronomicalProc( da, self.chart.obl[0], pdpls, pdchart.place.lat, pdchart.houses.ascmc2, raequasc) #planets pdchart.fortune.calcFullAstronomicalProc( pdchartpls.fortune, da, self.chart.obl[0]) else: if self.options.pdinchartterrsecmotion: pdchart = chart.Chart(self.chart.name, self.chart.male, tim, self.chart.place, chart.Chart.PDINCHART, '', self.options, False) #, proftype, nolat) else: pdchart = chart.Chart(self.chart.name, self.chart.male, self.chart.time, self.chart.place, chart.Chart.PDINCHART, '', self.options, False) #, proftype, nolat) raequasc, declequasc, dist = astrology.swe_cotrans( pdchart.houses.ascmc[houses.Houses.EQUASC], 0.0, 1.0, -self.chart.obl[0]) pdchart.planets.calcMundaneWithoutSM( da, self.chart.obl[0], pdchart.place.lat, pdchart.houses.ascmc2, raequasc) pdchart.fortune.recalcForMundaneChart( self.chart.fortune.fortune[fortune.Fortune.LON], self.chart.fortune.fortune[fortune.Fortune.LAT], self.chart.fortune.fortune[fortune.Fortune.RA], self.chart.fortune.fortune[fortune.Fortune.DECL], pdchart.houses.ascmc2, pdchart.raequasc, pdchart.obl[0], pdchart.place.lat) keytxt = mtexts.typeListDyn[self.options.pdkeyd] if not self.options.pdkeydyn: keytxt = mtexts.typeListStat[self.options.pdkeys] txtdir = mtexts.txts['D'] if not direct: txtdir = mtexts.txts['C'] self.parent.change( pdchart, y, m, d, ho, mi, se, mtexts.typeListDirs[self.options.primarydir], keytxt, txtdir, math.fabs(da)) else: dlgm = wx.MessageDialog( None, mtexts.txts['InvalidDate'] + ' (' + self.year.GetValue() + '.' + self.month.GetValue() + '.' + self.day.GetValue() + '.)', mtexts.txts['Error'], wx.OK | wx.ICON_EXCLAMATION) dlgm.ShowModal() dlgm.Destroy()
def logCalc(self, tjd): #in GMT! jy, jm, jd, jh = astrology.swe_revjul(tjd, 1) d, m, s = util.decToDeg(jh) print 'GMT: %d.%d.%d %d:%d:%d' % (jy, jm, jd, d, m, s)
def compute(self): y = self.chart.time.year m = self.chart.time.month d = self.chart.time.day hour = self.chart.time.hour minute = self.chart.time.minute second = self.chart.time.second hr = 0.0 #GMT to LocalMean t = (self.chart.place.deglon+self.chart.place.minlon/60.0)*4 #long * 4min meantime = 0.0 if self.chart.place.east: meantime = self.chart.time.time+t/60.0 else: meantime = self.chart.time.time-t/60.0 #check over/underflow HOURSPERDAY = 24.0 if meantime >= HOURSPERDAY: meantime -= HOURSPERDAY y, m, d = util.incrDay(y, m, d) elif meantime < 0.0: meantime += HOURSPERDAY y, m, d = util.decrDay(y, m, d) if self.soltime: calflag = astrology.SE_GREG_CAL if self.chart.time.cal == chart.Time.JULIAN: calflag = astrology.SE_JUL_CAL yt = y if self.chart.time.bc: yt = -y jdmean = astrology.swe_julday(yt, m, d, meantime, calflag) #Get jdapp ret, te, serr = astrology.swe_time_equ(jdmean) jdapp = jdmean-te y, m, d, hr = astrology.swe_revjul(jdapp, calflag) hour,minute,second = util.decToDeg(hr) # print '%d:%02d:%02d' % (hour,minute,second) else: hour,minute,second = util.decToDeg(meantime) for i in range(self.age): if self.direct: y, m, d = util.incrDay(y, m, d) else: y, m, d = util.decrDay(y, m, d) if self.soltime: #Back to meantime on the last day yt = y if self.chart.time.bc: yt = -y calflag = astrology.SE_GREG_CAL if self.chart.time.cal == chart.Time.JULIAN: calflag = astrology.SE_JUL_CAL jdapp = astrology.swe_julday(yt, m, d, hr, calflag) ret, te, serr = astrology.swe_time_equ(jdapp) jdmean = jdapp+te y, m, d, hr = astrology.swe_revjul(jdmean, calflag) hour,minute,second = util.decToDeg(hr) # print '%d:%02d:%02d' % (hour,minute,second) return y, m, d, hour, minute, second
def calc(self, event, terrestrial): valid, pdnum = self.getPDNum(event) if valid: y, m, d, t = astrology.swe_revjul(self.pds.pds[pdnum].time, 1) ho, mi, se = util.decToDeg(t) da = self.pds.pds[pdnum].arc if not self.pds.pds[pdnum].direct: da *= -1 pdinch = pdsinchart.PDsInChart(self.chart, da) #self.yz, mz, dz, tz ==> chart pdh, pdm, pds = util.decToDeg(pdinch.tz) cal = chart.Time.GREGORIAN if self.chart.time.cal == chart.Time.JULIAN: cal = chart.Time.JULIAN tim = chart.Time(pdinch.yz, pdinch.mz, pdinch.dz, pdh, pdm, pds, self.chart.time.bc, cal, chart.Time.GREENWICH, True, 0, 0, False, self.chart.place, False) if not terrestrial: if self.options.pdincharttyp == pdsinchartdlgopts.PDsInChartsDlgOpts.FROMMUNDANEPOS: pdchart = chart.Chart(self.chart.name, self.chart.male, tim, self.chart.place, chart.Chart.PDINCHART, '', self.options, False)#, proftype, nolat) pdchartpls = chart.Chart(self.chart.name, self.chart.male, self.chart.time, self.chart.place, chart.Chart.PDINCHART, '', self.options, False) #modify planets ... if self.options.primarydir == primdirs.PrimDirs.PLACIDIANSEMIARC or self.options.primarydir == primdirs.PrimDirs.PLACIDIANUNDERTHEPOLE: pdchart.planets.calcMundaneProfPos(pdchart.houses.ascmc2, pdchartpls.planets.planets, self.chart.place.lat, self.chart.obl[0]) else: pdchart.houses = houses.Houses(tim.jd, 0, pdchart.place.lat, pdchart.place.lon, 'R', pdchart.obl[0], self.options.ayanamsha, pdchart.ayanamsha) pdchart.planets.calcRegioPDsInChartsPos(pdchart.houses.ascmc2, pdchartpls.planets.planets, self.chart.place.lat, self.chart.obl[0]) #modify lof if self.options.primarydir == primdirs.PrimDirs.PLACIDIANSEMIARC or self.options.primarydir == primdirs.PrimDirs.PLACIDIANUNDERTHEPOLE: pdchart.fortune.calcMundaneProfPos(pdchart.houses.ascmc2, pdchartpls.fortune, self.chart.place.lat, self.chart.obl[0]) else: pdchart.fortune.calcRegioPDsInChartsPos(pdchart.houses.ascmc2, pdchartpls.fortune, self.chart.place.lat, self.chart.obl[0]) elif self.options.pdincharttyp == pdsinchartdlgopts.PDsInChartsDlgOpts.FROMZODIACALPOS: pdchart = chart.Chart(self.chart.name, self.chart.male, tim, self.chart.place, chart.Chart.PDINCHART, '', self.options, False, chart.Chart.YEAR, True) pdchartpls = chart.Chart(self.chart.name, self.chart.male, self.chart.time, self.chart.place, chart.Chart.PDINCHART, '', self.options, False, chart.Chart.YEAR, True) #modify planets ... if self.options.primarydir == primdirs.PrimDirs.PLACIDIANSEMIARC or self.options.primarydir == primdirs.PrimDirs.PLACIDIANUNDERTHEPOLE: pdchart.planets.calcMundaneProfPos(pdchart.houses.ascmc2, pdchartpls.planets.planets, self.chart.place.lat, self.chart.obl[0]) else: pdchart.houses = houses.Houses(tim.jd, 0, pdchart.place.lat, pdchart.place.lon, 'R', pdchart.obl[0], self.options.ayanamsha, pdchart.ayanamsha) pdchart.planets.calcRegioPDsInChartsPos(pdchart.houses.ascmc2, pdchartpls.planets.planets, self.chart.place.lat, self.chart.obl[0]) #modify lof if self.options.primarydir == primdirs.PrimDirs.PLACIDIANSEMIARC or self.options.primarydir == primdirs.PrimDirs.PLACIDIANUNDERTHEPOLE: pdchart.fortune.calcMundaneProfPos(pdchart.houses.ascmc2, pdchartpls.fortune, self.chart.place.lat, self.chart.obl[0]) else: pdchart.fortune.calcRegioPDsInChartsPos(pdchart.houses.ascmc2, pdchartpls.fortune, self.chart.place.lat, self.chart.obl[0]) else:#Full Astronomical Procedure pdchart = chart.Chart(self.chart.name, self.chart.male, tim, self.chart.place, chart.Chart.PDINCHART, '', self.options, False)#, proftype, nolat) pdchartpls = chart.Chart(self.chart.name, self.chart.male, self.chart.time, self.chart.place, chart.Chart.PDINCHART, '', self.options, False) pdpls = pdchartpls.planets.planets if self.options.pdinchartsecmotion: pdpls = pdchart.planets.planets raequasc, declequasc, dist = astrology.swe_cotrans(pdchart.houses.ascmc[houses.Houses.EQUASC], 0.0, 1.0, -self.chart.obl[0]) pdchart.planets.calcFullAstronomicalProc(da, self.chart.obl[0], pdpls, pdchart.place.lat, pdchart.houses.ascmc2, raequasc) #planets pdchart.fortune.calcFullAstronomicalProc(pdchartpls.fortune, da, self.chart.obl[0]) else: if self.options.pdinchartterrsecmotion: pdchart = chart.Chart(self.chart.name, self.chart.male, tim, self.chart.place, chart.Chart.PDINCHART, '', self.options, False)#, proftype, nolat) else: pdchart = chart.Chart(self.chart.name, self.chart.male, self.chart.time, self.chart.place, chart.Chart.PDINCHART, '', self.options, False)#, proftype, nolat) raequasc, declequasc, dist = astrology.swe_cotrans(pdchart.houses.ascmc[houses.Houses.EQUASC], 0.0, 1.0, -self.chart.obl[0]) pdchart.planets.calcMundaneWithoutSM(da, self.chart.obl[0], pdchart.place.lat, pdchart.houses.ascmc2, raequasc) pdchart.fortune.recalcForMundaneChart(self.chart.fortune.fortune[fortune.Fortune.LON], self.chart.fortune.fortune[fortune.Fortune.LAT], self.chart.fortune.fortune[fortune.Fortune.RA], self.chart.fortune.fortune[fortune.Fortune.DECL], pdchart.houses.ascmc2, pdchart.raequasc, pdchart.obl[0], pdchart.place.lat) keytxt = mtexts.typeListDyn[self.options.pdkeyd] if not self.options.pdkeydyn: keytxt = mtexts.typeListStat[self.options.pdkeys] return True, y, m, d, ho, mi, se, t, mtexts.typeListDirs[self.options.primarydir], keytxt, self.pds.pds[pdnum].direct, math.fabs(da), pdchart else: return False, 2000, 1, 1, 1, 1, 1, 1.0, '', '', True, 0.0, None
def drawBkg(self): if self.bw: self.bkgclr = (255, 255, 255) else: self.bkgclr = self.options.clrbackground self.SetBackgroundColour(self.bkgclr) tableclr = self.options.clrtable if self.bw: tableclr = (0, 0, 0) img = Image.new('RGB', (self.WIDTH, self.HEIGHT), self.bkgclr) draw = ImageDraw.Draw(img) BOR = commonwnd.CommonWnd.BORDER txtclr = (0, 0, 0) if not self.bw: txtclr = self.options.clrtexts #Title draw.rectangle( ((BOR, BOR), (BOR + self.TITLE_WIDTH, BOR + self.TITLE_HEIGHT)), outline=(tableclr), fill=(self.bkgclr)) lon = self.chart.place.deglon + self.chart.place.minlon / 60.0 if not self.chart.place.east: lon *= -1 offs = lon * 4.0 / 1440.0 jdlocal = self.chart.time.jd + offs jy, jm, jd, jh = astrology.swe_revjul(jdlocal, 1) hh, mm, ss = util.decToDeg(jh) txt = mtexts.txts['LocalBirthTime'] + ': ' + str(hh) + ':' + str( mm).zfill(2) + ':' + str(ss).zfill(2) w, h = draw.textsize(txt, self.fntText) draw.text((BOR + (self.TITLE_WIDTH - w) / 2, BOR + (self.LINE_HEIGHT - h) / 2), txt, fill=txtclr, font=self.fntText) if self.chart.time.ph != None: rh, rm, rs = self.chart.time.ph.revTime( self.chart.time.ph.risetime) sh, sm, ss = self.chart.time.ph.revTime(self.chart.time.ph.settime) if self.chart.time.ph.daytime: txt1 = mtexts.txts['RiseTime'] + ': ' + str(rh) + ':' + str( rm).zfill(2) + ':' + str(rs).zfill(2) txt2 = mtexts.txts['SetTime'] + ': ' + str(sh) + ':' + str( sm).zfill(2) + ':' + str(ss).zfill(2) else: txt2 = mtexts.txts['RiseTime'] + ': ' + str(rh) + ':' + str( rm).zfill(2) + ':' + str(rs).zfill(2) txt1 = mtexts.txts['SetTime'] + ': ' + str(sh) + ':' + str( sm).zfill(2) + ':' + str(ss).zfill(2) w, h = draw.textsize(txt1, self.fntText) draw.text( (BOR + (self.TITLE_WIDTH - w) / 2, BOR + self.LINE_HEIGHT + (self.LINE_HEIGHT - h) / 2), txt1, fill=txtclr, font=self.fntText) w, h = draw.textsize(txt2, self.fntText) draw.text( (BOR + (self.TITLE_WIDTH - w) / 2, BOR + 2 * self.LINE_HEIGHT + (self.LINE_HEIGHT - h) / 2), txt2, fill=txtclr, font=self.fntText) x = BOR y = BOR + self.TITLE_HEIGHT + self.SPACE_TITLEY draw.line((x, y, x + self.TABLE_WIDTH, y), fill=tableclr) self.begtime = 0.0 if self.chart.time.ph.daytime: self.begtime = self.chart.time.ph.risetime else: self.begtime = self.chart.time.ph.settime for i in range(int(HoursWnd.HOURSPERHALFDAY)): self.drawline(draw, x, y + i * self.LINE_HEIGHT, tableclr, i) wxImg = wx.Image(img.size[0], img.size[1]) wxImg.SetData(img.tobytes()) self.buffer = wx.Bitmap(wxImg)
def drawBkg(self): if self.bw: self.bkgclr = (255,255,255) else: self.bkgclr = self.options.clrbackground self.SetBackgroundColour(self.bkgclr) tableclr = self.options.clrtable if self.bw: tableclr = (0,0,0) img = Image.new('RGB', (self.WIDTH, self.HEIGHT), self.bkgclr) draw = ImageDraw.Draw(img) BOR = commonwnd.CommonWnd.BORDER txtclr = (0,0,0) if not self.bw: txtclr = self.options.clrtexts #Title draw.rectangle(((BOR, BOR),(BOR+self.TITLE_WIDTH, BOR+self.TITLE_HEIGHT)), outline=(tableclr), fill=(self.bkgclr)) lon = self.chart.place.deglon+self.chart.place.minlon/60.0 if not self.chart.place.east: lon *= -1 offs = lon*4.0/1440.0 jdlocal = self.chart.time.jd+offs jy, jm, jd, jh = astrology.swe_revjul(jdlocal, 1) hh, mm, ss = util.decToDeg(jh) txt = mtexts.txts['LocalBirthTime']+': '+str(hh)+':'+str(mm).zfill(2)+':'+str(ss).zfill(2) w,h = draw.textsize(txt, self.fntText) draw.text((BOR+(self.TITLE_WIDTH-w)/2, BOR+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText) if self.chart.time.ph != None: rh, rm, rs = self.chart.time.ph.revTime(self.chart.time.ph.risetime) sh, sm, ss = self.chart.time.ph.revTime(self.chart.time.ph.settime) if self.chart.time.ph.daytime: txt1 = mtexts.txts['RiseTime']+': '+str(rh)+':'+str(rm).zfill(2)+':'+str(rs).zfill(2) txt2 = mtexts.txts['SetTime']+': '+str(sh)+':'+str(sm).zfill(2)+':'+str(ss).zfill(2) else: txt2 = mtexts.txts['RiseTime']+': '+str(rh)+':'+str(rm).zfill(2)+':'+str(rs).zfill(2) txt1 = mtexts.txts['SetTime']+': '+str(sh)+':'+str(sm).zfill(2)+':'+str(ss).zfill(2) w,h = draw.textsize(txt1, self.fntText) draw.text((BOR+(self.TITLE_WIDTH-w)/2, BOR+self.LINE_HEIGHT+(self.LINE_HEIGHT-h)/2), txt1, fill=txtclr, font=self.fntText) w,h = draw.textsize(txt2, self.fntText) draw.text((BOR+(self.TITLE_WIDTH-w)/2, BOR+2*self.LINE_HEIGHT+(self.LINE_HEIGHT-h)/2), txt2, fill=txtclr, font=self.fntText) x = BOR y = BOR+self.TITLE_HEIGHT+self.SPACE_TITLEY draw.line((x, y, x+self.TABLE_WIDTH, y), fill=tableclr) self.begtime = 0.0 if self.chart.time.ph.daytime: self.begtime = self.chart.time.ph.risetime else: self.begtime = self.chart.time.ph.settime for i in range(int(HoursWnd.HOURSPERHALFDAY)): self.drawline(draw, x, y+i*self.LINE_HEIGHT, tableclr, i) wxImg = wx.EmptyImage(img.size[0], img.size[1]) wxImg.SetData(img.tostring()) self.buffer = wx.BitmapFromImage(wxImg)