Ejemplo n.º 1
0
def test_radar_view():
	lats=linspace(-13.0, -11.5, 40)
	lons=linspace(130., 132., 40)
	ber_loc=[-12.4, 130.85] #location of Berrimah radar
	gp_loc=[-12.2492,  131.0444]#location of CPOL at Gunn Point
	h=2.5*1000.0
	t0=systime()
	i_a, j_a, k_a=propigation.unit_vector_grid(lats, lons, h, gp_loc)
	print "unit_vector_compute took ", systime()-t0, " seconds"
	fw=0.1#degrees
	m_bump=5.0
	#b1=simul_winds.speed_bump(lats, lons, [-12.0, 131.0], fw)*m_bump
	#b2=-1.0*simul_winds.speed_bump(lats, lons, [-12.0, 131.1], fw)*m_bump
	u,v=simul_winds.unif_wind(lats, lons, 5.0, 75.0)
	up,vp=array(simul_winds.vortex(lats, lons,  [-12.5, 131.1], fw))*m_bump
	#up=u+(b1-b2)
	#vp=v-(b1-b2)
	w=v*0.0
	v_r=i_a*(up+u)+j_a*(vp+v)+k_a*w
	f=figure()
	mapobj=pres.generate_darwin_plot()
	pres.contour_vr(mapobj,lats, lons, v_r)
	savefig(os.getenv('HOME')+'/bom_mds/output/test_radar_view_gp.png')
	close(f)
	f=figure()
	mapobj=pres.generate_darwin_plot()
	pres.quiver_contour_winds(mapobj, lats, lons, (up+u),(vp+v))
	savefig(os.getenv('HOME')+'/bom_mds/output/test_pert2.png')
	close(f)
Ejemplo n.º 2
0
	def got_data_cb(self, windowid, context, x, y, data, info, time):
		treeselection = windowid.get_selection()
		model, paths = treeselection.get_selected_rows()
		refs = []
		for path in paths:
    			refs.append(Gtk.TreeRowReference.new(model, path))
		#refs = [path.append(Gtk.TreeRowReference.new(model, path)) for path in paths# different way of wording the above
		destpath = windowid.get_dest_row_at_pos(x, y)
		if destpath:
			destpath, position = destpath
			destiter = model.get_iter(destpath)
		else:
			#print "outside the rows"
			try: destiter = model.get_iter(len(model))
			except: destiter = False
		#handle internal drag/drops here
		sourceWidget = Gtk.drag_get_source_widget(context)		
		if sourceWidget == windowid:
			#print "internals"			
			if not destpath in paths:
				if (position == Gtk.TreeViewDropPosition.BEFORE):# or position == Gtk.TreeViewDropPosition.INTO_OR_BEFORE):
					print("into or before")
					for currentref in refs:
						model.move_before(model.get_iter(currentref.get_path()), destiter)
				else:
					print("else")
					for currentref in reversed(refs):
						model.move_after(model.get_iter(currentref.get_path()), destiter)
		else:

			##detach model improves performance but causes flicker # MAKES MIKE A SAD PANDA
			windowid.set_model(None)
			#f****n file managers handling differently :( nautilus sends plaintext, but pcman sends uris
			tempArray = []
			if data.get_text():
				for i in data.get_text().splitlines():
					tempArray.append(i)
			else:
				for i in data.get_uris():
					tempArray.append(i)
			from time import time as systime
			systime1 = systime()
			#got the data now split it up
			for i in tempArray:
				i = i.replace('file://','').replace('%20',' ') #simple but is way too slow
				if os.path.isdir(i):
					for root, dirs, files in os.walk(i):
						while Gtk.events_pending():
	    						Gtk.main_iteration()
						for name in files:
							#print(name)
							self.add_row(os.path.join(root, name), model, destiter)
				else:
					self.add_row(i, model, destiter)
			##reattach model
			print("%s%f%s%i" % ("Add Operation took ",systime() - systime1," Items:", len(model)))
			del(systime)
			windowid.set_model(model)

		context.finish(True, False, time)
Ejemplo n.º 3
0
def test_gracon():
	#setup
	noise_level=0.0#m/s
	nx=40
	ny=40
	fw=0.1
	m_bump=10.00
	t0=systime()
	lats=linspace(-13.5, -12.0, 40)
	lons=linspace(130.5, 131.5, 40)
	ber_loc=[-12.4, 130.85] #location of Berrimah radar
	gp_loc=[-12.2492,  131.0444]#location of CPOL at Gunn Point
	h=2.5*1000.0
	print 'calculating berimah UV', systime()-t0
	i_ber, j_ber, k_ber=propigation.unit_vector_grid(lats, lons, h, ber_loc)
	print 'calculating gp UV', systime()-t0
	i_gp, j_gp, k_gp=propigation.unit_vector_grid(lats, lons, h, gp_loc)
	#make winds
	u,v=simul_winds.unif_wind(lats, lons, 10.0, 75.0)
	up,vp=array(simul_winds.vortex(lats, lons,  [-12.5, 131.1], fw))*m_bump
	#make V_r measurements
	vr_ber=i_ber*(up+u)+j_ber*(vp+v) + (random.random([nx,ny])-0.5)*(noise_level*2.0)
	vr_gp=i_gp*(up+u)+j_gp*(vp+v)+ (random.random([nx,ny])-0.5)*(noise_level*2.0)
	#try to reconstruct the wind field
	igu, igv= simul_winds.unif_wind(lats, lons, 0.0, 90.0)
	gv_u=zeros(u.shape)
	gv_v=zeros(v.shape)
	f=0.0
	print igu.mean()
	
	angs=array(propigation.make_lobe_grid(ber_loc, gp_loc, lats,lons))
	wts=zeros(angs.shape, dtype=float)+1.0
	#for i in range(angs.shape[0]):
	#	for j in range(angs.shape[1]):
	#		if (angs[i,j] < 150.0) and (angs[i,j] > 30.0): wts[i,j]=1.0
	print 'Into fortran'
	gv_u,gv_v,f,u_array,v_array = gracon_vel2d.gracon_vel2d(gv_u,gv_v,f,igu,igv,i_ber,j_ber,i_gp,j_gp,vr_ber,vr_gp,wts, nx=nx,ny=ny)
	print u_array.mean()
	print f
	bnds=[0.,20.]
	f=figure()
	mapobj=pres.generate_darwin_plot()
	pres.quiver_contour_winds(mapobj, lats, lons, (up+u),(vp+v), bounds=bnds)
	savefig(os.getenv('HOME')+'/bom_mds/output/orig_winds_clean.png')
	close(f)
	f=figure()
	mapobj=pres.generate_darwin_plot()
	pres.quiver_contour_winds(mapobj, lats, lons, (wts*u_array +0.001),(wts*v_array +0.001), bounds=bnds)
	savefig(os.getenv('HOME')+'/bom_mds/output/recon_winds_clean.png')
	close(f)
	f=figure()
	mapobj=pres.generate_darwin_plot()
	pres.quiver_contour_winds(mapobj, lats, lons, (wts*u_array - (up+u)),(wts*v_array -(vp+v)))
	savefig(os.getenv('HOME')+'/bom_mds/output/errors_clean.png')
	close(f)
Ejemplo n.º 4
0
def test_angle_grid2():
	lats=linspace(-13.0, -11.5, 100)
	lons=linspace(130., 132., 100)
	ber_loc=[-12.4, 130.85] #location of Berrimah radar
	gp_loc=[-12.2492,  131.0444]#location of CPOL at Gunn Point
	h=10.0*1000.0
	t0=systime()
	i_a, j_a, k_a=propigation.unit_vector_grid(lats, lons, h, ber_loc)
	print "compute took ", systime()-t0, " seconds"
	f=figure()
	mapobj=pres.generate_darwin_plot()
	pres.contour_comp(mapobj,lats, lons, k_a)
	savefig(os.getenv('HOME')+'/bom_mds/output/test_angs.png')
	close(f)
Ejemplo n.º 5
0
    def __init__(self,timescale=1,realtime=False):
        """
        Instantiate a Scene object.  The timescale parameter indicates how
        TopoVis should adjust time delay as specified with a scene scripting
        command.  When the realtime parameter is True, the timescale parameter
        is ignored and each scene scripting command will take effect
        immediately once invoked.
        """
        self.plotters = []
        self.time = 0.0
        self.initialized = False
        self.timescale = timescale
        self.realtime = realtime
        self.evq = []        # Event queue
        self.uniqueId = 0    # Counter for generating unique IDs

        self.dim = (0,0)     # Terrain dimension
        self.nodes = {}      # Nodes' information
        self.links = set()   # Set of links between nodes
        self.lineStyles = {} # List of defined line styles
        self.fillStyles = {} # List of defined fill styles
        self.textStyles = {} # List of defined text styles

        if realtime:
            self.startTime = systime()
Ejemplo n.º 6
0
 def __init__(self, value, transition=None, target=None):
     value = _vectorize(value)
     self._current = value
     self.plumbing = Plumbing()
     self.plumbing.source = Sources.AdditiveTarget(target if target is not None else value)
     self.transition = transition or Pipes.identity()
     self._last_time = systime()
     self.dt = 0
Ejemplo n.º 7
0
    def transition(self, transition):
        pipes = _vectorize(transition)
        if pipes == self.plumbing.pipes:
            return

        # Make the pipes think they've been at the current position for 10
        # seconds for initialization purposes.
        Plumbing(source=Sources.constant(self._current), pipes=pipes).blend(systime(), 10.0)

        self.plumbing.pipes = pipes
Ejemplo n.º 8
0
 def grabScreenshot(self):
     self['key_green'].setText('')
     from datetime import datetime
     from time import time as systime
     now = systime()
     now = datetime.fromtimestamp(now)
     now = now.strftime('%Y-%m-%d_%H-%M-%S')
     filename = '/media/hdd/vti_screenshot_sysinfo_' + now + '.png'
     cmd = 'grab -po %s' % filename
     self.console.ePopen(cmd, self.screenshotFinished)
Ejemplo n.º 9
0
 def blend(self, time=None, dt = None):
     """ Updates the 'current' value and clears any modifications added to
     the target with target_add(val). """
     if time == None:
         time = systime()
     if dt == None:
         dt = time - self._last_time
     self.dt = dt
     self._last_time = time
     self._current = self.plumbing.blend(time, dt)
     return self.current
Ejemplo n.º 10
0
def radar_to_winds(datestr):
	#check to see if we have the radar files
	#check to see if there are deailased files
	





if __name__ == "__main__":
	t0=systime()
	print "the uber cool test"
	print sys.argv
	#save_cube_test(sys.argv[1], sys.argv[2], sys.argv[3])
	#simple_reconstruction_3d_pytest(sys.argv[1],sys.argv[2], sys.argv[3])
	recon(sys.argv[1], sys.argv[2], sys.argv[3])
	#test_pert_winds()
	#test_sounding()
	#dump_pickle(sys.argv[1])
	print "Finished running runtime=",systime()-t0, "Seconds"
Ejemplo n.º 11
0
	def rebuild_database(self):
		from time import time as systime
		systime1 = systime()

		#Tempory Database connection for thread
		conn = sqlite3.connect(self.dblocation)
		cursor = conn.cursor()
		trackparser = TrackMetaData()

		#clear out current database
		cursor.execute("DELETE FROM Songs")

		for libraryfolder in self.libraryfolders:
			libraryfolder = libraryfolder.replace('file://','').replace('%20',' ') #simple but is a bit slow
			if os.path.isdir(libraryfolder):
				for root, dirs, files in scandir.walk(libraryfolder):
					for name in files:
						metadata = trackparser.getTrackType(os.path.join(root, name))
						if metadata != False:
							#escape single quotes for sql query
							metadata[2] = metadata[2].replace("'","''")#Title
							metadata[3] = metadata[3].replace("'","''")#Artist
							metadata[4] = metadata[4].replace("'","''")#Album
							metadata[6] = metadata[6].replace("'","''")#Genre
							metadata[7] = metadata[7].replace("'","''")#Url

							#build query and encode to ascii for python 2
							#query = "INSERT INTO Songs(TrackNum,Title,Artist,Album,Length,Genre,Url) VALUES ({},'{}','{}','{}','{}','{}','{}');".format(metadata[1],metadata[2].encode('ascii','ignore'),metadata[3].encode('ascii','ignore'),metadata[4].encode('ascii','ignore'),metadata[5].encode('ascii','ignore'),metadata[6].encode('ascii','ignore'),metadata[7])
							
							#since we truncate anyway, checking for existing entrys is redundant for now
							"""cursor.execute("SELECT * FROM Songs WHERE Url='{}'".format(metadata[7]))
							if cursor.fetchone() == None:
								query = "INSERT INTO Songs(TrackNum,Title,Artist,Album,Length,Genre,Url) VALUES ({},'{}','{}','{}','{}','{}','{}');".format(metadata[1],metadata[2],metadata[3],metadata[4],metadata[5],metadata[6],metadata[7])
								cursor.execute(query)	
							else:
								query = "UPDATE Songs SET TrackNum='{}',Title='{}',Artist='{}',Album='{}',Length='{}',Genre='{}' WHERE Url='{}';".format(metadata[1],metadata[2],metadata[3],metadata[4],metadata[5],metadata[6],metadata[7])
								cursor.execute(query)"""
							query = "INSERT INTO Songs(TrackNum,Title,Artist,Album,Length,Genre,Url) VALUES ({},'{}','{}','{}','{}','{}','{}');".format(metadata[1],metadata[2],metadata[3],metadata[4],metadata[5],metadata[6],metadata[7])
							cursor.execute(query)	
				conn.commit()
		print("%s%f" % ("Operation took ",systime() - systime1))
Ejemplo n.º 12
0
    def __init__(self):
        self.property_store = PropertyStore()

        # Initialize artistic actuator functions.
        import artistic.actuators
        self.actuators = []
        with _set_global('_context', self.Context(systime(), 0)):
            for func in actuator_functions:
                enabled_getter = self.property_store.register_actuator(func.__name__)
                actuator = self.Actuator(func.__name__,
                    self.property_store.register_parameter,
                    self.property_store.register_image,
                    enabled_getter)
                actuator.generator = func(actuator) if _takes_nargs(func, 1) else func()
                self.actuators.append(actuator)
                actuator.generator.send(None)
Ejemplo n.º 13
0
 def execute(self, time, cmd, *args, **kwargs):
     """
     Execute the scene scripting command, cmd, with specified
     variable-length and keyword arguments
     """
     if self.realtime:
         self.setTime(systime()-self.startTime)
     else:
         # examine the event queue and execute everything prior to
         # the 'current time'
         while len(self.evq) > 0 and self.evq[0][0] < time:
             (t,proc,a,kw) = heappop(self.evq)
             self.setTime(t)
             proc(*a,**kw)
         self.setTime(time)
     if type(cmd) is str:
         exec 'self.' + cmd
     else:
         cmd(*args, **kwargs)
	def getFilename(self):
		now = systime()
		now = datetime.fromtimestamp(now)
		now = now.strftime("%Y-%m-%d_%H-%M-%S")

		screenshottime = "screenshot_" + now
		
		if config.plugins.shootyourscreen.pictureformat.value == "bmp":
			fileextension = ".bmp"
		elif config.plugins.shootyourscreen.pictureformat.value == "-j":
			fileextension = ".jpg"
		elif config.plugins.shootyourscreen.pictureformat.value == "-p":
			fileextension = ".png"

		picturepath = getPicturePath()
		if picturepath.endswith('/'):
			screenshotfile = picturepath + screenshottime + fileextension
		else:
			screenshotfile = picturepath + '/' + screenshottime + fileextension
		return screenshotfile
Ejemplo n.º 15
0
    def setTiming(self, scale=1, realtime=False):
		self.timescale = scale
		self.realtime = realtime
		if realtime:
			self.startTime = systime() - self.time
Ejemplo n.º 16
0
 def setVariablesBackup(self):
     if self.device == 'solo2':
         self.ubifsargs = '-m 2048 -e 126976 -c 4096'
         self.ubinizeargs = '-m 2048 -p 128KiB'
         self.mtdkernel = '2'
         self.rootfsname = 'root_cfe_auto.bin'
     elif self.device == 'zero':
         self.ubifsargs = '-m 2048 -e 126976 -c 4096'
         self.ubinizeargs = '-m 2048 -p 128KiB'
         self.mtdkernel = '2'
         self.rootfsname = 'root_cfe_auto.bin'
     elif self.device == 'solose':
         self.ubifsargs = '-m 2048 -e 126976 -c 4096'
         self.ubinizeargs = '-m 2048 -p 128KiB'
         self.mtdkernel = '2'
         self.rootfsname = 'root_cfe_auto.bin'
     elif self.device == 'duo2':
         self.ubifsargs = '-m 2048 -e 126976 -c 8192'
         self.ubinizeargs = '-m 2048 -p 128KiB'
         self.mtdkernel = '2'
         self.rootfsname = 'root_cfe_auto.bin'
     elif self.device == 'duo':
         self.boot_options = '--eraseblock=0x20000 -n -l'
         self.ubifsargs = '-m 2048 -e 126976 -c 4096 -F'
         self.ubinizeargs = '-m 2048 -p 128KiB'
         self.mtdkernel = '1'
         self.rootfsname = 'root_cfe_auto.jffs2'
     elif self.device == 'solo':
         self.boot_options = '--eraseblock=0x20000 -n -l'
         self.ubifsargs = '-m 2048 -e 126976 -c 4096 -F'
         self.ubinizeargs = '-m 2048 -p 128KiB'
         self.mtdkernel = '1'
         self.rootfsname = 'root_cfe_auto.jffs2'
     elif self.device == 'uno':
         self.boot_options = '--eraseblock=0x20000 -n -l'
         self.ubifsargs = '-m 2048 -e 126976 -c 4096 -F'
         self.ubinizeargs = '-m 2048 -p 128KiB'
         self.mtdkernel = '1'
         self.rootfsname = 'root_cfe_auto.jffs2'
     elif self.device == 'ultimo':
         self.boot_options = '--eraseblock=0x20000 -n -l'
         self.ubifsargs = '-m 2048 -e 126976 -c 3894 -F'
         self.ubinizeargs = '-m 2048 -p 128KiB'
         self.mtdkernel = '1'
         self.rootfsname = 'root_cfe_auto.jffs2'
     text = _('preparing backup of image')
     self['task_one'].setText(text)
     self.rootsize = self.getRootSize()
     self.boot_options = None
     self.ubicfgfile = '/tmp/ubinize.cfg'
     system('%s %s' % (self.touch, self.ubicfgfile))
     now = systime()
     now = datetime.fromtimestamp(now)
     now = now.strftime('%Y-%m-%d_%H-%M-%S')
     self.backuppath = self.backuppath + '/vti_' + self.vtiversion + '_backup-image_' + self.device + '_' + now + '/vuplus/' + self.device
     if self.createFolder():
         errmsg = _('Error at creating backup directories\nPlease try another backup location') + self.text_logfile_hint
         self.errorBox(errmsg)
         return
     if self.checkBinaries():
         self.startMount()
     else:
         errmsg = _('The system is missing some necessary files !')
         self.errorBox(errmsg)
Ejemplo n.º 17
0
    def run(self):
        screenMode = pygame.RESIZABLE

        oldPlay = stats['playTime']
        clock = pygame.time.Clock()
        self.running = True

        self.grid = [0, 0]

        debug = True
        dispWidth, dispHeight = 1024, 768
        self.menu = "game"
        game_time = pygame.time.get_ticks()
        playTime = font.render("Timer: ", False, pygame.Color('white'))        
        minutes = 0

        self.map = stats['map'][:-4].lower()
        self.map = self.map.lstrip("m") # Fix that stupid bug that changes "maze1" to "ze1"
        self.map = self.map.lstrip("aps/")
        
        try:
            while self.running:
                dt = (clock.tick() / 500)
                clock.tick(self.fps)

                if self.menu == "game":
                    #self.deep_thought()
                    if self.counter2 % 7 == 0:
                        heroPos = self.hero.position
                        self.animation(self.direction, self.counter)
                        self.hero.position = heroPos
                        #entityPos = self.entity.position
                        #self.EntityAnimation(self.EntityDirection, self.counter, "princess")
                        #self.entity.position = entityPos
                        
                        self.counter += 1
                        guiX = (dispWidth / 2) - 175
                        guiY = (dispHeight / 2) - 165
                        
                        self.group.remove(self.hero)
                        #self.group.remove(self.entity)
                        self.group.empty()
                        self.group.add(self.hero)
                        #self.group.add(self.entity)

                self.counter2 += 1
                if self.counter > 8:
                    self.counter = 1

                stats['pos'] = self.hero.position
                currentTime = systime()
                seconds = currentTime - gameStart + oldPlay
                dispWidth, dispHeight = pygame.display.get_surface().get_size()
                stats['playTime'] = seconds

                

                if debug == True and self.counter2 % 1 == 0:
                    location = font.render("Position: " + str(round(round(self.hero.position[0], -1) / 10)) + ", " + str(round(round(self.hero.position[1], -1) / 10)), False, pygame.Color('white'))
                    mapdebug = font.render("Map Name: " + str(self.map), False, pygame.Color('white'))
                    minutes = seconds // 60
                    secondsDisp = seconds % 60
                    if minutes < 1:
                        minutes = 0
                    if secondsDisp == 60:
                        secondsDisp = 0
                        minutes += 1
                    fps = font.render("FPS:" + str(int(clock.get_fps())), False, pygame.Color('white'))
                    screen.blit(fps, (50, 50))
                    screen.blit(playTime, (50,100))
                    screen.blit(location, (50,75))
                    screen.blit(mapdebug, (50, 125))

                    playTime = font.render("Timer: " + str(floor(minutes)) + " : " + str(round(secondsDisp)), True, pygame.Color('white'))
                    screen.blit(playTime, (50,100))    


                self.blit_inventory(str(self.menu))
                      
                pygame.display.update()
                #pygame,display.flip()
                self.handle_input(self.menu)
                self.update(dt)
                self.draw(screen)

        except KeyboardInterrupt:
            self.running = False
            pygame.quit()
Ejemplo n.º 18
0
                    
                pygame.display.update()
                self.handle_input(self.menu)
                self.update(dt)
                self.draw(screen)

        except KeyboardInterrupt:
            self.running = False
            pygame.quit()


if __name__ == "__main__":
    screenMode = pygame.RESIZABLE
    pygame.init()
    pygame.font.init()
    screen = init_screen(1024, 768, screenMode)
    pygame.display.set_caption('Quest - An epic journey.')
    font = pygame.font.Font(get_resource("GameFont.ttf"), 20)
    clock = pygame.time.Clock()
    done = False
    gameStart = systime()
    inventory = pickle.load(open("data/saves/inventory.dat", "rb"))
    stats = pickle.load(open(os.path.join("data", "saves", "save.dat"), "rb"))
    
    try:
        game = QuestGame(False)
        game.run()
    except:
        pygame.quit()
        raise
Ejemplo n.º 19
0
    def run(self):
        screenMode = pygame.RESIZABLE
        self.map = stats['map'][:-4].lower()
        self.map = self.map.lstrip("maps/")
        oldPlay = stats['playTime']
        clock = pygame.time.Clock()
        self.running = True
        debug = True
        dispWidth, dispHeight = 1024, 768
        self.menu = "game"
        game_time = pygame.time.get_ticks()
        playTime = font.render("Timer: ", False, pygame.Color('white'))        
        minutes = 0
        try:
            while self.running:                  
                dt = (clock.tick() / 500)
                clock.tick(self.fps)
                if self.counter2 == 5:
                    heroPos = self.hero.position
                    self.animation(self.direction, self.counter)
                    self.counter += 1
                    self.counter2 = 0
                    guiX = (dispWidth / 2) - 175
                    guiY = (dispHeight / 2) - 165
                    self.hero.position = heroPos
                self.counter2 += 1
                if self.counter > 9:
                    self.counter = 1
                stats['pos'] = self.hero.position
                currentTime = systime()
                seconds = currentTime - gameStart + oldPlay
                dispWidth, dispHeight = pygame.display.get_surface().get_size()
                stats['playTime'] = seconds
                self.group.remove(self)
                self.group.add(self.hero)


                    
                if debug == True:
                    location = font.render("Position: " + str(round(round(self.hero.position[0], -1) / 10)) + ", " + str(round(round(self.hero.position[1], -1) / 10)), False, pygame.Color('white'))
                    fps = font.render("FPS:" + str(int(clock.get_fps())), False, pygame.Color('white'))
                    mapdebug = font.render("Map Name: " + str(self.map), False, pygame.Color('white'))
                    minutes = seconds // 60
                    secondsDisp = seconds % 60
                    if minutes < 1:
                        minutes = 0
                    if secondsDisp == 60:
                        secondsDisp = 0
                        minutes += 1
                    playTime = font.render("Timer: " + str(floor(minutes)) + " : " + str(round(secondsDisp)), True, pygame.Color('white'))
                    screen.blit(playTime, (50,100))
                    screen.blit(fps, (50, 50))
                    screen.blit(location, (50,75))
                    screen.blit(mapdebug, (50, 125))
                    

                if self.menu == "inventory":
                    screen.blit(load_image(os.path.join("Images", "transparent.png")),( 0, 0))
                    screen.blit(load_image(os.path.join("Images", "inventory.png")),(guiX, guiY))
                    if inventory["sword"] == True:
                        screen.blit(load_image(os.path.join("Images", "sword.png")),( guiX + 16, guiY + 168))
                    if inventory["axe"] == True:
                        screen.blit(load_image(os.path.join("Images", "axe.png")),( guiX + 52, guiY + 168))
                    if inventory["bow"] == True:
                        screen.blit(load_image(os.path.join("Images", "bow.png")),( guiX + 88, guiY + 168))
                    if inventory["shovel"] == True:
                        screen.blit(load_image(os.path.join("Images", "shovel.png")),( guiX + 124, guiY + 168))
                    
                pygame.display.update()
                self.handle_input(self.menu)
                self.update(dt)
                self.draw(screen)

        except KeyboardInterrupt:
            self.running = False
            pygame.quit()
Ejemplo n.º 20
0
from matplotlib import figure
from pylab import *
from time import time as systime
from numpy import linspace, array, arctan, pi, random
import pickle_zip


def dump_pickle(pickle_name):
    locs = {
        "Berrimah": [-12.457, 130.925],
        "C-POL": [-12.2492, 131.0444],
        "Berrimah_deal": [-12.457, 130.925],
        "C-POL_deal": [-12.2492, 131.0444],
    }
    basedir = "/bm/gkeep/scollis/deal_ber/"
    radar = pickle_zip.load(basedir + pickle_name)
    pres.dump_radar(radar, locs[radar[0]["radar_name"]])


if __name__ == "__main__":
    t0 = systime()
    print "the uber cool test"
    print sys.argv
    # save_cube_test(sys.argv[1], sys.argv[2], sys.argv[3])
    # simple_reconstruction_3d_pytest(sys.argv[1],sys.argv[2], sys.argv[3])
    # recon(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
    # test_pert_winds()
    # test_sounding()
    dump_pickle(sys.argv[1])
    print "Finished running runtime=", systime() - t0, "Seconds"
Ejemplo n.º 21
0
    def stabilize_n_takeIV(self, bg_task=None, *bg_tasks):

        dataset = []
        oRes2 = self.oRes2
        oApplet = oRes2.oApplet
        self.do_tasks(bg_task, *bg_tasks)

        try:

            self.modTCON.set_n_stabilize(self.do_tasks, bg_task, *bg_tasks)
            if not self.modTCON.complete():

                self.modXHIRES.init()

                while True:

                    self.do_tasks(bg_task, *bg_tasks)
                    tcon_datapoint = self.modTCON.acquire_n_plot()
                    xhires_datapoint, breakPlot = self.modXHIRES.excite_n_plot(
                        self.do_tasks, bg_task, *bg_tasks)

                    if breakPlot:
                        dataset.append(self.breakPlot())

                    if not self.modXHIRES.complete():
                        datapoint = DataPoint(
                            time=systime() - self.t0,
                            current=xhires_datapoint.current,
                            voltage=xhires_datapoint.voltage,
                            resistance=xhires_datapoint.resistance,
                            sampleTemperature=tcon_datapoint.sampleTemperature,
                            heaterTemperature=tcon_datapoint.heaterTemperature)

                        self.update_log(datapoint)
                        self.dataset.append(datapoint)
                        dataset.append(datapoint)

                        oApplet.schedule_task(oApplet.updatePlot, self,
                                              datapoint.voltage,
                                              datapoint.current)

                    else:
                        dataset.append(self.breakPlot())
                        break

                self.modXHIRES.atexit()

        except (TCON_CommError, TCON_LinkError) as e:
            oApplet.schedule_task(oApplet.set_status, str(e))
            raise

        except (XHIRES_CommError, XHIRES_LinkError) as e:
            oApplet.schedule_task(oApplet.set_status, str(e))
            raise

        except (IOError, OSError) as e:
            text = e.strerror + ' on ' + e.filename
            oApplet.schedule_task(oApplet.set_status, text)
            raise

        return dataset