def Jupiter(): Jupiter = ((ephem.Io(), 'i'), (ephem.Europa(), 'e'), (ephem.Ganymede(), 'g'), (ephem.Callisto(), 'c')) try: t = Twitter(auth=OAuth( jupitertwitter['AccessToken'], jupitertwitter['AccessTokenSecret'], jupitertwitter['ConsumerKey'], jupitertwitter['ConsumerSecret'])) except: t = None return asciimoonpos(Jupiter, 'J', duration=.1), t, 'jupitermoonpos'
def get_objects(additional_catalogs_list: List[str]) -> dict: """Return a dictionary of all objects.""" object_dict = {} #Solar System object_dict['sun'] = (ephem.Sun(), 'solar_system') object_dict['mercury'] = (ephem.Mercury(), 'solar_system') object_dict['venus'] = (ephem.Venus(), 'solar_system') object_dict['moon'] = (ephem.Moon(), 'solar_system') object_dict['mars'] = (ephem.Mars(), 'solar_system') object_dict['phobos'] = (ephem.Phobos(), 'planetary_moon') object_dict['deimos'] = (ephem.Deimos(), 'planetary_moon') object_dict['jupiter'] = (ephem.Jupiter(), 'solar_system') object_dict['ganymede'] = (ephem.Ganymede(), 'planetary_moon') object_dict['callisto'] = (ephem.Callisto(), 'planetary_moon') object_dict['io'] = (ephem.Io(), 'planetary_moon') object_dict['europa'] = (ephem.Europa(), 'planetary_moon') object_dict['saturn'] = (ephem.Saturn(), 'solar_system') object_dict['titan'] = (ephem.Titan(), 'planetary_moon') object_dict['iapetus'] = (ephem.Iapetus(), 'planetary_moon') object_dict['rhea'] = (ephem.Rhea(), 'planetary_moon') object_dict['tethys'] = (ephem.Tethys(), 'planetary_moon') object_dict['dione'] = (ephem.Dione(), 'planetary_moon') object_dict['enceladus'] = (ephem.Enceladus(), 'planetary_moon') object_dict['mimas'] = (ephem.Mimas(), 'planetary_moon') object_dict['uranus'] = (ephem.Uranus(), 'solar_system') object_dict['titania'] = (ephem.Titania(), 'planetary_moon') object_dict['oberon'] = (ephem.Oberon(), 'planetary_moon') object_dict['hyperion'] = (ephem.Hyperion(), 'planetary_moon') object_dict['ariel'] = (ephem.Ariel(), 'planetary_moon') object_dict['umbriel'] = (ephem.Umbriel(), 'planetary_moon') object_dict['miranda'] = (ephem.Miranda(), 'planetary_moon') object_dict['neptune'] = (ephem.Neptune(), 'solar_system') object_dict['pluto'] = (ephem.Pluto(), 'solar_system') for file,object_type in additional_catalogs_list: object_dict.update(read_file(file, object_type)) return object_dict
def findmoons(): moons = ((ephem.Io(), 'i'), (ephem.Europa(), 'e'), (ephem.Ganymede(), 'g'), (ephem.Callisto(), 'c')) # How to place discrete characters on a line that actually represents # the real numbers -maxradii to +maxradii. linelen = 72 maxradii = 36 def put(line, character, radii): if abs(radii) > maxradii: return offset = radii / maxradii * (linelen - 1) / 2 i = int(linelen / 2 + offset) line[i] = character interval = ephem.hour * 3 #hours between datapoints now = ephem.now() #right now now -= now % interval
#turn all leds to black (off) offspot = 1 offcolor = 0x000000 nump = 73 while offspot < nump: strip.setPixelColor(offspot, offcolor) offspot += 1 strip.show() #PYEPHEM PART--GET MOON SPOTS moons = ((ephem.Io(), 'i'), (ephem.Europa(), 'e'), (ephem.Ganymede(), 'g'), (ephem.Callisto(), 'c')) linelen = 72 maxradii = 36 def put(line, character, radii): if abs(radii) > maxradii: return offset = radii / maxradii * (linelen - 1) / 2 i = int(linelen / 2 + offset) line[i] = character def strandtest(): #!/usr/bin/python # Simple strand test for Adafruit Dot Star RGB LED strip.
def findmoons(): moons = ((ephem.Io(), 'i'), (ephem.Europa(), 'e'), (ephem.Ganymede(), 'g'), (ephem.Callisto(), 'c')) # How to place discrete characters on a line that actually represents # the real numbers -maxradii to +maxradii. linelen = 72 maxradii = 36 def put(line, character, radii): if abs(radii) > maxradii: return offset = radii / maxradii * (linelen - 1) / 2 i = int(linelen / 2 + offset) line[i] = character interval = ephem.hour * 3 #hours between datapoints now = ephem.now() #right now now -= now % interval """#prints characters relative to jupiter while True: t = now - 3 print '------------------------' while t < now + 3: line = [' '] * linelen put(line, 'J', 0) for moon, character in moons: moon.compute(t) put(line, character, moon.x) #print str(ephem.date(t))[5:16], ''.join(line).rstrip() t += interval time.sleep(.1) print 'East is to the right;' print ', '.join([ '%s = %s' % (c, m.name) for m, c in moons ]) """ #Shows offsets for every interval t while True: now = ephem.now() #right now now -= now % interval t = now - 1 print '------------------------' while t < now + 1: line = [' '] * linelen put(line, 'J', 0) for moon, character in moons: moon.compute(t) put(line, character, moon.x) readout = character, int(moon.x) #print str(ephem.date(t))[5:16], readout #for each character at a given time, light the appropriate color LED at 36 + int(moon.x). Brightness += brightness until .75. If t == now, brightness == 1.0, time.sleep(3) for char in character: #print "At date ", str(ephem.date(t)), "", character, " was at position ", int(moon.x) #print str(ephem.date(t)) if 'i' in character: iopos = int(moon.x) #Io offset from Jupiter at time t print iopos #<--convert these to strip.setPixelColor(spot, color) elif 'e' in character: eurpos = int(moon.x) #Europa offset print eurpos elif 'g' in character: ganpos = int(moon.x) #Ganymede offset print ganpos elif 'c' in character: #Calypso offset calpos = int(moon.x) print calpos if t == now: print "\nCURRENT\n" #<--convert to a superbrightness variable elif t != now: print str(ephem.date(t))[5:16] t += interval print '\n**************\n' time.sleep(2)
def convertCelestialToHorizonNow(job, location): bodyName = job['body'] dt = datetime.datetime.now() dt = str(dt.year) + '/' + str(dt.month) + '/' + str( dt.day) + ' ' + str(dt.hour - 1) + ':' + str(dt.minute) gatech = ephem.Observer() gatech.epoch = dt if bodyName == "Sun": body = ephem.Sun() elif bodyName == "Moon": body = ephem.Moon() elif bodyName == "Mercury": body = ephem.Mercury() elif bodyName == "Venus": body = ephem.Venus() elif bodyName == "Mars": body = ephem.Mars() elif bodyName == "Phobos": body = ephem.Phobos() elif bodyName == "Deimos": body = ephem.Deimos() elif bodyName == "Jupiter": body = ephem.Jupiter() elif bodyName == "Io": body = ephem.Io() elif bodyName == "Europa": body = ephem.Europa() elif bodyName == "Ganymede": body = ephem.Ganymede() elif bodyName == "Callisto": body = ephem.Callisto() elif bodyName == "Saturn": body = ephem.Saturn() elif bodyName == "Mimas": body = ephem.Mimas() elif bodyName == "Enceladus": body = ephem.Enceladus() elif bodyName == "Tethys": body = ephem.Tethys() elif bodyName == "Dione": body = ephem.Dione() elif bodyName == "Rhea": body = ephem.Rhea() elif bodyName == "Titan": body = ephem.Titan() elif bodyName == "Iapetus": body = ephem.Iapetus() elif bodyName == "Hyperion": body = ephem.Hyperion() elif bodyName == "Uranus": body = ephem.Uranus() elif bodyName == "Miranda": body = ephem.Miranda() elif bodyName == "Ariel": body = ephem.Ariel() elif bodyName == "Umbriel": body = ephem.Umbriel() elif bodyName == "Titania": body = ephem.Titania() elif bodyName == "Oberon": body = ephem.Oberon() elif bodyName == "Neptune": body = ephem.Neptune() elif bodyName == "Pluto": body = ephem.Pluto() else: body = ephem.star(bodyName) geolocator = Nominatim() location = geolocator.geocode(location) gatech.lon, gatech.lat = str(location.longitude), str(location.latitude) gatech.date = dt body.compute(gatech) return body
""" Created on Sun Dec 23 22:06:24 2018 @author: ahmed help arabe lang: https://stackoverflow.com/questions/15421746/matplotlib-writing-right-to-left-text-hebrew-arabic-etc """ # IMPORTATION from pylab import * import ephem as ep # ARABE import arabic_reshaper from bidi.algorithm import get_display # NOUS CRÉONS UN OBJET Io = ep.Io() Eu = ep.Europa() Ga = ep.Ganymede() Ca = ep.Callisto() # Créons des tableaux vide pour # SAUVEGARDER LES COORDONNEES y = [] xIo = [] xEu = [] xGa = [] xCa = [] # pas de temps - heure dt = ep.hour # temps initial ts = ep.now() # heure actuelle tm = ts N = 2 * 24