Esempio n. 1
0
    def getDateHour(self, tim, place, newmoonorig):
        while True:
            h, m, s = util.decToDeg(tim.time)
            y, mo, d = tim.year, tim.month, tim.day
            h -= 1
            if h < 0:
                h = 23
                y, mo, d = util.decrDay(y, mo, d)
                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
Esempio n. 2
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
Esempio n. 3
0
	def cycleplanet(self, time1, time2, planet, pos):
		planet1 = planets.Planet(time1.jd, planet, self.flags)
		planet2 = planets.Planet(time2.jd, planet, self.flags)

		if self.check(planet1, planet2, pos):
			return self.get(planet1, planet2, time1, pos, planet, FindTime.HOUR)

		return None
Esempio n. 4
0
	def cycleplanet(self, time1, chrt, time2, planet, pos):
		planet1 = planets.Planet(time1.jd, planet, self.flags)
		planet2 = planets.Planet(time2.jd, planet, self.flags)

		lon = chrt.planets.planets[planet].data[planets.Planet.LONG]
		if planet != Transits.NONE and pos != None:
			lon = pos
		tr = self.get(planet1, planet2, time1, chrt, lon, planet, planet, chart.Chart.CONJUNCTIO, Transits.HOUR, Transit.PLANET)
		if tr != None:
			self.transits.append(tr)
Esempio n. 5
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)
Esempio n. 6
0
def testUrls():
        arrayProperties = []
        arrayUrls = []
        brokenUrls = ""
        print("Planets: ",len([*planets.Planet().properties]))
        print("Ships: ",len([*planets.Ship().properties]))
        print("Beings: ",len([*planets.Being().properties]))
        print("Asteroids: ",len([*planets.Asteroid().urls]))
        print("Portals: ",len([*planets.Portal().urls]))
        print("BlackHoles: ",len([*planets.BlackHole().urls]))
        print("Spaceports: ",len([*planets.Spaceport().urls]))
        print("Goals: ",len([*planets.Goal().urls]))
        print("Players: ",len([*planets.Player().properties]))

        arrayProperties+=[*planets.Planet().properties]
        arrayProperties+=[*planets.Player().properties]
        arrayProperties+=[*planets.Ship().properties]
        arrayProperties+=[*planets.Being().properties] 
        arrayUrls+=[*planets.Asteroid().urls]
        arrayUrls+=[*planets.Portal().urls]
        arrayUrls+=[*planets.BlackHole().urls]
        arrayUrls+=[*planets.Goal().urls]
        arrayUrls+=[*planets.Spaceport().urls]
        for name in arrayProperties:
                try:
                        aux = get_event_from_name(name)
                        #print(name)
                        #urllib.request.urlretrieve(aux.url,'event_image')
                        img = Image.open(aux.path)
                except:
                        print(">arreglar esta ^")
                        brokenUrls+=name+"\n"
        for name in arrayUrls:
                try:
                        aux = get_event_from_name(name)
                        #print(name)
                        #urllib.request.urlretrieve(aux.url,'event_image')
                        img = Image.open(aux.path)
                except:
                        print(">arreglar esta ^")
                        brokenUrls+=name+"\n"
        print("Broken urls: ",brokenUrls)
Esempio n. 7
0
    def getDateSecond(self, tim, place, newmoonorig):
        h, m, s = util.decToDeg(tim.time)
        y, mo, d = tim.year, tim.month, tim.day
        y, mo, d, h, m = util.addMins(y, mo, d, h, m, 1)

        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, s = util.subtractSecs(y, mo, d, h, m, s, 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
Esempio n. 8
0
 def make_solar_system(self, T=4):
     """
     Seob kontrolleriga päikesesüsteemi mudeli.
     T määrab, mitu atomaarset tick sammu on Maa aastas
     """
     self._sys = planets.PlanetarySystem()
     # Päikesesüsteemi infol, koosneb paaridest  (aasta pikkus, kaugus päikesest))
     astro_data = [(87.97 / 365.26, 0.39), (227.7 / 365.26, 0.72),
                   (1.0, 1.0), (686.98 / 365.26, 1.52), (11.86, 5.2),
                   (29.46, 9.54), (84.01, 19.18), (164.81, 30.06),
                   (247.7, 39.75)]
     for o, r in astro_data:
         self._sys.append(planets.Planet(r, 0.0, (2 * math.pi) / (o * T)))
Esempio n. 9
0
    def calcTrueSolarArcRegressiveRev(self, ti):
        #Sun's natal position
        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]

        #Calculate new JD from ti
        jdArc = self.chart.time.jd - ti  #*365.2421904
        sun = planets.Planet(jdArc, astrology.SE_SUN, astrology.SEFLG_SWIEPH)

        #The difference in RA or Long will be the arc
        prSunPosEnd = sun.dataEqu[planets.Planet.RAEQU]
        if self.options.pdkeyd == primdirs.PrimDirs.TRUESOLARECLIPTICALARC:
            prSunPosEnd = sun.data[planets.Planet.LONG]

        #The arc
        return math.fabs(prSunPosEnd - prSunPos)
Esempio n. 10
0
	def generate_eventlist(self):
		size = self.lenx*self.leny-2
		beingNum = min(len([*planets.Being().properties]),np.random.poisson(size/30)+1)
		size-=beingNum
		holeNum = min(len([*planets.BlackHole().urls]),np.random.poisson(size/25)+1)
		size-=holeNum
		stationNum = min(len([*planets.Spaceport().urls]),np.random.poisson(size/12)+1)
		size-=stationNum
		portalNum = min(len([*planets.Portal().urls]),np.random.poisson(size/11)+1)
		size-=portalNum
		rockNum = min(len([*planets.Asteroid().urls]),np.random.poisson(size/8)+1)
		size-=rockNum
		planNum = size//2
		shipNum = size-planNum
		self.eventlist+=random.sample([*planets.Planet().properties],planNum)
		self.eventlist+=random.sample([*planets.Ship().properties],shipNum)
		self.eventlist+=random.sample([*planets.Asteroid().urls],rockNum)
		self.eventlist+=random.sample([*planets.Spaceport().urls],stationNum)
		self.eventlist+=random.sample([*planets.Portal().urls],portalNum)
		self.eventlist+=random.sample([*planets.BlackHole().urls],holeNum)
		self.eventlist+=random.sample([*planets.Being().properties],beingNum)
Esempio n. 11
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)
Esempio n. 12
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
Esempio n. 13
0
    def __init__(self, chrt):
        self.time = chrt.time
        self.lon = chrt.planets.planets[astrology.SE_MOON].data[
            planets.Planet.LONG]

        self.flags = astrology.SEFLG_SPEED + astrology.SEFLG_SWIEPH

        #for topical almutens
        self.lons = []

        if not chrt.time.bc:
            lonsun = chrt.planets.planets[astrology.SE_SUN].data[
                planets.Planet.LONG]
            lonmoon = chrt.planets.planets[astrology.SE_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
            self.newmoon, self.ready = self.isNewMoon(diff)

            if not self.ready:
                ok, self.time, self.ready = self.getDateHour(
                    self.time, chrt.place, self.newmoon)
                if not self.ready:
                    ok, self.time, self.ready = self.getDateMinute(
                        self.time, chrt.place, self.newmoon)
                    if not self.ready:
                        ok, self.time, self.ready = self.getDateSecond(
                            self.time, chrt.place, self.newmoon)

            hses = houses.Houses(self.time.jd, 0, chrt.place.lat,
                                 chrt.place.lon, chrt.options.hsys,
                                 chrt.obl[0], chrt.options.ayanamsha,
                                 chrt.ayanamsha)
            moon = planets.Planet(self.time.jd, astrology.SE_MOON, self.flags,
                                  chrt.place.lat, hses.ascmc2)
            if self.newmoon:
                self.lon = moon.data[planets.Planet.LONG]
            else:
                if chrt.options.syzmoon == options.Options.MOON:
                    self.lon = moon.data[planets.Planet.LONG]
                elif chrt.options.syzmoon == options.Options.ABOVEHOR:
                    if moon.abovehorizon:
                        self.lon = moon.data[planets.Planet.LONG]
                    else:
                        sun = planets.Planet(self.time.jd, astrology.SE_SUN,
                                             self.flags)
                        self.lon = sun.data[planets.Planet.LONG]
                else:
                    moon = planets.Planet(self.time.jd, astrology.SE_MOON,
                                          self.flags, chrt.place.lat,
                                          chrt.houses.ascmc2)
                    if moon.abovehorizon:
                        self.lon = moon.data[planets.Planet.LONG]
                    else:
                        sun = planets.Planet(self.time.jd, astrology.SE_SUN,
                                             self.flags)
                        self.lon = sun.data[planets.Planet.LONG]

        ra, decl, dist = astrology.swe_cotrans(self.lon, 0.0, 1.0,
                                               -chrt.obl[0])
        self.speculum = [self.lon, 0.0, ra, decl]

        #the other syzygy (i.e. if the syzygy was conjunction then calculate the opposition and vice versa)
        self.lon2 = chrt.planets.planets[astrology.SE_MOON].data[
            planets.Planet.LONG]
        if not chrt.time.bc:
            self.time2 = self.time
            ok, self.time2, self.ready2 = self.getDateHour(
                self.time2, chrt.place, not self.newmoon)
            if not self.ready2:
                ok, self.time2, self.ready2 = self.getDateMinute(
                    self.time2, chrt.place, not self.newmoon)
                if not self.ready2:
                    ok, self.time2, self.ready2 = self.getDateSecond(
                        self.time2, chrt.place, not self.newmoon)

            hses2 = houses.Houses(self.time2.jd, 0, chrt.place.lat,
                                  chrt.place.lon, chrt.options.hsys,
                                  chrt.obl[0], chrt.options.ayanamsha,
                                  chrt.ayanamsha)
            moon2 = planets.Planet(self.time2.jd, astrology.SE_MOON,
                                   self.flags, chrt.place.lat, hses2.ascmc2)
            if not self.newmoon:
                self.lon2 = moon2.data[planets.Planet.LONG]
            else:
                if chrt.options.syzmoon == options.Options.MOON:
                    self.lon2 = moon2.data[planets.Planet.LONG]
                elif chrt.options.syzmoon == options.Options.ABOVEHOR:
                    if moon2.abovehorizon:
                        self.lon2 = moon2.data[planets.Planet.LONG]
                    else:
                        sun2 = planets.Planet(self.time2.jd, astrology.SE_SUN,
                                              self.flags)
                        self.lon2 = sun2.data[planets.Planet.LONG]
                else:
                    moon2 = planets.Planet(self.time2.jd, astrology.SE_MOON,
                                           self.flags, chrt.place.lat,
                                           chrt.houses.ascmc2)
                    if moon2.abovehorizon:
                        self.lon2 = moon2.data[planets.Planet.LONG]
                    else:
                        sun2 = planets.Planet(self.time2.jd, astrology.SE_SUN,
                                              self.flags)
                        self.lon2 = sun2.data[planets.Planet.LONG]

            ra2, decl2, dist2 = astrology.swe_cotrans(self.lon2, 0.0, 1.0,
                                                      -chrt.obl[0])
            self.speculum2 = [self.lon2, 0.0, ra2, decl2]

            #for topical almutens
            self.lons.append(self.lon)  #Default
            if self.newmoon:  #Conjunction
                self.lons.append(self.lon)
            else:
                self.lons.append(self.lon2)
            #Moon in chart of Syzygy
            hses = houses.Houses(self.time.jd, 0, chrt.place.lat,
                                 chrt.place.lon, chrt.options.hsys,
                                 chrt.obl[0], chrt.options.ayanamsha,
                                 chrt.ayanamsha)
            moonSyz = planets.Planet(self.time.jd, astrology.SE_MOON,
                                     self.flags, chrt.place.lat, hses.ascmc2)
            hses2 = houses.Houses(self.time2.jd, 0, chrt.place.lat,
                                  chrt.place.lon, chrt.options.hsys,
                                  chrt.obl[0], chrt.options.ayanamsha,
                                  chrt.ayanamsha)
            moonSyz2 = planets.Planet(self.time2.jd, astrology.SE_MOON,
                                      self.flags, chrt.place.lat, hses2.ascmc2)
            if not self.newmoon:  #Opposition
                if moonSyz.abovehorizon:
                    self.lons.append(moonSyz.data[planets.Planet.LONG])
                else:
                    sun = planets.Planet(self.time.jd, astrology.SE_SUN,
                                         self.flags)
                    self.lons.append(sun.data[planets.Planet.LONG])
            else:
                if moonSyz2.abovehorizon:
                    self.lons.append(moonSyz2.data[planets.Planet.LONG])
                else:
                    sun2 = planets.Planet(self.time2.jd, astrology.SE_SUN,
                                          self.flags)
                    self.lons.append(sun2.data[planets.Planet.LONG])
            if not self.newmoon:  #OppositionRadix
                moon = planets.Planet(self.time.jd, astrology.SE_MOON,
                                      self.flags, chrt.place.lat,
                                      chrt.houses.ascmc2)
                if moon.abovehorizon:
                    self.lons.append(moon.data[planets.Planet.LONG])
                else:
                    sun = planets.Planet(self.time.jd, astrology.SE_SUN,
                                         self.flags)
                    self.lons.append(sun.data[planets.Planet.LONG])
            else:
                moon = planets.Planet(self.time2.jd, astrology.SE_MOON,
                                      self.flags, chrt.place.lat,
                                      chrt.houses.ascmc2)
                if moon.abovehorizon:
                    self.lons.append(moon.data[planets.Planet.LONG])
                else:
                    sun = planets.Planet(self.time.jd, astrology.SE_SUN,
                                         self.flags)
                    self.lons.append(sun.data[planets.Planet.LONG])
            if not self.newmoon:  #Opposition Moon
                self.lons.append(moonSyz.data[planets.Planet.LONG])
            else:
                self.lons.append(moonSyz2.data[planets.Planet.LONG])
Esempio n. 14
0
	def cycle(self, time1, chrt, time2):
		for j in range (planets.Planets.PLANETS_NUM-2):
			#skip Moon
			if j == astrology.SE_MOON:
				continue

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

			for a in range(len(chart.Chart.Aspects)):
				#skip minor aspects
				if a == chart.Chart.SEMISEXTIL or a == chart.Chart.SEMIQUADRAT or a == chart.Chart.QUINTILE or a == chart.Chart.SESQUIQUADRAT or a == chart.Chart.BIQUINTILE or a == chart.Chart.QUINQUNX:
					continue
				for l in range(2):
					if l == 1 and (a == chart.Chart.CONJUNCTIO or a == chart.Chart.OPPOSITIO):
						continue
					for k in range (planets.Planets.PLANETS_NUM-2):
						lon = chrt.planets.planets[k].data[planets.Planet.LONG]
						if l == 0:
							lon += chart.Chart.Aspects[a]
							if lon > 360.0:
								lon -= 360.0
						else:
							lon -= chart.Chart.Aspects[a]
							if lon < 0.0:
								lon += 360.0

						tr = self.get(planet1, planet2, time1, chrt, lon, j, k, a, Transits.HOUR, Transit.PLANET)
						if tr != None:
							self.transits.append(tr)

					#ascmc
					for h in range(2):
						lon = chrt.houses.ascmc[h]
						if l == 0:
							lon += chart.Chart.Aspects[a]
							if lon > 360.0:
								lon -= 360.0
						else:
							lon -= chart.Chart.Aspects[a]
							if lon < 0.0:
								lon += 360.0

						tr = self.get(planet1, planet2, time1, chrt, lon, j, h, a, Transits.HOUR, Transit.ASCMC)
						if tr != None:
							self.transits.append(tr)

			#signs
			signs = [0.0, 30.0, 60.0, 90.0, 120.0, 150.0, 180.0, 210.0, 240.0, 270.0, 300.0, 330.0]
			for s in range(len(signs)):
				lona = signs[s]
				if chrt.options.ayanamsha != 0:
					lona += chrt.ayanamsha
					lona = util.normalize(lona)

				tr = self.get(planet1, planet2, time1, chrt, lona, j, 0, 0, Transits.HOUR, Transit.SIGN)
				if tr != None:
					self.transits.append(tr)

			#Antiscia
			for p in range (planets.Planets.PLANETS_NUM-2):
				lona = chrt.antiscia.plantiscia[p].lon
#!?				if chrt.options.ayanamsha != 0:
#					lona += chrt.ayanamsha
#					lona = util.normalize(lona)

				tr = self.get(planet1, planet2, time1, chrt, lona, j, p, chart.Chart.CONJUNCTIO, Transits.HOUR, Transit.ANTISCION)
				if tr != None:
					self.transits.append(tr)

			#ContraAntiscia
			for p in range (planets.Planets.PLANETS_NUM-2):
				lona = chrt.antiscia.plcontraant[p].lon
#!?				if chrt.options.ayanamsha != 0:
#					lona += chrt.ayanamsha
#					lona = util.normalize(lona)

				tr = self.get(planet1, planet2, time1, chrt, lona, j, p, chart.Chart.CONJUNCTIO, Transits.HOUR, Transit.CONTRAANTISCION)
				if tr != None:
					self.transits.append(tr)

			#LoF
			tr = self.get(planet1, planet2, time1, chrt, chrt.fortune.fortune[fortune.Fortune.LON], j, 0, 0, Transits.HOUR, Transit.LOF)
			if tr != None:
				self.transits.append(tr)
Esempio n. 15
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)
Esempio n. 16
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
Esempio n. 17
0
# Links to planetary constants through "planets" are added
# 
# Aymeric Spiga and Alexandre Boissinot
####################################################
import numpy as np
import netCDF4 as nc
import planets

####################################################
### NetCDF file that contains ps, u, v and T
ncfile = "Xhistins_270_red.nc"
### txt file that contains ap and bp coefficients
txtfile = "apbp.txt"
### planetary constants
#myp = planets.Saturn
myp = planets.Planet() ; myp.ini("Saturn_dynamico",whereset="./")
### pressure grid
p_upper,p_lower,nlev = 1e2,3.5e5,50 # whole atm
targetp1d = np.logspace(np.log10(p_lower),np.log10(p_upper),nlev)
### reference pressure
p0 = targetp1d[0]+1.
### potential temperature grid
profile_1d = None
profile_1d = np.array([195,200,205,210,215,220,225,230])
### output file name
output = "PVnew_"+ncfile
####################################################

# =====================
#  --- FUNCTIONS ---
# =====================
Esempio n. 18
0
    def calcTrueSolarArcRegressive(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

        #Subtract arc from 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 < 0.0:
            prSunPos += 360.0
            prSunPosEnd += 360.0
            transition = True

#		Find day in ephemeris
        while (prSunPos >= prSunPosEnd):
            y, m, d = util.decrDay(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):
            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
        th, tm, ts = util.decToDeg(tt)
        d1 = datetime.datetime(y, m, d, th, tm, ts)  #in GMT
        d2 = datetime.datetime(self.chart.time.year, self.chart.time.month,
                               self.chart.time.day, h, mi, s)  #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