示例#1
0
    def calcBirthSolarArcRev(self, ti):
        y = self.chart.time.year
        m = self.chart.time.month
        d = self.chart.time.day

        yn, mn, dn = util.incrDay(y, m, d)

        ti1 = chart.Time(y, m, d, 0, 0, 0, False, self.chart.time.cal,
                         chart.Time.LOCALMEAN, True, 0, 0, False,
                         self.chart.place, False)
        ti2 = chart.Time(yn, mn, dn, 0, 0, 0, False, self.chart.time.cal,
                         chart.Time.LOCALMEAN, True, 0, 0, False,
                         self.chart.place, False)

        sun1 = planets.Planet(ti1.jd, astrology.SE_SUN, astrology.SEFLG_SWIEPH)
        sun2 = planets.Planet(ti2.jd, astrology.SE_SUN, astrology.SEFLG_SWIEPH)

        diff = 0.0
        if self.options.pdkeyd == primdirs.PrimDirs.BIRTHDAYSOLAREQUATORIALARC:
            diff = sun2.dataEqu[planets.Planet.RAEQU] - sun1.dataEqu[
                planets.Planet.RAEQU]
        elif self.options.pdkeyd == primdirs.PrimDirs.BIRTHDAYSOLARECLIPTICALARC:
            diff = sun2.data[planets.Planet.LONG] - sun1.data[
                planets.Planet.LONG]

        coeff = 1.0
        if diff != 0.0:
            coeff = 1.0 / diff

        return ti / coeff
示例#2
0
	def calc(self, opts):
		ayanamsha = 0.0
		if opts.ayanamsha != 0:
			astrology.swe_set_sid_mode(opts.ayanamsha-1, 0, 0)
			tim = chart.Time(self.year, 1, 1, 0, 0, 0, False, chart.Time.GREGORIAN, chart.Time.GREENWICH, True, 0, 0, False, None, False)
			ayanamsha = astrology.swe_get_ayanamsa_ut(tim.jd)

		plsnum = 7
		if opts.transcendental[chart.Chart.TRANSURANUS]:
			plsnum += 1
		if opts.transcendental[chart.Chart.TRANSNEPTUNE]:
			plsnum += 1
		if opts.transcendental[chart.Chart.TRANSPLUTO]:
			plsnum += 1

		#calculating one per day (per hour would be too slow)
		for i in range(plsnum):
			if i != 1:#moon excepted
				y = self.year; m = 1; d = 1
				ar = []
				for num in range(365):
					time = chart.Time(y, m, d, 0, 0, 0, False, chart.Time.GREGORIAN, chart.Time.GREENWICH, True, 0, 0, False, None, False)
					pl = planets.Planet(time.jd, i, self.flags)
					pos = pl.data[planets.Planet.LONG]
					if opts.ayanamsha != 0:
						pos = util.normalize(pos-ayanamsha)

					ar.append(pos)

					y, m, d = util.incrDay(y, m, d)

				self.posArr.append(ar)
示例#3
0
	def calc(self, opts):
		ayanamsha = 0.0
		if opts.ayanamsha != 0:
			astrology.swe_set_sid_mode(opts.ayanamsha-1, 0, 0)
			tim = chart.Time(self.year, 1, 1, 0, 0, 0, False, chart.Time.GREGORIAN, chart.Time.GREENWICH, True, 0, 0, False, None, False)
			ayanamsha = astrology.swe_get_ayanamsa_ut(tim.jd)

		plsnum = 7
		if opts.transcendental[chart.Chart.TRANSURANUS]:
			plsnum += 1
		if opts.transcendental[chart.Chart.TRANSNEPTUNE]:
			plsnum += 1
		if opts.transcendental[chart.Chart.TRANSPLUTO]:
			plsnum += 1

		#calculating one per day (per hour would be too slow)
		for i in range(plsnum):
			if i != 1:#moon excepted
				y = self.year; m = 1; d = 1
				ar = []
				for num in range(365):
					time = chart.Time(y, m, d, 0, 0, 0, False, chart.Time.GREGORIAN, chart.Time.GREENWICH, True, 0, 0, False, None, False)
					pl = planets.Planet(time.jd, i, self.flags)
					pos = pl.data[planets.Planet.LONG]
					if opts.ayanamsha != 0:
						pos = util.normalize(pos-ayanamsha)

					ar.append(pos)

					y, m, d = util.incrDay(y, m, d)

				self.posArr.append(ar)
    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)
示例#5
0
	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 = swisseph.julday(y, m, d, pchrts[0][0].time.time, calflag)
		for i in range(idx-1):
			jdval += mon
			jy, jm, jd, jh = swisseph.revjul(jdval, calflag)
#			d, m, s = util.decToDeg(jh)
			dat = (jy, jm, jd)
			self.dates.append(dat)
示例#6
0
	def initialize(self, chrt):
		year = chrt.time.year
		month = chrt.time.month
		day = chrt.time.day

		year, month, day = util.incrDay(year, month, day)

		self.typecb.SetStringSelection(mtexts.revtypeList[revolutions.Revolutions.SOLAR])
		self.year.SetValue(str(year))
		self.month.SetValue(str(month))
		self.day.SetValue(str(day))
示例#7
0
	def initialize(self, chrt):
		year = chrt.time.year
		month = chrt.time.month
		day = chrt.time.day

		year, month, day = util.incrDay(year, month, day)

		self.ascrb.SetFocus()
		self.year.SetValue(str(year))
		self.month.SetValue(str(month))
		self.day.SetValue(str(day))
	def initialize(self, chrt):
		year = chrt.time.year
		month = chrt.time.month
		day = chrt.time.day

		year, month, day = util.incrDay(year, month, day)

		self.typecb.SetStringSelection(mtexts.revtypeList[revolutions.Revolutions.SOLAR])
		self.year.SetValue(str(year))
		self.month.SetValue(str(month))
		self.day.SetValue(str(day))
示例#9
0
    def day(self, year, month, day, planet, pos):
        y, m, d = util.incrDay(year, month, day)
        time1 = chart.event.DateTime(year, month, day, 0, 0, 0, self.bc,
                                     chart.event.DateTime.GREGORIAN,
                                     chart.event.DateTime.GREENWICH, True, 0,
                                     0, False, None, False)
        time2 = chart.event.DateTime(y, m, d, 0, 0, 0, self.bc,
                                     chart.event.DateTime.GREGORIAN,
                                     chart.event.DateTime.GREENWICH, True, 0,
                                     0, False, None, False)

        return self.cycleplanet(time1, time2, planet, pos)
示例#10
0
    def getDateMinute(self, tim, place, newmoonorig):
        h, m, s = util.decToDeg(tim.time)
        y, mo, d = tim.year, tim.month, tim.day
        h += 1
        if h > 23:
            h = 0
            y, mo, d = util.incrDay(y, mo, d)

        tim = chart.event.DateTime(y, mo, d, h, m, s, False, tim.cal,
                                   chart.event.DateTime.GREENWICH, True, 0, 0,
                                   False, place, False)

        while True:
            h, m, s = util.decToDeg(tim.time)
            y, mo, d = tim.year, tim.month, tim.day
            y, mo, d, h, m = util.subtractMins(y, mo, d, h, m, 1)
            if y == 0:
                y = 1
                tim = chart.event.DateTime(y, mo, d, h, m, s, False, tim.cal,
                                           chart.event.DateTime.GREENWICH,
                                           True, 0, 0, False, place, False)
                return True, tim, True

            tim = chart.event.DateTime(y, mo, d, h, m, s, False, tim.cal,
                                       chart.event.DateTime.GREENWICH, True, 0,
                                       0, False, place, False)

            sun = planets.Planet(tim.jd, astrology.SE_SUN, self.flags)
            moon = planets.Planet(tim.jd, astrology.SE_MOON, self.flags)
            lonsun = sun.data[planets.Planet.LONG]
            lonmoon = moon.data[planets.Planet.LONG]

            d, m, s = util.decToDeg(lonsun)
            lonsun = d + m / 60.0 + s / 3600.0
            d, m, s = util.decToDeg(lonmoon)
            lonmoon = d + m / 60.0 + s / 3600.0

            diff = lonmoon - lonsun
            newmoon, ready = self.isNewMoon(diff)
            if newmoon != newmoonorig or ready:
                return True, tim, ready

        return False, tim
示例#11
0
    def getDateMinute(self, tim, place, newmoonorig):
        h, m, s = util.decToDeg(tim.time)
        y, mo, d = tim.year, tim.month, tim.day
        h += 1
        if h > 23:
            h = 0
            y, mo, d = util.incrDay(y, mo, d)

        tim = chart.Time(y, mo, d, h, m, s, False, tim.cal, chart.Time.GREENWICH, True, 0, 0, False, place, False)

        while True:
            h, m, s = util.decToDeg(tim.time)
            y, mo, d = tim.year, tim.month, tim.day
            y, mo, d, h, m = util.subtractMins(y, mo, d, h, m, 1)
            if y == 0:
                y = 1
                tim = chart.Time(
                    y, mo, d, h, m, s, False, tim.cal, chart.Time.GREENWICH, True, 0, 0, False, place, False
                )
                return True, tim, True

            tim = chart.Time(y, mo, d, h, m, s, False, tim.cal, chart.Time.GREENWICH, True, 0, 0, False, place, False)

            sun = planets.Planet(tim.jd, astrology.SE_SUN, self.flags)
            moon = planets.Planet(tim.jd, astrology.SE_MOON, self.flags)
            lonsun = sun.data[planets.Planet.LONG]
            lonmoon = moon.data[planets.Planet.LONG]

            d, m, s = util.decToDeg(lonsun)
            lonsun = d + m / 60.0 + s / 3600.0
            d, m, s = util.decToDeg(lonmoon)
            lonmoon = d + m / 60.0 + s / 3600.0

            diff = lonmoon - lonsun
            newmoon, ready = self.isNewMoon(diff)
            if newmoon != newmoonorig or ready:
                return True, tim, ready

        return False, tim
示例#12
0
    def __init__(self, rtime, rplace, pId, arc, lat, ascmc2, topo):
        direct = True
        if arc < 0.0:
            arc *= -1
            direct = False
        if arc > 180.0:
            arc = 360.0 - arc
            direct = not direct

        if not direct and arc > 0.0:
            arc *= -1

        flag = astrology.SEFLG_SWIEPH + astrology.SEFLG_SPEED
        if topo:
            flag += astrology.SEFLG_TOPOCTR

        #calc new time
        rate = arc / 15.0
        ut = rate * SecMotion.ST2UTCONV
        newtime = rtime.time + ut
        year, month, day = rtime.year, rtime.month, rtime.day

        #check overflow
        if newtime >= chart.Time.HOURSPERDAY:
            newtime -= chart.Time.HOURSPERDAY
            year, month, day = util.incrDay(year, month, day)
        elif newtime < 0.0:
            newtime += chart.Time.HOURSPERDAY
            year, month, day = util.decrDay(year, month, day)

        calflag = astrology.SE_GREG_CAL
        if rtime.cal == chart.Time.JULIAN:
            calflag = astrology.SE_JUL_CAL
        tjd_ut = astrology.swe_julday(year, month, day, newtime, calflag)

        #self.planet contains the new position of the planet(it proceeded on its way during the PD(arc))
        self.planet = planets.Planet(tjd_ut, pId, flag, lat, ascmc2)
	def calcBirthSolarArcRev(self, ti):
		y = self.chart.time.year
		m = self.chart.time.month
		d = self.chart.time.day

		yn, mn, dn = util.incrDay(y, m, d)

		ti1 = chart.Time(y, m, d, 0, 0, 0, False, self.chart.time.cal, chart.Time.LOCALMEAN, True, 0, 0, False, self.chart.place, False)
		ti2 = chart.Time(yn, mn, dn, 0, 0, 0, False, self.chart.time.cal, chart.Time.LOCALMEAN, True, 0, 0, False, self.chart.place, False)

		sun1 = planets.Planet(ti1.jd, astrology.SE_SUN, astrology.SEFLG_SWIEPH)
		sun2 = planets.Planet(ti2.jd, astrology.SE_SUN, astrology.SEFLG_SWIEPH)

		diff = 0.0
		if self.options.pdkeyd == primdirs.PrimDirs.BIRTHDAYSOLAREQUATORIALARC:
			diff = sun2.dataEqu[planets.Planet.RAEQU]-sun1.dataEqu[planets.Planet.RAEQU]
		elif self.options.pdkeyd == primdirs.PrimDirs.BIRTHDAYSOLARECLIPTICALARC:
			diff = sun2.data[planets.Planet.LONG]-sun1.data[planets.Planet.LONG]

		coeff = 1.0
		if diff != 0.0:
			coeff = 1.0/diff

		return ti/coeff
示例#14
0
	def find(self):
		rnge = 3000
		checker = rangechecker.RangeChecker()
		if checker.isExtended():
			rnge = 5000

		y = 1973 #year doesn't matter
		m = 3
		d = 21
		for i in range(int(self.ftdata[astrology.SE_SUN][findtimedlg.FindTimeDlg.LON])):
			y, m ,d = util.incrDay(y, m ,d)

		#Because the Sun's velocity is not exactly one degree per day. It is variable. The targetdate (from Sun's long) won't exactly be in the middle of the range
		tim = chart.Time(y, m, d, 0, 0, 0, self.bc, chart.Time.GREGORIAN, chart.Time.GREENWICH, True, 0, 0, False, None, False)
		tmpSun = planets.Planet(tim.jd, astrology.SE_SUN, self.flags)
		lonSun = tmpSun.data[planets.Planet.LONG]
		lontofind = self.ftdata[astrology.SE_SUN][findtimedlg.FindTimeDlg.LON]

		if lonSun > FindTime.CIRCLE-FindTime.OFFSET and lontofind < FindTime.OFFSET:
			lontofind += FindTime.CIRCLE
		if lontofind > FindTime.CIRCLE-FindTime.OFFSET and lonSun < FindTime.OFFSET:
			lonSun += FindTime.CIRCLE

		diff = int(math.fabs(int(lonSun)-int(lontofind)))
		if int(self.ftdata[astrology.SE_SUN][findtimedlg.FindTimeDlg.LON]) < int(lonSun):
			for i in range(diff):
				y, m, d = util.decrDay(y, m, d)
		else:
			for i in range(diff):
				y, m, d = util.incrDay(y, m, d)

		ybeg, mbeg, dbeg = y, m, d
		yend, mend, dend = y, m, d
		DATEOFFS = 7
		#adjust range
		for i in range(DATEOFFS):
			ybeg, mbeg, dbeg = util.decrDay(ybeg, mbeg ,dbeg)
			yend, mend, dend = util.incrDay(yend, mend ,dend)

		tfnd = (1, 1, 1, 1.0, 1.0)
		y = 1; m = mbeg; d = dbeg
		while (y < rnge):
			if self.abort.abort:
				return

			fnd = self.day(y, m, d, astrology.SE_SUN, self.ftdata[astrology.SE_SUN][findtimedlg.FindTimeDlg.LON])
			if fnd != None:
				found = True
				#The order of the search is chaldean (i.e. acc. to speed)
				for i in range(FindTime.TRADPL_NUM):
					j = self.mapChaldeanToModern(i)
					if j != 3: #SUN
						tfnd = self.day(y, m, d, j, self.ftdata[j][findtimedlg.FindTimeDlg.LON])
						if tfnd == None:
							found = False
							break

				if found:
					#update wnd
					evt = findtimedlg.FTDataReadyEvent(attr1=tfnd)
					wx.PostEvent(self.win, evt)

			yt = y
			if m == mend and d == dend:
				y += 1
				m = mbeg
				d = dbeg
			else:
				y, m, d = util.incrDay(y, m, d)

			if yt != y and yt%50 == 0:
				evt = findtimedlg.FTYearEvent(attr1=yt)
				wx.PostEvent(self.win, evt)
示例#15
0
	def get(self, planet1, planet2, time1, lon, pl, unit):
		if self.check(planet1, planet2, lon):
			fr = 0
			to = 60
			if unit == FindTime.HOUR:
				fr = 0
				to = 24

			for val in range(fr, to):
				time = None
				if unit == FindTime.HOUR:
					time1 = chart.Time(int(math.fabs(time1.year)), time1.month, time1.day, val, 0, 0, self.bc, chart.Time.GREGORIAN, chart.Time.GREENWICH, True, 0, 0, False, None, False)
					time2 = None
					if val+1 < to:
						time2 = chart.Time(int(math.fabs(time1.year)), time1.month, time1.day, val+1, 0, 0, self.bc, chart.Time.GREGORIAN, chart.Time.GREENWICH, True, 0, 0, False, None, False)
					else:
						y, m, d = util.incrDay(int(math.fabs(time1.year)), time1.month, time1.day)
						time2 = chart.Time(y, m, d, 0, 0, 0, self.bc, chart.Time.GREGORIAN, chart.Time.GREENWICH, True, 0, 0, False, None, False)
				elif unit == FindTime.MINUTE:
					time1 = chart.Time(int(math.fabs(time1.year)), time1.month, time1.day, time1.hour, val, 0, self.bc, chart.Time.GREGORIAN, chart.Time.GREENWICH, True, 0, 0, False, None, False)
					time2 = None
					if val+1 < to:
						time2 = chart.Time(int(math.fabs(time1.year)), time1.month, time1.day, time1.hour, val+1, 0, self.bc, chart.Time.GREGORIAN, chart.Time.GREENWICH, True, 0, 0, False, None, False)
					else:
						if time1.hour+1 < 24:
							time2 = chart.Time(int(math.fabs(time1.year)), time1.month, time1.day, time1.hour+1, 0, 0, self.bc, chart.Time.GREGORIAN, chart.Time.GREENWICH, True, 0, 0, False, None, False)
						else:
							y, m, d = util.incrDay(int(math.fabs(time1.year)), time1.month, time1.day)
							time2 = chart.Time(y, m, d, 0, 0, 0, self.bc, chart.Time.GREGORIAN, chart.Time.GREENWICH, True, 0, 0, False, None, False)
				elif unit == FindTime.SECOND:
					time1 = chart.Time(int(math.fabs(time1.year)), time1.month, time1.day, time1.hour, time1.minute, val, self.bc, chart.Time.GREGORIAN, chart.Time.GREENWICH, True, 0, 0, False, None, False)
					time2 = None
					if val+1 < to:
						time2 = chart.Time(int(math.fabs(time1.year)), time1.month, time1.day, time1.hour, time1.minute, val+1, self.bc, chart.Time.GREGORIAN, chart.Time.GREENWICH, True, 0, 0, False, None, False)
					else:
						if time1.minute+1 < 60:
							time2 = chart.Time(int(math.fabs(time1.year)), time1.month, time1.day, time1.hour, time1.minute+1, 0, self.bc, chart.Time.GREGORIAN, chart.Time.GREENWICH, True, 0, 0, False, None, False)
						else:
							if time1.hour+1 < 24:
								time2 = chart.Time(int(math.fabs(time1.year)), time1.month, time1.day, time1.hour+1, 0, 0, self.bc, chart.Time.GREGORIAN, chart.Time.GREENWICH, True, 0, 0, False, None, False)
							else:
								y, m, d = util.incrDay(int(math.fabs(time1.year)), time1.month, time1.day)
								time2 = chart.Time(y, m, d, 0, 0, 0, self.bc, chart.Time.GREGORIAN, chart.Time.GREENWICH, True, 0, 0, False, None, False)
				else:
#					print 'unit > SECOND'
					return None	

				planet1 = planets.Planet(time1.jd, pl, self.flags)
				planet2 = planets.Planet(time2.jd, pl, self.flags)
	
				if self.check(planet1, planet2, lon):
					un = FindTime.OVER
					if unit == FindTime.HOUR:
						un = FindTime.MINUTE
					if unit == FindTime.MINUTE:
						un = FindTime.SECOND
				
					if un != FindTime.OVER:
						return self.get(planet1, planet2, time1, lon, pl, un)
					else:
						if self.ftdatause[findtimedlg.FindTimeDlg.RET]:
							#check retrograde
							if ((planet1.data[planets.Planet.SPLON] <= 0.0 and self.ftdata[pl][findtimedlg.FindTimeDlg.RETR]) or (planet1.data[planets.Planet.SPLON] > 0.0 and not self.ftdata[pl][findtimedlg.FindTimeDlg.RETR])):
								return (int(math.fabs(time1.year)), time1.month, time1.day, time1.time, time1.jd)

							return None

						return (int(math.fabs(time1.year)), time1.month, time1.day, time1.time, time1.jd)
				
		return None
示例#16
0
	def day(self, year, month, day, planet, pos):
		y, m, d = util.incrDay(year, month, day)
		time1 = chart.Time(year, month, day, 0, 0, 0, self.bc, chart.Time.GREGORIAN, chart.Time.GREENWICH, True, 0, 0, False, None, False)
		time2 = chart.Time(y, m, d, 0, 0, 0, self.bc, chart.Time.GREGORIAN, chart.Time.GREENWICH, True, 0, 0, False, None, False)
				
		return self.cycleplanet(time1, time2, planet, pos)
示例#17
0
	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 calcTrueSolarArc(self, arc):
		LIM = 120.0 #arbitrary value
		y = self.chart.time.year
		m = self.chart.time.month
		d = self.chart.time.day

		h, mi, s = util.decToDeg(self.chart.time.time)
		tt = 0.0

		#Add arc to Suns's pos (long or ra)
		prSunPos = self.chart.planets.planets[astrology.SE_SUN].dataEqu[planets.Planet.RAEQU]
		if self.options.pdkeyd == primdirs.PrimDirs.TRUESOLARECLIPTICALARC:
			prSunPos = self.chart.planets.planets[astrology.SE_SUN].data[planets.Planet.LONG]

		prSunPosEnd = prSunPos+arc
		transition = False #Pisces-Aries
		if prSunPosEnd >= 360.0:
			transition = True

#		Find day in ephemeris
		while (prSunPos <= prSunPosEnd):
			y, m, d = util.incrDay(y, m, d)
			ti = chart.Time(y, m, d, 0, 0, 0, False, self.chart.time.cal, chart.Time.GREENWICH, True, 0, 0, False, self.chart.place, False)
			sun = planets.Planet(ti.jd, astrology.SE_SUN, astrology.SEFLG_SWIEPH)
			
			pos = sun.dataEqu[planets.Planet.RAEQU]
			if self.options.pdkeyd == primdirs.PrimDirs.TRUESOLARECLIPTICALARC:
				pos = sun.data[planets.Planet.LONG]

			if transition and pos < LIM:
				pos += 360.0
			prSunPos = pos

		if (prSunPos != prSunPosEnd):
			y, m, d = util.decrDay(y, m, d)

			if transition:
				prSunPosEnd -= 360.0

			trlon = 0.0
			if self.options.pdkeyd == primdirs.PrimDirs.TRUESOLARECLIPTICALARC:
				trlon = prSunPosEnd
			else:
				#to Longitude...
				trlon = util.ra2ecl(prSunPosEnd, self.chart.obl[0])

			trans = transits.Transits()
			trans.day(y, m, d, self.chart, astrology.SE_SUN, trlon)

			if len(trans.transits) > 0:
				tt = trans.transits[0].time
		else:
			#the time is midnight
			tt = 0.0

		#difference
		d1 = datetime.datetime(self.chart.time.year, self.chart.time.month, self.chart.time.day, h, mi, s) #in GMT
		th, tm, ts = util.decToDeg(tt)
		d2 = datetime.datetime(y, m, d, th, tm, ts) #in GMT
		diff = d2-d1
		ddays = diff.days
		dtime = diff.seconds/3600.0
		#dtime to days
		dtimeindays = dtime/24.0

		tt = ddays+dtimeindays

		return tt
	def onIncrDay(self, event):
		y, self.m, self.d = util.incrDay(self.y+self.cnt, self.m, self.d)
		if y != self.y+self.cnt:
			self.cnt +=1
		self.show(self.y, self.m, self.d, self.t, self.cnt)
示例#20
0
    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 = swisseph.julday(yt, m, d, meantime, calflag)

            #Get jdapp
            ret, te, serr = swisseph.time_equ(jdmean)
            jdapp = jdmean - te
            y, m, d, hr = swisseph.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 = swisseph.julday(yt, m, d, hr, calflag)

            ret, te, serr = swisseph.time_equ(jdapp)
            jdmean = jdapp + te
            y, m, d, hr = swisseph.revjul(jdmean, calflag)
            hour, minute, second = util.decToDeg(hr)
#			print '%d:%02d:%02d' % (hour,minute,second)

        return y, m, d, hour, minute, second
	def onIncrDay(self, event):
		y, m, d = util.incrDay(self.chart.time.origyear, self.chart.time.origmonth, self.chart.time.origday)
		self.show(y, m, d, self.chart.time.hour, self.chart.time.minute, self.chart.time.second)
示例#22
0
    def find(self):
        rnge = 3000
        checker = rangechecker.RangeChecker()
        if checker.isExtended():
            rnge = 5000

        y = 1973  #year doesn't matter
        m = 3
        d = 21
        for i in range(
                int(self.ftdata[astrology.SE_SUN][
                    findtimedlg.FindTimeDlg.LON])):
            y, m, d = util.incrDay(y, m, d)

        #Because the Sun's velocity is not exactly one degree per day. It is variable. The targetdate (from Sun's long) won't exactly be in the middle of the range
        tim = chart.event.DateTime(y, m, d, 0, 0, 0, self.bc,
                                   chart.event.DateTime.GREGORIAN,
                                   chart.event.DateTime.GREENWICH, True, 0, 0,
                                   False, None, False)
        tmpSun = planets.Planet(tim.jd, astrology.SE_SUN, self.flags)
        lonSun = tmpSun.data[planets.Planet.LONG]
        lontofind = self.ftdata[astrology.SE_SUN][findtimedlg.FindTimeDlg.LON]

        if lonSun > FindTime.CIRCLE - FindTime.OFFSET and lontofind < FindTime.OFFSET:
            lontofind += FindTime.CIRCLE
        if lontofind > FindTime.CIRCLE - FindTime.OFFSET and lonSun < FindTime.OFFSET:
            lonSun += FindTime.CIRCLE

        diff = int(math.fabs(int(lonSun) - int(lontofind)))
        if int(self.ftdata[astrology.SE_SUN][
                findtimedlg.FindTimeDlg.LON]) < int(lonSun):
            for i in range(diff):
                y, m, d = util.decrDay(y, m, d)
        else:
            for i in range(diff):
                y, m, d = util.incrDay(y, m, d)

        ybeg, mbeg, dbeg = y, m, d
        yend, mend, dend = y, m, d
        DATEOFFS = 7
        #adjust range
        for i in range(DATEOFFS):
            ybeg, mbeg, dbeg = util.decrDay(ybeg, mbeg, dbeg)
            yend, mend, dend = util.incrDay(yend, mend, dend)

        tfnd = (1, 1, 1, 1.0, 1.0)
        y = 1
        m = mbeg
        d = dbeg
        while (y < rnge):
            if self.abort.abort:
                return

            fnd = self.day(
                y, m, d, astrology.SE_SUN,
                self.ftdata[astrology.SE_SUN][findtimedlg.FindTimeDlg.LON])
            if fnd != None:
                found = True
                #The order of the search is chaldean (i.e. acc. to speed)
                for i in range(FindTime.TRADPL_NUM):
                    j = self.mapChaldeanToModern(i)
                    if j != 3:  #SUN
                        tfnd = self.day(
                            y, m, d, j,
                            self.ftdata[j][findtimedlg.FindTimeDlg.LON])
                        if tfnd == None:
                            found = False
                            break

                if found:
                    #update wnd
                    evt = findtimedlg.FTDataReadyEvent(attr1=tfnd)
                    wx.PostEvent(self.win, evt)

            yt = y
            if m == mend and d == dend:
                y += 1
                m = mbeg
                d = dbeg
            else:
                y, m, d = util.incrDay(y, m, d)

            if yt != y and yt % 50 == 0:
                evt = findtimedlg.FTYearEvent(attr1=yt)
                wx.PostEvent(self.win, evt)
示例#23
0
	def get(self, planet1, planet2, time1, chrt, lon, j, k, a, unit, typ):
		if self.check(planet1, planet2, lon):
			fr = 0
			to = 60
			if unit == Transits.HOUR:
				fr = 0
				to = 24

			for val in range(fr, to):
				time = None
				if unit == Transits.HOUR:
					time1 = chart.Time(time1.year, time1.month, time1.day, val, 0, 0, False, chrt.time.cal, chart.Time.GREENWICH, True, 0, 0, False, chrt.place, False)
					time2 = None
					if val+1 < to:
						time2 = chart.Time(time1.year, time1.month, time1.day, val+1, 0, 0, False, chrt.time.cal, chart.Time.GREENWICH, True, 0, 0, False, chrt.place, False)
					else:
						y, m, d = util.incrDay(time1.year, time1.month, time1.day)
						time2 = chart.Time(y, m, d, 0, 0, 0, False, chrt.time.cal, chart.Time.GREENWICH, True, 0, 0, False, chrt.place, False)
				elif unit == Transits.MINUTE:
					time1 = chart.Time(time1.year, time1.month, time1.day, time1.hour, val, 0, False, chrt.time.cal, chart.Time.GREENWICH, True, 0, 0, False, chrt.place, False)
					time2 = None
					if val+1 < to:
						time2 = chart.Time(time1.year, time1.month, time1.day, time1.hour, val+1, 0, False, chrt.time.cal, chart.Time.GREENWICH, True, 0, 0, False, chrt.place, False)
					else:
						if time1.hour+1 < 24:
							time2 = chart.Time(time1.year, time1.month, time1.day, time1.hour+1, 0, 0, False, chrt.time.cal, chart.Time.GREENWICH, True, 0, 0, False, chrt.place, False)
						else:
							y, m, d = util.incrDay(time1.year, time1.month, time1.day)
							time2 = chart.Time(y, m, d, 0, 0, 0, False, chrt.time.cal, chart.Time.GREENWICH, True, 0, 0, False, chrt.place, False)
				elif unit == Transits.SECOND:
					time1 = chart.Time(time1.year, time1.month, time1.day, time1.hour, time1.minute, val, False, chrt.time.cal, chart.Time.GREENWICH, True, 0, 0, False, chrt.place, False)
					time2 = None
					if val+1 < to:
						time2 = chart.Time(time1.year, time1.month, time1.day, time1.hour, time1.minute, val+1, False, chrt.time.cal, chart.Time.GREENWICH, True, 0, 0, False, chrt.place, False)
					else:
						if time1.minute+1 < 60:
							time2 = chart.Time(time1.year, time1.month, time1.day, time1.hour, time1.minute+1, 0, False, chrt.time.cal, chart.Time.GREENWICH, True, 0, 0, False, chrt.place, False)
						else:
							if time1.hour+1 < 24:
								time2 = chart.Time(time1.year, time1.month, time1.day, time1.hour+1, 0, 0, False, chrt.time.cal, chart.Time.GREENWICH, True, 0, 0, False, chrt.place, False)
							else:
								y, m, d = util.incrDay(time1.year, time1.month, time1.day)
								time2 = chart.Time(y, m, d, 0, 0, 0, False, chrt.time.cal, chart.Time.GREENWICH, True, 0, 0, False, chrt.place, False)
				else:
#					print 'unit > SECOND'
					return None	

				planet1 = planets.Planet(time1.jd, j, self.flags)
				planet2 = planets.Planet(time2.jd, j, self.flags)
	
				if self.check(planet1, planet2, lon):
					un = Transits.OVER
					if unit == Transits.HOUR:
						un = Transits.MINUTE
					if unit == Transits.MINUTE:
						un = Transits.SECOND
				
					if un != Transits.OVER:
						return self.get(planet1, planet2, time1, chrt, lon, j, k, a, un, typ)
					else:
						tr = Transit()
						tr.plt = j
						tr.objtype = typ
						if typ == Transit.SIGN:
							tr.obj = int(lon/chart.Chart.SIGN_DEG)
						else:
							tr.obj = k

						if planet1.data[planets.Planet.SPLON] < 0.0:
							tr.pltretr = Transit.RETR
						elif planet1.data[planets.Planet.SPLON] == 0.0:
							tr.pltretr = Transit.STAT
						if typ == Transit.PLANET:
							if chrt.planets.planets[k].data[planets.Planet.SPLON] < 0.0:
								tr.objretr = Transit.RETR
							elif chrt.planets.planets[k].data[planets.Planet.SPLON] == 0.0:
								tr.objretr = Transit.STAT

						if typ != Transit.SIGN:
							tr.aspect = a
						tr.house = chrt.houses.getHousePos(planet1.data[planets.Planet.LONG], chrt.options)
						tr.day = time1.day
						tr.time = time1.time

						return tr
				
		return None
示例#24
0
    def calcTrueSolarArc(self, arc):
        LIM = 120.0  #arbitrary value
        y = self.chart.time.year
        m = self.chart.time.month
        d = self.chart.time.day

        h, mi, s = util.decToDeg(self.chart.time.time)
        tt = 0.0

        #Add arc to Suns's pos (long or ra)
        prSunPos = self.chart.planets.planets[astrology.SE_SUN].dataEqu[
            planets.Planet.RAEQU]
        if self.options.pdkeyd == primdirs.PrimDirs.TRUESOLARECLIPTICALARC:
            prSunPos = self.chart.planets.planets[astrology.SE_SUN].data[
                planets.Planet.LONG]

        prSunPosEnd = prSunPos + arc
        transition = False  #Pisces-Aries
        if prSunPosEnd >= 360.0:
            transition = True

#		Find day in ephemeris
        while (prSunPos <= prSunPosEnd):
            y, m, d = util.incrDay(y, m, d)
            ti = chart.Time(y, m, d, 0, 0, 0, False, self.chart.time.cal,
                            chart.Time.GREENWICH, True, 0, 0, False,
                            self.chart.place, False)
            sun = planets.Planet(ti.jd, astrology.SE_SUN,
                                 astrology.SEFLG_SWIEPH)

            pos = sun.dataEqu[planets.Planet.RAEQU]
            if self.options.pdkeyd == primdirs.PrimDirs.TRUESOLARECLIPTICALARC:
                pos = sun.data[planets.Planet.LONG]

            if transition and pos < LIM:
                pos += 360.0
            prSunPos = pos

        if (prSunPos != prSunPosEnd):
            y, m, d = util.decrDay(y, m, d)

            if transition:
                prSunPosEnd -= 360.0

            trlon = 0.0
            if self.options.pdkeyd == primdirs.PrimDirs.TRUESOLARECLIPTICALARC:
                trlon = prSunPosEnd
            else:
                #to Longitude...
                trlon = util.ra2ecl(prSunPosEnd, self.chart.obl[0])

            trans = transits.Transits()
            trans.day(y, m, d, self.chart, astrology.SE_SUN, trlon)

            if len(trans.transits) > 0:
                tt = trans.transits[0].time
        else:
            #the time is midnight
            tt = 0.0

        #difference
        d1 = datetime.datetime(self.chart.time.year, self.chart.time.month,
                               self.chart.time.day, h, mi, s)  #in GMT
        th, tm, ts = util.decToDeg(tt)
        d2 = datetime.datetime(y, m, d, th, tm, ts)  #in GMT
        diff = d2 - d1
        ddays = diff.days
        dtime = diff.seconds / 3600.0
        #dtime to days
        dtimeindays = dtime / 24.0

        tt = ddays + dtimeindays

        return tt
示例#25
0
	def get(self, planet1, planet2, time1, chrt, lon, j, k, a, unit, typ):
		if self.check(planet1, planet2, lon):
			fr = 0
			to = 60
			if unit == Transits.HOUR:
				fr = 0
				to = 24

			for val in range(fr, to):
				time = None
				if unit == Transits.HOUR:
					time1 = chart.event.DateTime(time1.year, time1.month, time1.day, val, 0, 0, False, chrt.time.cal, chart.event.DateTime.GREENWICH, True, 0, 0, False, chrt.place, False)
					time2 = None
					if val+1 < to:
						time2 = chart.event.DateTime(time1.year, time1.month, time1.day, val+1, 0, 0, False, chrt.time.cal, chart.event.DateTime.GREENWICH, True, 0, 0, False, chrt.place, False)
					else:
						y, m, d = util.incrDay(time1.year, time1.month, time1.day)
						time2 = chart.event.DateTime(y, m, d, 0, 0, 0, False, chrt.time.cal, chart.event.DateTime.GREENWICH, True, 0, 0, False, chrt.place, False)
				elif unit == Transits.MINUTE:
					time1 = chart.event.DateTime(time1.year, time1.month, time1.day, time1.hour, val, 0, False, chrt.time.cal, chart.event.DateTime.GREENWICH, True, 0, 0, False, chrt.place, False)
					time2 = None
					if val+1 < to:
						time2 = chart.event.DateTime(time1.year, time1.month, time1.day, time1.hour, val+1, 0, False, chrt.time.cal, chart.event.DateTime.GREENWICH, True, 0, 0, False, chrt.place, False)
					else:
						if time1.hour+1 < 24:
							time2 = chart.event.DateTime(time1.year, time1.month, time1.day, time1.hour+1, 0, 0, False, chrt.time.cal, chart.event.DateTime.GREENWICH, True, 0, 0, False, chrt.place, False)
						else:
							y, m, d = util.incrDay(time1.year, time1.month, time1.day)
							time2 = chart.event.DateTime(y, m, d, 0, 0, 0, False, chrt.time.cal, chart.event.DateTime.GREENWICH, True, 0, 0, False, chrt.place, False)
				elif unit == Transits.SECOND:
					time1 = chart.event.DateTime(time1.year, time1.month, time1.day, time1.hour, time1.minute, val, False, chrt.time.cal, chart.event.DateTime.GREENWICH, True, 0, 0, False, chrt.place, False)
					time2 = None
					if val+1 < to:
						time2 = chart.event.DateTime(time1.year, time1.month, time1.day, time1.hour, time1.minute, val+1, False, chrt.time.cal, chart.event.DateTime.GREENWICH, True, 0, 0, False, chrt.place, False)
					else:
						if time1.minute+1 < 60:
							time2 = chart.event.DateTime(time1.year, time1.month, time1.day, time1.hour, time1.minute+1, 0, False, chrt.time.cal, chart.event.DateTime.GREENWICH, True, 0, 0, False, chrt.place, False)
						else:
							if time1.hour+1 < 24:
								time2 = chart.event.DateTime(time1.year, time1.month, time1.day, time1.hour+1, 0, 0, False, chrt.time.cal, chart.event.DateTime.GREENWICH, True, 0, 0, False, chrt.place, False)
							else:
								y, m, d = util.incrDay(time1.year, time1.month, time1.day)
								time2 = chart.event.DateTime(y, m, d, 0, 0, 0, False, chrt.time.cal, chart.event.DateTime.GREENWICH, True, 0, 0, False, chrt.place, False)
				else:
#					print 'unit > SECOND'
					return None

				planet1 = planets.Planet(time1.jd, j, self.flags)
				planet2 = planets.Planet(time2.jd, j, self.flags)

				if self.check(planet1, planet2, lon):
					un = Transits.OVER
					if unit == Transits.HOUR:
						un = Transits.MINUTE
					if unit == Transits.MINUTE:
						un = Transits.SECOND

					if un != Transits.OVER:
						return self.get(planet1, planet2, time1, chrt, lon, j, k, a, un, typ)
					else:
						tr = Transit()
						tr.plt = j
						tr.objtype = typ
						if typ == Transit.SIGN:
							tr.obj = int(lon/chart.Chart.SIGN_DEG)
						else:
							tr.obj = k

						if planet1.data[planets.Planet.SPLON] < 0.0:
							tr.pltretr = Transit.RETR
						elif planet1.data[planets.Planet.SPLON] == 0.0:
							tr.pltretr = Transit.STAT
						if typ == Transit.PLANET:
							if chrt.planets.planets[k].data[planets.Planet.SPLON] < 0.0:
								tr.objretr = Transit.RETR
							elif chrt.planets.planets[k].data[planets.Planet.SPLON] == 0.0:
								tr.objretr = Transit.STAT

						if typ != Transit.SIGN:
							tr.aspect = a
						tr.house = chrt.houses.getHousePos(planet1.data[planets.Planet.LONG], chrt.options)
						tr.day = time1.day
						tr.time = time1.time

						return tr

		return None
示例#26
0
 def onIncrDay(self, event):
     y, m, d = util.incrDay(self.chart.time.origyear,
                            self.chart.time.origmonth,
                            self.chart.time.origday)
     self.show(y, m, d, self.chart.time.hour, self.chart.time.minute,
               self.chart.time.second)
示例#27
0
    def get(self, planet1, planet2, time1, lon, pl, unit):
        if self.check(planet1, planet2, lon):
            fr = 0
            to = 60
            if unit == FindTime.HOUR:
                fr = 0
                to = 24

            for val in range(fr, to):
                time = None
                if unit == FindTime.HOUR:
                    time1 = chart.event.DateTime(
                        int(math.fabs(time1.year)), time1.month, time1.day,
                        val, 0, 0, self.bc, chart.event.DateTime.GREGORIAN,
                        chart.event.DateTime.GREENWICH, True, 0, 0, False,
                        None, False)
                    time2 = None
                    if val + 1 < to:
                        time2 = chart.event.DateTime(
                            int(math.fabs(time1.year)), time1.month, time1.day,
                            val + 1, 0, 0, self.bc,
                            chart.event.DateTime.GREGORIAN,
                            chart.event.DateTime.GREENWICH, True, 0, 0, False,
                            None, False)
                    else:
                        y, m, d = util.incrDay(int(math.fabs(time1.year)),
                                               time1.month, time1.day)
                        time2 = chart.event.DateTime(
                            y, m, d, 0, 0, 0, self.bc,
                            chart.event.DateTime.GREGORIAN,
                            chart.event.DateTime.GREENWICH, True, 0, 0, False,
                            None, False)
                elif unit == FindTime.MINUTE:
                    time1 = chart.event.DateTime(
                        int(math.fabs(time1.year)), time1.month, time1.day,
                        time1.hour, val, 0, self.bc,
                        chart.event.DateTime.GREGORIAN,
                        chart.event.DateTime.GREENWICH, True, 0, 0, False,
                        None, False)
                    time2 = None
                    if val + 1 < to:
                        time2 = chart.event.DateTime(
                            int(math.fabs(time1.year)), time1.month, time1.day,
                            time1.hour, val + 1, 0, self.bc,
                            chart.event.DateTime.GREGORIAN,
                            chart.event.DateTime.GREENWICH, True, 0, 0, False,
                            None, False)
                    else:
                        if time1.hour + 1 < 24:
                            time2 = chart.event.DateTime(
                                int(math.fabs(time1.year)), time1.month,
                                time1.day, time1.hour + 1, 0, 0, self.bc,
                                chart.event.DateTime.GREGORIAN,
                                chart.event.DateTime.GREENWICH, True, 0, 0,
                                False, None, False)
                        else:
                            y, m, d = util.incrDay(int(math.fabs(time1.year)),
                                                   time1.month, time1.day)
                            time2 = chart.event.DateTime(
                                y, m, d, 0, 0, 0, self.bc,
                                chart.event.DateTime.GREGORIAN,
                                chart.event.DateTime.GREENWICH, True, 0, 0,
                                False, None, False)
                elif unit == FindTime.SECOND:
                    time1 = chart.event.DateTime(
                        int(math.fabs(time1.year)), time1.month, time1.day,
                        time1.hour, time1.minute, val, self.bc,
                        chart.event.DateTime.GREGORIAN,
                        chart.event.DateTime.GREENWICH, True, 0, 0, False,
                        None, False)
                    time2 = None
                    if val + 1 < to:
                        time2 = chart.event.DateTime(
                            int(math.fabs(time1.year)), time1.month, time1.day,
                            time1.hour, time1.minute, val + 1, self.bc,
                            chart.event.DateTime.GREGORIAN,
                            chart.event.DateTime.GREENWICH, True, 0, 0, False,
                            None, False)
                    else:
                        if time1.minute + 1 < 60:
                            time2 = chart.event.DateTime(
                                int(math.fabs(time1.year)), time1.month,
                                time1.day, time1.hour, time1.minute + 1, 0,
                                self.bc, chart.event.DateTime.GREGORIAN,
                                chart.event.DateTime.GREENWICH, True, 0, 0,
                                False, None, False)
                        else:
                            if time1.hour + 1 < 24:
                                time2 = chart.event.DateTime(
                                    int(math.fabs(time1.year)), time1.month,
                                    time1.day, time1.hour + 1, 0, 0, self.bc,
                                    chart.event.DateTime.GREGORIAN,
                                    chart.event.DateTime.GREENWICH, True, 0, 0,
                                    False, None, False)
                            else:
                                y, m, d = util.incrDay(
                                    int(math.fabs(time1.year)), time1.month,
                                    time1.day)
                                time2 = chart.event.DateTime(
                                    y, m, d, 0, 0, 0, self.bc,
                                    chart.event.DateTime.GREGORIAN,
                                    chart.event.DateTime.GREENWICH, True, 0, 0,
                                    False, None, False)
                else:
                    #					print 'unit > SECOND'
                    return None

                planet1 = planets.Planet(time1.jd, pl, self.flags)
                planet2 = planets.Planet(time2.jd, pl, self.flags)

                if self.check(planet1, planet2, lon):
                    un = FindTime.OVER
                    if unit == FindTime.HOUR:
                        un = FindTime.MINUTE
                    if unit == FindTime.MINUTE:
                        un = FindTime.SECOND

                    if un != FindTime.OVER:
                        return self.get(planet1, planet2, time1, lon, pl, un)
                    else:
                        if self.ftdatause[findtimedlg.FindTimeDlg.RET]:
                            #check retrograde
                            if ((planet1.data[planets.Planet.SPLON] <= 0.0 and
                                 self.ftdata[pl][findtimedlg.FindTimeDlg.RETR])
                                    or
                                (planet1.data[planets.Planet.SPLON] > 0.0
                                 and not self.ftdata[pl][
                                     findtimedlg.FindTimeDlg.RETR])):
                                return (int(math.fabs(time1.year)),
                                        time1.month, time1.day, time1.time,
                                        time1.jd)

                            return None

                        return (int(math.fabs(time1.year)), time1.month,
                                time1.day, time1.time, time1.jd)

        return None
示例#28
0
	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