示例#1
0
	def callback_normtoone_y(self, data, widget):
		if widget.get_active()==True:
			self.plot_token.normalize=True
		else:
			self.plot_token.normalize=False
		plot_save_oplot_file(self.config_file,self.plot_token)
		self.do_plot()
示例#2
0
	def callback_norm_to_peak_of_all_data(self, data, widget):
		if widget.get_active()==True:
			self.plot_token.norm_to_peak_of_all_data=True
		else:
			self.plot_token.norm_to_peak_of_all_data=False
		plot_save_oplot_file(self.config_file,self.plot_token)
		self.do_plot()
示例#3
0
	def callback_units(self):
		if len(self.data)>0:
			units=dlg_get_text( "Units:", self.data[0].key_units)
			if units!=None:
				self.data[0].key_units=units
			plot_save_oplot_file(self.config_file,self.data[0])
			self.do_plot()
示例#4
0
 def callback_toggle_subtract_first_point(self):
     if len(self.data) > 0:
         self.data[
             0].subtract_first_point = not self.data[0].subtract_first_point
         plot_save_oplot_file(self.config_file, self.data[0])
         self.norm_data()
         self.do_plot()
示例#5
0
    def keyPressEvent(self, event):
        keyname = event.key()
        if (keyname > 64 and keyname < 91) or (keyname > 96 and keyname < 123):
            modifiers = event.modifiers()
            keyname = chr(keyname)
            if keyname.isalpha() == True:
                if Qt.ShiftModifier == modifiers:
                    keyname = keyname.upper()
                else:
                    keyname = keyname.lower()
        else:
            return

        if keyname == "a":
            self.do_plot()
        elif keyname == "q":
            self.destroy()
        elif modifiers == Qt.ControlModifier and keyname == 'c':
            self.do_clip()

        if len(self.data) > 0:
            if keyname == 'g':
                if self.data[0].grid == False:
                    for i in range(0, len(self.ax)):
                        self.ax[i].grid(True)
                    self.data[0].grid = True
                else:
                    for i in range(0, len(self.ax)):
                        self.ax[i].grid(False)
                    self.data[0].grid = False
            elif keyname == "r":
                if self.lx == None:
                    for i in range(0, len(self.ax)):
                        self.lx = self.ax[i].axhline(color='k')
                        self.ly = self.ax[i].axvline(color='k')
                self.lx.set_ydata(self.ydata)
                self.ly.set_xdata(self.xdata)

            elif keyname == "l":
                if self.data[0].logy == True:
                    self.data[0].logy = False
                    for i in range(0, len(self.ax)):
                        self.ax[i].set_yscale("linear")
                else:
                    self.data[0].logy = True
                    for i in range(0, len(self.ax)):
                        self.ax[i].set_yscale("log")

            elif keyname == "L":
                if self.data[0].logx == True:
                    self.data[0].logx = False
                    for i in range(0, len(self.ax)):
                        self.ax[i].set_xscale("linear")
                else:
                    self.data[0].logx = True
                    for i in range(0, len(self.ax)):
                        self.ax[i].set_xscale("log")

            self.fig.canvas.draw()
            plot_save_oplot_file(self.config_file, self.data[0])
示例#6
0
 def callback_norm_to_peak_of_all_data(self):
     if len(self.data) > 0:
         self.data[0].norm_to_peak_of_all_data = not self.data[
             0].norm_to_peak_of_all_data
         plot_save_oplot_file(self.config_file, self.data[0])
         self.norm_data()
         self.do_plot()
示例#7
0
	def plot_results(self,plot_token):
		plot_token.key_units=self.get_units()
		print("scanning",self.sim_dir)
		plot_files, plot_labels, config_file = scan_gen_plot_data(plot_token,self.sim_dir)
		print(plot_files, plot_labels)
		plot_save_oplot_file(config_file,plot_token)
		plot_gen(plot_files,plot_labels,config_file)

		self.last_plot_data=plot_token
		return
示例#8
0
    def plot_results(self, plot_token):
        plot_token.key_units = self.get_units()
        #print("scanning",self.sim_dir)
        plot_files, plot_labels, config_file = scan_gen_plot_data(
            plot_token, self.sim_dir)
        #print(plot_files, plot_labels)
        plot_save_oplot_file(config_file, plot_token)
        plot_gen(plot_files, plot_labels, config_file)

        self.last_plot_data = plot_token
        return
示例#9
0
	def plot_results(self,plot_token):
		plot_token.key_units=self.get_units()
		print "here!!!!!!!!!!"
		plot_files, plot_labels, config_file = scan_gen_plot_data(plot_token,self.sim_dir)
		print plot_files, plot_labels
		plot_save_oplot_file(config_file,plot_token)
		plot_gen(plot_files,plot_labels,config_file)
		self.plot_open.set_sensitive(True)

		self.last_plot_data=plot_token

		return 
示例#10
0
	def keyPressEvent(self, event):
		
		keyname=event.key()
		modifiers = int(event.modifiers())

		if keyname=="a":
			self.do_plot()

		if keyname=="g":
			if self.plot_token.grid==False:
				for i in range(0,len(self.ax)):
					self.ax[i].grid(True)
				self.plot_token.grid=True
			else:
				for i in range(0,len(self.ax)):
					self.ax[i].grid(False)
				self.plot_token.grid=False
		if keyname=="r":
			if self.lx==None:
				for i in range(0,len(self.ax)):
					self.lx = self.ax[i].axhline(color='k')
					self.ly = self.ax[i].axvline(color='k')
			self.lx.set_ydata(self.ydata)
			self.ly.set_xdata(self.xdata)

		if keyname=="l":
			if self.plot_token.logy==True:
				self.plot_token.logy=False
				for i in range(0,len(self.ax)):
					self.ax[i].set_yscale("linear")
			else:
				self.plot_token.logy=True
				for i in range(0,len(self.ax)):
					self.ax[i].set_yscale("log")

		if keyname=="L":
			if self.plot_token.logx==True:
				self.plot_token.logx=False
				for i in range(0,len(self.ax)):
					self.ax[i].set_xscale("linear")
			else:
				self.plot_token.logx=True
				for i in range(0,len(self.ax)):
					self.ax[i].set_xscale("log")

		if keyname=="q":
			self.destroy()

		if (Qt.CTRL & modifiers)==modifiers and keyname==67:
			self.do_clip()

		self.fig.canvas.draw()
		plot_save_oplot_file(self.config_file,self.plot_token)
示例#11
0
	def on_key_press_event(self,widget, event):
		keyname = gtk.gdk.keyval_name(event.keyval)
		#print "Key %s (%d) was pressed" % (keyname, event.keyval)
		if keyname=="a":
			self.do_plot()

		if keyname=="g":
			if self.plot_token.grid==False:
				for i in range(0,len(self.ax)):
					self.ax[i].grid(True)
				self.plot_token.grid=True
			else:
				for i in range(0,len(self.ax)):
					self.ax[i].grid(False)
				self.plot_token.grid=False
		if keyname=="r":
			if self.lx==None:
				for i in range(0,len(self.ax)):
					self.lx = self.ax[i].axhline(color='k')
					self.ly = self.ax[i].axvline(color='k')
			self.lx.set_ydata(self.ydata)
			self.ly.set_xdata(self.xdata)

		if keyname=="l":
			if self.plot_token.logy==True:
				self.plot_token.logy=False
				for i in range(0,len(self.ax)):
					self.ax[i].set_yscale("linear")
			else:
				self.plot_token.logy=True
				for i in range(0,len(self.ax)):
					self.ax[i].set_yscale("log")

		if keyname=="L":
			if self.plot_token.logx==True:
				self.plot_token.logx=False
				for i in range(0,len(self.ax)):
					self.ax[i].set_xscale("linear")
			else:
				self.plot_token.logx=True
				for i in range(0,len(self.ax)):
					self.ax[i].set_xscale("log")

		if keyname=="q":
			self.win.destroy()

		if keyname == "c":
			if event.state == gtk.gdk.CONTROL_MASK:
				self.do_clip()

		self.fig.canvas.draw()
		plot_save_oplot_file(self.config_file,self.plot_token)
示例#12
0
	def callback_heat_map_edit(self, widget, data):
		[a,b,c,d,e,f] = dlg_get_multi_text("2D plot editor", [["x start",str(self.plot_token.x_start)],["x stop",str(self.plot_token.x_stop)],["x points",str(self.plot_token.x_points)],["y start",str(self.plot_token.y_start)],["y stop",str(self.plot_token.y_stop)],["y points",str(self.plot_token.y_points)]])
		print "---------",a,b,c,d,e,f
		self.plot_token.x_start=float(a)
		self.plot_token.x_stop=float(b)
		self.plot_token.x_points=float(c)

		self.plot_token.y_start=float(d)
		self.plot_token.y_stop=float(e)
		self.plot_token.y_points=float(f)

		plot_save_oplot_file(self.config_file,self.plot_token)
		self.do_plot()
示例#13
0
	def load_data(self,input_files,config_file):

		self.input_files=input_files
		self.config_file=config_file

		if config_file=="":
			config_file=os.path.splitext(input_files[0])[0]+".oplot"

		loaded=False
		self.plot_token=plot_state()

		#Try and get the data from the config file
		if plot_load_info(self.plot_token,input_files[0])==False:
			return
		#print("fred>>>>>>>>>>",self.plot_token.x_len)
		if plot_load_info(self.plot_token,config_file)==True:
			print("I have updated the plot info",self.plot_token.type)


		#print("the config file is",config_file)
		#print(input_files,loaded)

		if len(self.plot_id)==0:
			for i in range(0,len(input_files)):
				self.plot_id.append(0)

		self.plot_token.path=os.path.dirname(config_file)
		if self.plot_token.tag0=="":
			self.plot_token.file0=os.path.basename(input_files[0])

		plot_save_oplot_file(config_file,self.plot_token)

		self.output_file=os.path.splitext(config_file)[0]+".png"

		#ret=plot_populate_plot_token(plot_token,self.input_files[0])
		#if ret==True:
		#print "Rod",input_files
		title=self.plot_token.title
		self.setWindowTitle(title+" - www.gpvdm.com")

		#print("Loaded OK",self.config_file)

		test_file=self.input_files[0]
		for i in range(0,len(self.input_files)):
			if os.path.isfile(self.input_files[i]):
				test_file=self.input_files[i]
示例#14
0
	def callback_heat_map_edit(self):
		ret = dlg_get_multi_text([["x start",str(self.plot_token.x_start)],["x stop",str(self.plot_token.x_stop)],["x points",str(self.plot_token.x_points)],["y start",str(self.plot_token.y_start)],["y stop",str(self.plot_token.y_stop)],["y points",str(self.plot_token.y_points)]],title="2D plot editor")
		ret.run()
		ret=ret.get_values()
		if ret!=False:
			[a,b,c,d,e,f] = ret
			#print("---------",a,b,c,d,e,f)
			self.plot_token.x_start=float(a)
			self.plot_token.x_stop=float(b)
			self.plot_token.x_points=float(c)

			self.plot_token.y_start=float(d)
			self.plot_token.y_stop=float(e)
			self.plot_token.y_points=float(f)

			plot_save_oplot_file(self.config_file,self.plot_token)
			self.do_plot()
示例#15
0
	def callback_heat_map_edit(self):
		ret = dlg_get_multi_text([["x start",str(self.data[0].x_start)],["x stop",str(self.data[0].x_stop)],["x points",str(self.data[0].x_points)],["y start",str(self.data[0].y_start)],["y stop",str(self.data[0].y_stop)],["y points",str(self.data[0].y_points)]],title="2D plot editor")
		ret.run()
		ret=ret.get_values()
		if ret!=False:
			[a,b,c,d,e,f] = ret
			#print("---------",a,b,c,d,e,f)
			self.data[0].x_start=float(a)
			self.data[0].x_stop=float(b)
			self.data[0].x_points=float(c)

			self.data[0].y_start=float(d)
			self.data[0].y_stop=float(e)
			self.data[0].y_points=float(f)

			plot_save_oplot_file(self.config_file,self.data[0])
			self.do_plot()
示例#16
0
	def callback_key(self):
		self.plot_token.legend_pos=widget.get_label()
		#print(self.config_file,self.plot_token)
		plot_save_oplot_file(self.config_file,self.plot_token)
		self.do_plot()
示例#17
0
	def callback_toggle_log_scale_x(self, widget, data):
		self.plot_token.logx=data.get_active()
		plot_save_oplot_file(self.config_file,self.plot_token)
		self.do_plot()
示例#18
0
	def callback_toggle_add_min(self):
		self.plot_token.add_min=not self.plot_token.add_min
		plot_save_oplot_file(self.config_file,self.plot_token)
		self.do_plot()
示例#19
0
	def callback_toggle_invert_y(self):
		self.plot_token.invert_y=not self.plot_token.invert_y
		plot_save_oplot_file(self.config_file,self.plot_token)
		self.do_plot()
示例#20
0
	def callback_toggle_label_data(self):
		self.plot_token.label_data=not self.plot_token.label_data
		plot_save_oplot_file(self.config_file,self.plot_token)
		self.do_plot()
示例#21
0
	def callback_norm_to_peak_of_all_data(self):
		self.plot_token.norm_to_peak_of_all_data=not self.plot_token.norm_to_peak_of_all_data
		plot_save_oplot_file(self.config_file,self.plot_token)
		self.do_plot()
示例#22
0
	def load_data(self,input_files,config_file):

		self.input_files=input_files
		self.config_file=config_file

		if config_file=="":
			config_file=os.path.splitext(input_files[0])[0]+".oplot"

		loaded=False		
		self.plot_token=plot_state()

		#Try and get the data from the config file
		if plot_load_info(self.plot_token,config_file)==True:
			loaded=True
			print "I HAVE LOADED THE OPLOT FILE",self.plot_token.type

		#If that did not work get it from the data file
		if loaded==False:
			if plot_load_info(self.plot_token,input_files[0])==True:
				loaded=True

		print "the config file is",config_file
		print input_files,loaded
		if loaded==True:

			if len(self.plot_id)==0:
				for i in range(0,len(input_files)):
					self.plot_id.append(0)
		
			self.plot_token.path=os.path.dirname(config_file)
			if self.plot_token.tag0=="":
				self.plot_token.file0=os.path.basename(input_files[0])

			plot_save_oplot_file(config_file,self.plot_token)

			self.output_file=os.path.splitext(config_file)[0]+".png"

			#ret=plot_populate_plot_token(plot_token,self.input_files[0])
			#if ret==True:
			#print "Rod",input_files
			title=self.plot_token.title
			self.win.set_title(title+" - www.opvdm.com")
			lines=[]

			ret=plot_load_info(self.plot_token,input_files[0])
			myitem=self.item_factory.get_item("/Math/Subtract first point")
			myitem.set_active(self.plot_token.subtract_first_point)

			myitem=self.item_factory.get_item("/Math/Add min point")
			myitem.set_active(self.plot_token.add_min)

			myitem=self.item_factory.get_item("/Math/Invert y-axis")
			myitem.set_active(self.plot_token.invert_y)

			myitem=self.item_factory.get_item("/Math/Norm to 1.0 y")
			myitem.set_active(self.plot_token.normalize)

			myitem=self.item_factory.get_item("/Math/Norm to peak of all data")
			myitem.set_active(self.plot_token.norm_to_peak_of_all_data)

			print "Loaded OK",self.config_file

			test_file=self.input_files[0]
			for i in range(0,len(self.input_files)):
				if os.path.isfile(self.input_files[i]):
					test_file=self.input_files[i]

			print "test_file=",test_file
			print "Exit here"
示例#23
0
	def callback_toggle_label_data(self):
		if len(self.data)>0:
			self.data[0].label_data=not self.data[0].label_data
			plot_save_oplot_file(self.config_file,self.data[0])
			self.do_plot()
示例#24
0
	def callback_toggle_log_scale_x(self):
		if len(self.data)>0:
			self.data[0].logx=not self.data[0].logx
			plot_save_oplot_file(self.config_file,self.data[0])
			self.norm_data()
			self.do_plot()
示例#25
0
	def callback_normtoone_y(self):
		if len(self.data)>0:
			self.data[0].normalize= not self.data[0].normalize
			plot_save_oplot_file(self.config_file,self.data[0])
			self.norm_data()
			self.do_plot()
示例#26
0
	def callback_key(self, data, widget):
		self.plot_token.legend_pos=widget.get_label()
		print self.config_file,self.plot_token
		plot_save_oplot_file(self.config_file,self.plot_token)
		self.do_plot()
示例#27
0
	def callback_key(self):
		if len(self.data)>0:
			self.data[0].legend_pos=widget.get_label()
			#print(self.config_file,self.data[0])
			plot_save_oplot_file(self.config_file,self.data[0])
			self.do_plot()
示例#28
0
	def callback_rainbow(self):
		if len(self.data)>0:
			plot_save_oplot_file(self.config_file,self.data[0])
			self.do_plot()
示例#29
0
	def callback_units(self):
		units=dlg_get_text( "Units:", self.plot_token.key_units)
		if units!=None:
			self.plot_token.key_units=units
		plot_save_oplot_file(self.config_file,self.plot_token)
		self.do_plot()
示例#30
0
	def callback_normtoone_y(self):
		self.plot_token.normalize= not self.plot_token.normalize
		plot_save_oplot_file(self.config_file,self.plot_token)
		self.do_plot()
示例#31
0
	def callback_toggle_invert_y(self):
		if len(self.data)>0:
			self.data[0].invert_y=not self.data[0].invert_y
			plot_save_oplot_file(self.config_file,self.data[0])
			self.norm_data()
			self.do_plot()
示例#32
0
	def callback_toggle_log_scale_x(self):
		self.plot_token.logx=not self.plot_token.logx
		plot_save_oplot_file(self.config_file,self.plot_token)
		self.do_plot()
示例#33
0
	def callback_toggle_subtract_first_point(self, widget, data):
		self.plot_token.subtract_first_point=data.get_active()
		plot_save_oplot_file(self.config_file,self.plot_token)
		self.do_plot()
示例#34
0
	def callback_set_heat_map(self):
		self.plot_token.type="heat"
		plot_save_oplot_file(self.config_file,self.plot_token)
		plot_save_oplot_file(self.config_file,self.plot_token)
		self.do_plot()
示例#35
0
	def callback_toggle_invert_y(self, widget, data):
		self.plot_token.invert_y=data.get_active()
		plot_save_oplot_file(self.config_file,self.plot_token)
		self.do_plot()
示例#36
0
	def callback_set_xy_plot(self):
		self.plot_token.type="xy"
		plot_save_oplot_file(self.config_file,self.plot_token)
		plot_save_oplot_file(self.config_file,self.plot_token)
		self.do_plot()
示例#37
0
	def callback_black(self):
		self.gen_colors_black(1)
		plot_save_oplot_file(self.config_file,self.plot_token)
		self.do_plot()
示例#38
0
	def callback_toggle_subtract_first_point(self):
		self.plot_token.subtract_first_point=not self.plot_token.subtract_first_point
		plot_save_oplot_file(self.config_file,self.plot_token)
		self.do_plot()
示例#39
0
	def callback_rainbow(self):
		self.gen_colors(1)
		plot_save_oplot_file(self.config_file,self.plot_token)
		self.do_plot()
示例#40
0
	def callback_toggle_add_min(self):
		if len(self.data)>0:
			self.data[0].add_min=not self.data[0].add_min
			plot_save_oplot_file(self.config_file,self.data[0])
			self.norm_data()
			self.do_plot()
示例#41
0
	def callback_toggle_add_min(self, widget, data):
		self.plot_token.add_min=data.get_active()
		plot_save_oplot_file(self.config_file,self.plot_token)
		self.do_plot()
示例#42
0
	def callback_set_heat_map(self):
		if len(self.data)>0:
			self.data[0].type="heat"
			plot_save_oplot_file(self.config_file,self.data[0])
			plot_save_oplot_file(self.config_file,self.data[0])
			self.do_plot()
示例#43
0
	def callback_toggle_label_data(self, widget, data):
		self.plot_token.label_data=data.get_active()
		plot_save_oplot_file(self.config_file,self.plot_token)
		self.do_plot()