コード例 #1
0
ファイル: server.py プロジェクト: roderickmackenzie/gpvdm
	def run_jobs(self):
		if self.cluster==True:
			self.cluster_run_jobs()


		else:
			if (len(self.jobs)==0):
				return
			for i in range(0, len(self.jobs)):
				if (self.jobs_running<self.cpus):
					if self.status[i]==0:
						self.status[i]=1
						for r in range(0,len(self.jobs)):
							print(self.jobs[i],self.args[i])
							
						print("Running job",self.jobs[i],self.args[i])
						if self.enable_gui==True:
							self.progress_window.set_text("Running job "+self.jobs[i])
						self.jobs_running=self.jobs_running+1
#						if running_on_linux()==True:

						cmd="cd "+self.jobs[i]+";"
						cmd=cmd+get_exe_command()+" --lock "+"lock"+str(i)+" "+self.args[i]+" --gui --html &"
						print("command="+cmd)
						if self.enable_gui==True:
							self.terminal.run(self.jobs[i],get_exe_command()+" --lock "+"lock"+str(i)+" "+self.args[i]+" --gui --html")
						else:
							print(cmd)
							os.system(cmd)
コード例 #2
0
ファイル: opvdm.py プロジェクト: roderickmackenzie/opvdm
	def callback_run_fit(self, widget, data=None):
		if running_on_linux()==True:
			cmd = "cd "+os.getcwd()+" \n"
			self.terminal.feed_child(cmd)

			cmd = get_exe_command()+" --1fit&\n"
			self.terminal.feed_child(cmd)
		else:
			cmd = get_exe_command()+" --1fit"
			subprocess.Popen([cmd])
コード例 #3
0
	def get_license(self,key="none",uid=None):
		if uid==None:
			uid=self.uid

		command=multiplatform_exe_command(get_exe_command()+" --license")
		os.system(command)

		l=inp()
		l.load(os.path.join(get_tmp_path(),"ret.txt"))
		lines=l.get_token("#ret")

		if lines==False:
			return False

		if lines=="tooold":
			self.error="too_old"
			return False

		if lines=="error":
			self.error="uid_not_found"
			return False

		self.load()

		self.registered=True
		return True
コード例 #4
0
    def base_server_get_next_job_to_run(self, lock_file=False):
        if (len(self.jobs) == 0):
            return False, False

        for i in range(0, len(self.jobs)):
            if (self.jobs_running < self.cpus):
                if self.jobs[i].status == 0:
                    self.jobs[i].status = 1
                    self.jobs[i].start = str(datetime.now())
                    self.jobs[i].ip = socket.gethostbyname(
                        socket.gethostname())
                    #for r in range(0,len(self.jobs)):
                    #	print(self.jobs[i],self.args[i])

                    self.jobs_running = self.jobs_running + 1

                    if lock_file == True:
                        command_lock = " --lockfile " + os.path.join(
                            self.sim_dir, "lock" + str(i) + ".dat")
                    else:
                        command_lock = " --lock " + "lock" + str(i)

                    full_command = get_exe_command(
                    ) + command_lock + " " + self.jobs[
                        i].args + " " + get_exe_args()
                    self.jobs[i].full_command = full_command
                    return self.jobs[i].path, full_command

        return False, False
コード例 #5
0
ファイル: scan_tab.py プロジェクト: roderickmackenzie/opvdm
	def callback_examine(self, widget, data=None):
		mycmp=cmp_class()
		ret=mycmp.init(self.sim_dir,get_exe_command())
		if ret==False:
			md = gtk.MessageDialog(None, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_WARNING,  gtk.BUTTONS_CLOSE, _("Re-run the simulation with 'dump all slices' set to one to use this tool."))
        		md.run()
        		md.destroy()
			return
コード例 #6
0
ファイル: server.py プロジェクト: roderickmackenzie/opvdm
    def run_jobs(self):
        if self.cluster == True:
            s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
            port = 8888
            self.mylock = True
            s.sendto("set_master_ip", (self.server_ip, port))
            self.wait_lock()

            self.mylock = True
            s.sendto("set_exe#" + get_exe_command(), (self.server_ip, port))
            self.wait_lock()

            # self.mylock.clear()
            s.sendto("run", (self.server_ip, port))
            # self.mylock.wait(1000)

            s.close()
        else:
            if len(self.jobs) == 0:
                return
            for i in range(0, len(self.jobs)):
                if self.jobs_running < self.cpus:
                    if self.status[i] == 0:
                        self.status[i] = 1
                        print "Running job", self.jobs[i]
                        if self.enable_gui == True:
                            self.progress_window.set_text("Running job" + self.jobs[i])
                        self.jobs_running = self.jobs_running + 1
                        if running_on_linux() == True:
                            cmd = "cd " + self.jobs[i] + ";"
                            cmd = cmd + get_exe_command() + " --lock " + "lock" + str(i) + " &\n"
                            print "command=" + cmd
                            if self.enable_gui == True:
                                self.terminal.feed_child(cmd)
                            else:
                                print cmd
                                os.system(cmd)

                        else:
                            cmd = get_exe_command() + " --lock " + "lock" + str(i) + " &\n"
                            print cmd, self.jobs[i]
                            subprocess.Popen(cmd, cwd=self.jobs[i])
コード例 #7
0
ファイル: server.py プロジェクト: roderickmackenzie/opvdm
    def killall(self):
        if self.cluster == True:
            s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
            port = 8888
            s.sendto("killall", (self.server_ip, port))
            s.close()
        else:
            exe_name = os.path.basename(get_exe_command())
            cmd = "killall " + exe_name
            ret = os.system(cmd)

        self.stop()
コード例 #8
0
ファイル: optics.py プロジェクト: roderickmackenzie/opvdm
	def update_graph(self):
		cmd = get_exe_command()+' --optics'
		print cmd
		ret= os.system(cmd)
		self.fig_photon_density.my_figure.clf()
		self.fig_photon_density.draw_graph()
		self.fig_photon_density.canvas.draw()

		self.fig_photon_abs.my_figure.clf()
		self.fig_photon_abs.draw_graph()
		self.fig_photon_abs.canvas.draw()

		for i in range(0,len(self.plot_widgets)):
			self.plot_widgets[i].update()
コード例 #9
0
	def load(self):
		self.clear()
		self.clean_menu()
		self.last_page=0

		#self.setTabsClosable(True)
		self.setMovable(True)
		if (os.path.isfile(os.path.join(get_sim_path(),"sim.gpvdm"))==True):
			self.finished_loading=False
			#self.progress.init()
			#self.progress.show()
			#self.progress.start()
			#self.progress.set_text("Loading..")
			#process_events()


#			dos_files=inp_get_token_value("device_epitaxy.inp", "#layers")

			widget=tab_main()
			self.addTab(widget,_("Device structure"))

			self.update_display_function=widget.update


			self.terminal=tab_terminal()
			self.terminal.init()
			self.addTab(self.terminal,_("Terminal"))
			self.terminal.run(os.getcwd(),get_exe_command()+" --version "+get_exe_args())
			global_object_register("terminal",self.terminal)

			widget=tab_view()
			self.addTab(widget,_("Output"))

			#self.add_info_page()

			return True


			self.finished_loading=True
			#self.progress.stop()
			#self.progress.set_fraction(0.0)
			self.goto_page(_("Device structure"))

		else:
			self.add_info_page()
			self.goto_page(_("Information"))
			return False
コード例 #10
0
ファイル: optics.py プロジェクト: roderickmackenzie/gpvdm
	def callback_run(self):
		dump_optics=inp_get_token_value("dump.inp", "#dump_optics")
		dump_optics_verbose=inp_get_token_value("dump.inp", "#dump_optics_verbose")

		inp_update_token_value("dump.inp", "#dump_optics","true",1)
		inp_update_token_value("dump.inp", "#dump_optics_verbose","true",1)
		cmd = get_exe_command()+' --simmode opticalmodel@optics'
		print(cmd)
		ret= os.system(cmd)

		inp_update_token_value("dump.inp", "#dump_optics",dump_optics,1)
		inp_update_token_value("dump.inp", "#dump_optics_verbose",dump_optics_verbose,1)
		
		self.update()
		self.update_cb()

		inp_update_token_value("dump.inp", "#dump_optics","true",1)
		inp_update_token_value("dump.inp", "#dump_optics_verbose","true",1)
コード例 #11
0
	def register(self,email="",name="",company=""):
		l=inp()
		l.append("#email")
		l.append(email)
		l.append("#name")
		l.append(name)
		l.append("#company")
		l.append(company)
		l.append("#lang")
		l.append(get_full_language())
		l.append("#end")

		reg_path=os.path.join(get_tmp_path(),"reg.txt")
		print("write to",reg_path)
		l.save_as(reg_path)
		print(">",l.zip_file_path)
		print(">>",l.file_name)

		command=multiplatform_exe_command(get_exe_command()+" --register")
		os.system(command)
		print("done")
		#l.delete()

		l=inp()
		l.load(os.path.join(get_tmp_path(),"ret.txt"))
		lines=l.get_token("#ret")

		if lines==False:
			return False

		if lines=="no_internet":
			self.error="no_internet"
			return False

		if lines=="tooold":
			self.error="too_old"
			return False

		self.uid=lines

		return True
コード例 #12
0
	def validate_key(self,key):
		command=multiplatform_exe_command(get_exe_command()+" --validate "+key)
		os.system(command)

		l=inp()
		l.load(os.path.join(get_tmp_path(),"ret.txt"))
		lines=l.get_token("#ret")

		if lines==False:
			self.error="no_internet"
			return False

		if lines=="ok":
			self.load()
			return True
		elif lines=="tooold":
			self.error="too_old"
			return False

		self.error=lines
		return False
コード例 #13
0
    def load(self):
        self.clear()
        self.last_page = 0

        #self.setTabsClosable(True)
        self.setMovable(True)
        if (os.path.isfile(os.path.join(get_sim_path(), "sim.gpvdm")) == True):

            self.tab_main = tab_main()
            self.addTab(self.tab_main, _("Device structure"))

            mesh = get_mesh()
            if mesh.y.circuit_model == True:  # or mesh.x.tot_points!=1 or mesh.z.tot_points!=1:
                self.display_mesh = display_mesh()

                if mesh.y.circuit_model == True:
                    self.addTab(self.display_mesh, _("Circuit diagram"))
                else:
                    self.addTab(self.display_mesh, _("Electrical mesh"))

            self.update_display_function = self.tab_main.update
            #self.tab_main.three_d.display.force_redraw()

            self.terminal = tab_terminal()
            self.terminal.init()
            self.addTab(self.terminal, _("Terminal"))
            self.terminal.run(
                os.getcwd(),
                get_exe_command() + " --version2 " + get_exe_args())
            global_object_register("terminal", self.terminal)

            widget = tab_view()
            self.addTab(widget, _("Output"))
            self.add_docs_page()
            self.state_loaded = True

        else:
            self.add_info_page()
            self.goto_page(_("Information"))
            self.state_loaded = False
コード例 #14
0
ファイル: gpvdm_api.py プロジェクト: Ly0n/gpvdm
    def add_jobs(self, scan_dir_path):
        exe_command = get_exe_command()
        scans = scans_io(os.getcwd())
        scan_config_file = scans.find_path_by_name(
            os.path.basename(scan_dir_path))
        s = scan_io()
        s.load(scan_config_file)

        program_list = s.program_list

        watch_dir = os.path.join(os.getcwd(), scan_dir_path)

        commands = []
        #server_find_simulations_to_run(commands,scan_dir_path)
        commands = tree_load_flat_list(scan_dir_path)
        print(commands)

        self.server.base_server_init(watch_dir)

        for i in range(0, len(commands)):
            self.server.add_job(commands[i], "")
            print("Adding job" + commands[i])
コード例 #15
0
ファイル: cluster.py プロジェクト: roderickmackenzie/gpvdm
	def killall(self):
		if self.cluster==True:
			data=tx_struct()

			data.id="gpvdm_stop_all_jobs"
			self.tx_packet(data)

			data.id="gpvdmkillall"
			self.tx_packet(data)

			sleep(1)

			data.id="gpvdm_delete_all_jobs"
			self.tx_packet(data)

		else:
			print("stop jobs")
			if running_on_linux()==True:
				exe_name=os.path.basename(get_exe_command())
				cmd = 'killall '+exe_name
				ret= os.system(cmd)

		self.stop()
コード例 #16
0
ファイル: cmp_class.py プロジェクト: roderickmackenzie/gpvdm
	def init(self):
		return False
		self.dumps=0
		self.plot_token=plot_state()

		vbox=gtk.VBox()

		self.multi_plot=False

		self.log_scale_y="auto"


		menu_items = (
		    ( "/_Options",         None,         None, 0, "<Branch>" ),
		    ( "/Options/_Subtract 0th frame",     None, self.callback_toggle_subtract, 0, "<ToggleItem>", "gtk-save" ),
		    ( "/_Axis/_Multiplot",     None, self.callback_multi_plot, 0, "<ToggleItem>", "gtk-save" ),
		    ( "/_Axis/_Set y axis to maximum",     None, self.callback_set_min_max, 0, "<ToggleItem>", "gtk-save" ),
		    )

		self.plot.item_factory.create_items(menu_items)

		primary_hbox.add(self.entry0)
		sim_vbox.add(primary_hbox)

		secondary_hbox=gtk.HBox()

		text=gtk.Label("Secondary dir")
		secondary_hbox.add(text)

		self.entry1 = gtk.combo_box_entry_new_text()
		self.entry1.show()

		for i in range(0,len(self.snapshot_list)):
			self.entry1.append_text(self.snapshot_list[i])

		secondary_hbox.add(self.entry1)
		sim_vbox.add(secondary_hbox)

		sim_vbox.show()
		#hbox.set_size_request(-1, 30)
		vbox.pack_start(sim_vbox, False, False, 0)

		hbox2=gtk.HBox()
		text=gtk.Label("Files to plot")
		hbox2.add(text)
		self.entry2 = gtk.Entry()
		self.entry2.set_text("pt_map nt_map")
		self.entry2.show()
		hbox2.add(self.entry2)
		hbox2.set_size_request(-1, 30)
		vbox.pack_start(hbox2, False, False, 0)

		hbox3=gtk.HBox()
		text=gtk.Label("Exprimental data")
		hbox3.add(text)
		self.entry3 = gtk.Entry()
		self.entry3.set_text("")
		self.entry3.show()
		hbox3.add(self.entry3)
		hbox3.set_size_request(-1, 30)
		vbox.pack_start(hbox3, False, False, 0)

		self.update_button = gtk.Button()
		self.update_button.set_label("Update")
		self.update_button.show()
		self.update_button.connect("clicked", self.callback_scale)
		vbox.add(self.update_button)

		self.config_load()
		self.count_dumps()



		if self.dumps==0:
			md = gtk.MessageDialog(None, 0, gtk.MESSAGE_QUESTION,  gtk.BUTTONS_YES_NO, "No slice data has been written to disk.  You need to re-run the simulation with the dump_slices set to 1.  Would you like to do this now?  Note: This generates lots of files and will slow down the simulation.")

			response = md.run()

			if response == gtk.RESPONSE_YES:
				inp_update_token_value("dump.inp", "#dump_1d_slices", "1",1)
				os.system(get_exe_command())

			md.destroy()

			self.count_dumps()

		self.entry0.connect("changed", self.callback_edit)
		self.entry1.connect("changed", self.callback_edit)
		self.entry2.connect("changed", self.callback_edit)
		self.entry3.connect("changed", self.callback_edit)



		vbox.show_all()
		self.add(vbox)

		self.update(0)
		if self.dumps!=0:
			self.plot.do_plot()
			print("CONVERT!!!!!!!!!!!",type(self.plot.plot_token.key_units))
		self.set_border_width(10)
		self.set_title("Compare")
		self.set_icon_from_file(os.path.join(get_image_file_path(),"image.jpg"))

		self.connect('key_press_event', self.on_key_press_event)

		self.show()
コード例 #17
0
ファイル: cmp_class.py プロジェクト: roderickmackenzie/opvdm
	def init(self):
		self.dumps=0
		self.plot_token=plot_state()
		self.win_list=windows()
		self.win_list.load()
		self.win_list.set_window(self,"cmp_class")

		self.snapshot_list=self.update_snapshots_dir()
		vbox=gtk.VBox()

		self.multi_plot=False

		self.log_scale_y="auto"

		self.plot=plot_widget()
		self.plot.init(self)

		accel_group = gtk.AccelGroup()
		item_factory = gtk.ItemFactory(gtk.MenuBar, "<main>", accel_group)

		menu_items = (
		    ( "/_Options",         None,         None, 0, "<Branch>" ),
		    ( "/Options/_Subtract 0th frame",     None, self.callback_toggle_subtract, 0, "<ToggleItem>", "gtk-save" ),
		    ( "/_Axis/_Multiplot",     None, self.callback_multi_plot, 0, "<ToggleItem>", "gtk-save" ),
		    ( "/_Axis/_Set y axis to maximum",     None, self.callback_set_min_max, 0, "<ToggleItem>", "gtk-save" ),
		    )

		self.plot.item_factory.create_items(menu_items)



		image = gtk.Image()
   		image.set_from_file(os.path.join(get_image_file_path(),"video.png"))
		self.video = gtk.ToolButton(image)
		self.plot.toolbar.add(self.video)
		self.video.show()
		self.video.connect("clicked", self.callback_save)

		image = gtk.Image()
   		image.set_from_file(os.path.join(get_image_file_path(),"scale.png"))
		self.scale = gtk.ToolButton(image)
		self.plot.toolbar.add(self.scale)

		sep = gtk.SeparatorToolItem()
		sep.set_draw(False)
		sep.set_expand(True)
		self.plot.toolbar.add(sep)
		sep.show()


		help = gtk.ToolButton(gtk.STOCK_HELP)
		self.plot.toolbar.add(help)
		help.connect("clicked", self.callback_help)
		help.show()

		close = gtk.ToolButton(gtk.STOCK_QUIT)
		close.connect("clicked", self.callback_close)
		self.plot.toolbar.add(close)
		close.show()

		self.connect("delete-event", self.callback_close) 

		self.plot.toolbar.show_all()


		self.canvas=self.plot.canvas 
		self.plot.show()
		vbox.add(self.plot)

		#adjust
		self.adj1 = gtk.Adjustment(0.0, 0.0, 100, 1, 1.0, 1.0)
		self.adj1.connect("value_changed", self.callback_scale)
		vscale = gtk.HScale(self.adj1)
		vscale.set_update_policy(gtk.UPDATE_CONTINUOUS)
		vscale.set_digits(1)
		vscale.set_value_pos(gtk.POS_TOP)
		vscale.set_draw_value(True)
		vscale.set_size_request(200, 40)
		vscale.set_digits(0)
		vbox.pack_start(vscale, False, False, 10)


		sim_vbox=gtk.VBox()
		primary_hbox=gtk.HBox()

		text=gtk.Label("Primary dir")
		primary_hbox.add(text)

		self.entry0 = gtk.combo_box_entry_new_text()
		self.entry0.show()


		for i in range(0,len(self.snapshot_list)):
			self.entry0.append_text(self.snapshot_list[i])

		primary_hbox.add(self.entry0)
		sim_vbox.add(primary_hbox)

		secondary_hbox=gtk.HBox()

		text=gtk.Label("Secondary dir")
		secondary_hbox.add(text)

		self.entry1 = gtk.combo_box_entry_new_text()
		self.entry1.show()

		for i in range(0,len(self.snapshot_list)):
			self.entry1.append_text(self.snapshot_list[i])

		secondary_hbox.add(self.entry1)
		sim_vbox.add(secondary_hbox)

		sim_vbox.show()
		#hbox.set_size_request(-1, 30)
		vbox.pack_start(sim_vbox, False, False, 0)

		hbox2=gtk.HBox()
		text=gtk.Label("Files to plot")
		hbox2.add(text)
		self.entry2 = gtk.Entry()
		self.entry2.set_text("pt_map nt_map")
		self.entry2.show()
		hbox2.add(self.entry2)
		hbox2.set_size_request(-1, 30)
		vbox.pack_start(hbox2, False, False, 0)

		hbox3=gtk.HBox()
		text=gtk.Label("Exprimental data")
		hbox3.add(text)
		self.entry3 = gtk.Entry()
		self.entry3.set_text("")
		self.entry3.show()
		hbox3.add(self.entry3)
		hbox3.set_size_request(-1, 30)
		vbox.pack_start(hbox3, False, False, 0)

		self.update_button = gtk.Button()
		self.update_button.set_label("Update")
		self.update_button.show()
		self.update_button.connect("clicked", self.callback_scale)
		vbox.add(self.update_button)

		self.config_load()
		self.count_dumps()
		if self.dumps==0:
			md = gtk.MessageDialog(None, 0, gtk.MESSAGE_QUESTION,  gtk.BUTTONS_YES_NO, "No slice data has been written to disk.  You need to re-run the simulation with the dump_slices set to 1.  Would you like to do this now?  Note: This generates lots of files and will slow down the simulation.")

			response = md.run()

			if response == gtk.RESPONSE_YES:
				inp_update_token_value("dump.inp", "#dump_1d_slices", "1",1)
				ret= os.system(get_exe_command())

			md.destroy()

			self.count_dumps()

		self.entry0.connect("changed", self.callback_edit)
		self.entry1.connect("changed", self.callback_edit)
		self.entry2.connect("changed", self.callback_edit)
		self.entry3.connect("changed", self.callback_edit)



		vbox.show_all()
		self.add(vbox)
		
		self.update(0)
		if self.dumps!=0:
			self.plot.do_plot()
			print "CONVERT!!!!!!!!!!!",type(self.plot.plot_token.key_units)
		self.set_border_width(10)
		self.set_title("Compare")
		self.set_icon_from_file(os.path.join(get_image_file_path(),"image.jpg"))

		self.connect('key_press_event', self.on_key_press_event)

		self.show()
コード例 #18
0
ファイル: qe.py プロジェクト: roderickmackenzie/opvdm
	def init(self):
		self.fig = Figure(figsize=(5,4), dpi=100)
		self.ax1=None
		self.show_key=True
		self.hbox=gtk.HBox()
		self.exe_command  =  get_exe_command()
		self.edit_list=[]
		self.line_number=[]
		gui_pos=0

		
		gui_pos=gui_pos+1

		self.draw_graph()
		canvas = FigureCanvas(self.fig)  # a gtk.DrawingArea
		#canvas.set_background('white')
		#canvas.set_facecolor('white')
		canvas.figure.patch.set_facecolor('white')
		canvas.set_size_request(500, 150)
		canvas.show()

		tooltips = gtk.Tooltips()

		toolbar = gtk.Toolbar()
		#toolbar.set_orientation(gtk.ORIENTATION_VERTICAL)
		toolbar.set_style(gtk.TOOLBAR_ICONS)
		toolbar.set_size_request(-1, 50)

		tool_bar_pos=0
		save = gtk.ToolButton(gtk.STOCK_SAVE)
		tooltips.set_tip(save, "Save image")
		save.connect("clicked", self.callback_save)
		toolbar.insert(save, tool_bar_pos)
		tool_bar_pos=tool_bar_pos+1

		hide_key = gtk.ToolButton(gtk.STOCK_INFO)
		tooltips.set_tip(hide_key, "Hide key")
		hide_key.connect("clicked", self.callback_hide_key)
		toolbar.insert(hide_key, tool_bar_pos)
		tool_bar_pos=tool_bar_pos+1

		image = gtk.Image()
   		image.set_from_file(os.path.join(get_image_file_path(),"play.png"))
		save = gtk.ToolButton(image)
		tooltips.set_tip(save, "Run simulation")
		save.connect("clicked", self.callback_refresh)
		toolbar.insert(save, tool_bar_pos)
		tool_bar_pos=tool_bar_pos+1

		plot_toolbar = NavigationToolbar(canvas, self)
		plot_toolbar.show()
		box=gtk.HBox(True, 1)
		box.set_size_request(500,-1)
		box.show()
		box.pack_start(plot_toolbar, True, True, 0)
		tb_comboitem = gtk.ToolItem();
		tb_comboitem.add(box);
		tb_comboitem.show()
		toolbar.insert(tb_comboitem, tool_bar_pos)
		tool_bar_pos=tool_bar_pos+1

		sep = gtk.SeparatorToolItem()
		sep.set_draw(False)
		sep.set_expand(True)
		toolbar.insert(sep, tool_bar_pos)
		sep.show()
		tool_bar_pos=tool_bar_pos+1

		toolbar.show_all()
		window_main_vbox=gtk.VBox()
		window_main_vbox.pack_start(toolbar, False, True, 0)
		#self.attach(toolbar, 0, 1, 0, 1)
		tool_bar_pos=tool_bar_pos+1




		self.hbox.pack_start(canvas, True, True, 0)
		#self.attach(canvas, 1, 3, 0, 1)



		vbox = gtk.VBox(False, 2)
	

		#spacer
		label=gtk.Label(" \n\n    ")
		#self.attach(label, 4, 5, 1, 2,gtk.SHRINK ,gtk.SHRINK)
		vbox.pack_start(label, False, False, 0)

		label.show()


		hbox = gtk.HBox(False, 2)
	    
		hbox.show()
		self.hbox.pack_start(vbox, False, False, 0)
		#self.attach(vbox, 3, 4, 0, 1,gtk.SHRINK ,gtk.SHRINK)
		vbox.show()
		window_main_vbox.add(self.hbox)
		self.add(window_main_vbox)
		self.set_title("Quantum Efficency calculator - (www.opvdm.com)")
		self.set_icon_from_file(os.path.join(get_image_file_path(),"qe.png"))
		self.connect("delete-event", self.callback_close)
		self.set_position(gtk.WIN_POS_CENTER)
コード例 #19
0
 def update_graph(self):
     cmd = get_exe_command() + ' --onlypos'
     #		ret= os.system(cmd)
     self.fig.clf()
     self.draw_graph()
     self.fig.canvas.draw()
コード例 #20
0
ファイル: emesh.py プロジェクト: roderickmackenzie/opvdm
	def run_simulation(self,data):
		cmd = get_exe_command()+' --onlypos'
		os.system(cmd)
		self.update_graph()
コード例 #21
0
 def run_now(self):
     self.exe_command(get_sim_path(), get_exe_command(), background=False)
コード例 #22
0
def command_args(argc,argv):
	if argc>=2:
		if argv[1]=="--help":
			print "Usage: opvdm [option] src_file dest_file"
			print ""
			print "Options:"
			print "\t--version\tdisplays the current version"
			print "\t--help\t\tdisplays the help"
			print "\t--export\texport a simulation to a gz file"
			print "\t--import\timport a simulation from a .opvdm file"
			print "\t--patch\tpatch an .opvdm file with an older .opvdm file"
			print "\t\t\tusage --import abc.opvdm ./path/to/output/ "
			print "\t--clone\t\tgenerate a clean simulation in the current directory"
			print "\t--clean\t\tcleans the current simulation directory deleting .dat files and scan dirs"
			print "\t--dump-tab (output file)\t\tdumps simulation parameters as jpg"
			print "\t--import-scandirs\t\tOnly imports the scan directories"
			print "\t--clean-scandirs\t\tDeletes the content of all scan dirs"
			print "\t--scan-plot\t\truns an oplot file"
			print "\t\t\tusage --scan-plot /path/to/oplot/file.oplot "
			print "\t--run-scan\t\truns a scan"
			print "\t\t\tusage --run-scan /path/containing/base/files/ /path/to/scan/dir/ "

			print ""
			print "Additional information about opvdm is available at http://www.opvdm.com."
			print ""
			print "Report bugs to: [email protected]"
			sys.exit(0)
		if argv[1]=="--version":
			print ver()
			sys.exit(0)
		if argv[1]=="--import-scandirs":
			import_scan_dirs(os.getcwd(),argv[2])
			exit(0)
		if argv[1]=="--export":
			export_as(argv[2])
			sys.exit(0)
		if argv[1]=="--dump-tab":
			export_as(argv[2])
			sys.exit(0)
		if argv[1]=="--import":
			import_archive(argv[2],os.path.join(os.getcwd(),"sim.opvdm"),False)
			sys.exit(0)
		if argv[1]=="--patch":
			import_archive(argv[2],argv[3],True)
			sys.exit(0)
		if argv[1]=="--clone":
			opvdm_clone()
			sys.exit(0)
		if argv[1]=="--clone-src":
			opvdm_copy_src(argv[2])
			sys.exit(0)

		if argv[1]=="--file_info":
			data=plot_data()
			data.dump_file()
			sys.exit(0)
		if argv[1]=="--clean":
			clean_sim_dir()
			sys.exit(0)
		if argv[1]=="--clean-scandirs":
			clean_scan_dirs(os.getcwd())
			sys.exit(0)

		if argv[1]=="--server":
			obj=udp_server()
			obj.start()

		if argv[1]=="--client":
			client=udp_client()
			client.init()

		if argv[1]=="--make-man":
			make_man()
			sys.exit(0)

		if argv[1]=="--run-scan":
			scan_dir_path=argv[3]	#program file
			program_list=[]
			base_dir=argv[2]				#base dir
			exe_command   =  get_exe_command()
			scan_item_load(os.path.join(scan_dir_path,"scan_items.inp"))
			tree_load_program(program_list,scan_dir_path)

			watch_dir=os.path.join(os.getcwd(),scan_dir_path)
			#print program_list,pwd,scan_dir_path
			#sys.exit(0)
			#print pwd,scan_dir_path
			#print os.getcwd(),os.path.join(scan_dir_path)
			#tree_gen(program_list,os.getcwd(),os.path.join(os.getcwd(),"suns"))
			flat_list=[]
			tree_gen(flat_list,program_list,base_dir,scan_dir_path)
			commands=[]
			server_find_simulations_to_run(commands,scan_dir_path)
			myserver=server()
			myserver.init(watch_dir)
			myserver.clear_cache()
			for i in range(0, len(commands)):
				myserver.add_job(commands[i])
				print "Adding job"+commands[i]
			myserver.simple_run(exe_command)

			sys.exit(0)
		if argv[1]=="--scan-plot":
			plot_token=plot_state()
			oplot_file=argv[2]
			if plot_load_info(plot_token,oplot_file)==True:
				print "file0=",plot_token.file0,"<"
				plot_files, plot_labels, save_file = scan_gen_plot_data(plot_token,os.path.dirname(oplot_file))
				print "written data to",save_file
			else:
				print "Problem loading oplot file"
			sys.exit(0)
コード例 #23
0
def command_args(argc,argv):
	if argc>=2:
		if argv[1]=="--help":
			print(_("Usage: gpvdm [option] src_file dest_file"))
			print("")
			print(_("Options:"))
			print(_("\t--version\t\tdisplays the current version"))
			print(_("\t--help\t\t\tdisplays the help"))
			print(_("\t--export\t\texport a simulation to a gz file"))
			print(_("\t--import\t\timport a simulation from a .gpvdm file"))
			print(_("\t--patch\t\t\tpatch an .gpvdm file with an older .gpvdm file"))
			print(_("\t\t\t\tusage --import abc.gpvdm ./path/to/output/ "))
			print(_("\t--clone\t\t\tgenerate a clean simulation in the current directory"))
			print(_("\t--clean\t\t\tcleans the current simulation directory deleting .dat files but not  scan dirs"))
			print(_("\t--dump-tab\t\tdumps simulation parameters as jpg"))
			print(_("\t\t\t\tusage --dump-tab output_path "))
			print(_("\t--import-scandirs\tOnly imports the scan directories"))
			print(_("\t--clean-scandirs\tDeletes the content of all scan dirs"))
			print(_("\t--scan-plot\t\truns an oplot file"))
			print(_("\t\t\t\tusage --scan-plot /path/to/oplot/file.oplot "))
			print(_("\t--run-scan\t\truns a scan"))
			print(_("\t\t\t\tusage --run-scan /path/containing/base/files/ /path/to/scan/dir/ "))
			print(_("\t--sync-ver\t\truns a scan"))
			print(_("\t--edit-value\t\tedits a value in a .gpvdm archive"))
			print(_("\t\t\t\tusage --edit-value /path/to/sim.gpvdm #token_to_change new_value "))
			print(_("\t\t\t\tchanges the version of input file"))
			print(_("\t--replace\t\treplaces file in device lib"))
			if enable_cluster()==True:
				print(_("\t--server\t\tRun as server node for cluster"))
				print(_("\t--server\t\tRun as client node for cluster"))


			print("\t\t\t")
			print("")
			print(_("Additional information about gpvdm is available at http://www.gpvdm.com."))
			print("")
			print(_("Report bugs to: [email protected]"))
			sys.exit(0)

		if 	check_params(argv,"--version",0)==True:
			print(version())
			sys.exit(0)
		if 	check_params(argv,"--ver",0)==True:
			print(ver())
			sys.exit(0)
		if check_params(argv,"--import-scandirs",1)==True:
			import_scan_dirs(os.getcwd(),argv[2])
			exit(0)
		if check_params(argv,"--replace",1)==True:
			device_lib_replace(argv[2])
			exit(0)
		if check_params(argv,"--export",1)==True:
			export_as(argv[2])
			sys.exit(0)
		if check_params(argv,"--dump-tab",1)==True:
			export_as(argv[2])
			sys.exit(0)
		if check_params(argv,"--import",1)==True:
			import_archive(argv[2],os.path.join(os.getcwd(),"sim.gpvdm"),False)
			sys.exit(0)
		if check_params(argv,"--patch",2)==True:
			import_archive(argv[2],argv[3],True)
			sys.exit(0)
		if check_params(argv,"--clone",0)==True:
			gpvdm_clone(os.getcwd(),True)
			sys.exit(0)
		if check_params(argv,"--clone-src",1)==True:
			gpvdm_copy_src(argv[2])
			sys.exit(0)
		if check_params(argv,"--edit-value",3)==True:
			inp_update(argv[2], argv[3], argv[4])
			sys.exit(0)

		#if check_params(argv,"--file_info",0)==True:
		#	data=plot_data()
		#	data.dump_file()
		#	sys.exit(0)
		if check_params(argv,"--clean",0)==True:
			clean_sim_dir()
			sys.exit(0)
		if check_params(argv,"--clean-scandirs",0)==True:
			clean_scan_dirs(os.getcwd())
			sys.exit(0)

		if check_params(argv,"--make-man",1)==True:
			make_man()
			sys.exit(0)

		if check_params(argv,"--sync-ver",0)==True:
			ver_sync_ver()
			sys.exit(0)

		if check_params(argv,"--run-scan",2)==True:
			scan_dir_path=argv[3]	#program file
			program_list=[]
			base_dir=argv[2]				#base dir
			exe_command   =  get_exe_command()
			tree_load_program(program_list,scan_dir_path)

			watch_dir=os.path.join(os.getcwd(),scan_dir_path)
			#print(program_list,pwd,scan_dir_path)
			#sys.exit(0)
			#print(pwd,scan_dir_path)
			#print(os.getcwd(),os.path.join(scan_dir_path))
			#tree_gen(program_list,os.getcwd(),os.path.join(os.getcwd(),"suns"))
			flat_list=[]
			tree_gen(flat_list,program_list,base_dir,scan_dir_path)
			commands=[]
			server_find_simulations_to_run(commands,scan_dir_path)
			myserver=server()
			myserver.init(watch_dir)
			myserver.clear_cache()
			for i in range(0, len(commands)):
				myserver.add_job(commands[i],"")
				print("Adding job"+commands[i])
			myserver.simple_run(exe_command)

			sys.exit(0)

		if check_params(argv,"--scan-plot",1)==True:
			plot_token=plot_state()
			oplot_file=argv[2]
			if plot_load_info(plot_token,oplot_file)==True:
				print("file0=",plot_token.file0,"<")
				plot_files, plot_labels, save_file = scan_gen_plot_data(plot_token,os.path.dirname(oplot_file))
				print("written data to",save_file)
			else:
				print("Problem loading oplot file")
			sys.exit(0)
コード例 #24
0
	def load(self):
		self.clean_menu()
		self.last_page=0

		#self.setTabsClosable(True)
		self.setMovable(True)
		if (os.path.exists("sim.gpvdm")==True) and (os.path.normcase(os.getcwd())!=os.path.normcase(get_bin_path())):
			self.finished_loading=False
			#self.progress.init()
			#self.progress.show()
			#self.progress.start()
			#self.progress.set_text("Loading..")
			#process_events()

			self.clear()

#			dos_files=inp_get_token_value("device_epitaxy.inp", "#layers")

			widget=tab_main()

			self.addTab(widget,_("Device structure"))

	
			lines=[]
			pos=0
			if inp_load_file(lines,"gui_config.inp")==True:
				pos=0
				tab_number=0
				tabs=(len(lines)-3)/2
				while (1):
					add_to_widget=False
					ret,pos=inp_get_next_token_array(lines,pos)

					if ret[0]=="#ver":
						break

					file_name=ret[0]
					if file_name[0]=="#":
						file_name=file_name[1:]
					name=inp_file_to_description(file_name)
					if name==False:
						print("name not found",name)
						break
					visible=bool(int(ret[1]))

					#self.progress.set_fraction(float(tab_number)/float(tabs))

					tab_number=tab_number+1
					#self.progress.set_text(_("Loading ")+name)
					#process_events()

					if file_name=="lumo0.inp":
						widget=tab_bands()
						#tab.update()
						add_to_widget=True
						widget.visible=visible
						widget.label_name=name
						widget.file_name=file_name
					elif file_name=="epitaxy.inp":
						widget=dos_main()
						widget.update()
						add_to_widget=True
						widget.visible=visible
						widget.label_name=name
						widget.file_name=file_name
					elif file_name=="pl0.inp":
						widget=pl_main()
						widget.update()
						add_to_widget=True
						widget.visible=visible
						widget.label_name=name
						widget.file_name=file_name
					elif inp_isfile(file_name)==True:
						add_to_widget=True
						widget=tab_class()
						widget.init(file_name,name)


					#	add_to_widget=True
					#	tab=
					#	tab.visible=visible
					#	tab.init(file_name,name)
					#	tab.label_name=name
					#	tab.file_name=file_name

					if add_to_widget==True:
						mytext=name
						if len(mytext)<10:
							for i in range(len(mytext),10):
								mytext=mytext+" "
						self.addTab(widget,mytext)


			self.terminal=tab_terminal()
			self.terminal.init()
			self.addTab(self.terminal,"Terminal")
			self.terminal.run(os.getcwd(),get_exe_command()+" --version --html")

			self.add_info_page()

			return True




			self.finished_loading=True
			#self.progress.stop()
			#self.progress.set_fraction(0.0)
			self.goto_page("tab_main")

		else:
			self.add_info_page()
			self.goto_page(_("Information"))
			return False
コード例 #25
0
def command_args(argc, argv):
    if test_arg_for_sim_file() != False:
        return

    if argc >= 2:
        if args.version:
            print(version())
            sys.exit(0)
        elif args.ver:
            print(ver())
            sys.exit(0)
        elif args.syncver:
            ver_sync_ver()
            sys.exit(0)
        elif args.importscandirs:
            import_scan_dirs(os.getcwd(), args.importscandirs[0])
            exit(0)
        elif args.replace:
            device_lib_replace(args.replace[0], dir_name=args.replace[1])
            exit(0)
        elif args.delete:
            device_lib_delete(args.delete[0], dir_name=args.delete[1])
            exit(0)
        elif args.clean:
            clean_sim_dir()
            sys.exit(0)
        elif args.export:
            export_as(args.export[0])
            sys.exit(0)
        elif args.makeman:
            make_man()
            sys.exit(0)
        elif args.cleanscandirs:
            clean_scan_dirs(os.getcwd())
            sys.exit(0)
        elif args.importfile:
            import_archive(args.importfile[0],
                           os.path.join(os.getcwd(), "sim.gpvdm"), False)
            sys.exit(0)
        elif args.dumptab:
            export_as(args.dumptab[0])
            sys.exit(0)
        elif args.patch:
            import_archive(args.patch[0], args.patch[1], True)
            sys.exit(0)
        elif args.patchfile:
            patch_file(args.patchfile[0], args.patchfile[1], args.patchfile[2])
            sys.exit(0)
        elif args.clone:
            gpvdm_clone(os.getcwd(), copy_dirs=True)
            sys.exit(0)
        elif args.matcompress:
            archive_materials(os.path.join(os.getcwd(), "materials"))
            sys.exit(0)
        elif args.clonesrc:
            gpvdm_copy_src(clone - src[0])
            sys.exit(0)
        elif args.editvalue:
            inp_update_token_value(args.editvalue[0], args.editvalue[1],
                                   args.editvalue[2])
            sys.exit(0)
        elif args.load:
            set_sim_path(os.path.dirname(args.load[0]))
            #print("a")
        elif args.encrypt:
            inp_encrypt(args.encrypt[0])
            sys.exit(0)
        elif args.extract:
            archive_decompress("sim.gpvdm")
            sys.exit(0)
        elif args.scanplot:
            plot_token = dat_file()
            oplot_file = args.scan - plot[0]
            if plot_load_info(plot_token, oplot_file) == True:
                print("file0=", plot_token.file0, "<")
                plot_files, plot_labels, save_file = scan_gen_plot_data(
                    plot_token, os.path.dirname(oplot_file))
                print("written data to", save_file)
            else:
                print("Problem loading oplot file")
            sys.exit(0)

        if args.unpack:
            archive_unpack(args.unpack[0])
            sys.exit()
        if args.runscan:
            set_gui(False)
            scan_dir_path = args.runscan[0]  #program file
            exe_command = get_exe_command()
            program_list = tree_load_program(scan_dir_path)

            watch_dir = os.path.join(os.getcwd(), scan_dir_path)

            commands = []
            #server_find_simulations_to_run(commands,scan_dir_path)
            commands = tree_load_flat_list(scan_dir_path)
            print(commands)

            myserver = base_server()
            myserver.base_server_init(watch_dir)

            for i in range(0, len(commands)):
                myserver.base_server_add_job(commands[i], "")
                print("Adding job" + commands[i])

            myserver.print_jobs()
            myserver.simple_run()
            #simple_run(exe_command)

            sys.exit(0)

        if args.scanarchive:
            set_gui(False)
            scan_archive(args.scanarchive[0])
            sys.exit(0)

        if args.buildscan:
            set_gui(False)
            scan_items_clear()
            scan_items_populate_from_known_tokens()
            scan_items_populate_from_files()

            scan_dir_path = args.buildscan[0]  #program file
            base_dir = args.buildscan[1]  #base dir

            build_scan(scan_dir_path, base_dir)

            sys.exit(0)

        if args.scanbuildvectors:
            set_gui(False)
            scan_ml_build_vector(args.scanbuildvectors[0])
            sys.exit(0)

        if args.buildnestedscan:
            set_gui(False)

            scan_items_clear()
            scan_items_populate_from_known_tokens()
            scan_items_populate_from_files()

            scan_dir_path = os.path.abspath(
                args.buildnestedscan[0])  #program file
            sim_to_nest = os.path.abspath(
                args.buildnestedscan[1])  #program file
            scan_build_nested_simulation(
                scan_dir_path, os.path.join(os.getcwd(), sim_to_nest))

            sys.exit(0)
コード例 #26
0
	def server_check_user(self):
		command=multiplatform_exe_command(get_exe_command()+" --use")
		os.system(command)
コード例 #27
0
ファイル: cmp_class.py プロジェクト: xingangahu/gpvdm
    def init(self):
        return False
        self.dumps = 0
        self.plot_token = dat_file()

        vbox = gtk.VBox()

        self.multi_plot = False

        self.log_scale_y = "auto"

        menu_items = (
            ("/_Options", None, None, 0, "<Branch>"),
            ("/Options/_Subtract 0th frame", None,
             self.callback_toggle_subtract, 0, "<ToggleItem>", "gtk-save"),
            ("/_Axis/_Multiplot", None, self.callback_multi_plot, 0,
             "<ToggleItem>", "gtk-save"),
            ("/_Axis/_Set y axis to maximum", None, self.callback_set_min_max,
             0, "<ToggleItem>", "gtk-save"),
        )

        self.plot.item_factory.create_items(menu_items)

        primary_hbox.add(self.entry0)
        sim_vbox.add(primary_hbox)

        secondary_hbox = gtk.HBox()

        text = gtk.Label("Secondary dir")
        secondary_hbox.add(text)

        self.entry1 = gtk.combo_box_entry_new_text()
        self.entry1.show()

        for i in range(0, len(self.snapshot_list)):
            self.entry1.append_text(self.snapshot_list[i])

        secondary_hbox.add(self.entry1)
        sim_vbox.add(secondary_hbox)

        sim_vbox.show()
        #hbox.set_size_request(-1, 30)
        vbox.pack_start(sim_vbox, False, False, 0)

        hbox2 = gtk.HBox()
        text = gtk.Label("Files to plot")
        hbox2.add(text)
        self.entry2 = gtk.Entry()
        self.entry2.set_text("pt_map nt_map")
        self.entry2.show()
        hbox2.add(self.entry2)
        hbox2.set_size_request(-1, 30)
        vbox.pack_start(hbox2, False, False, 0)

        hbox3 = gtk.HBox()
        text = gtk.Label("Exprimental data")
        hbox3.add(text)
        self.entry3 = gtk.Entry()
        self.entry3.set_text("")
        self.entry3.show()
        hbox3.add(self.entry3)
        hbox3.set_size_request(-1, 30)
        vbox.pack_start(hbox3, False, False, 0)

        self.update_button = gtk.Button()
        self.update_button.set_label("Update")
        self.update_button.show()
        self.update_button.connect("clicked", self.callback_scale)
        vbox.add(self.update_button)

        self.config_load()
        self.count_dumps()

        if self.dumps == 0:
            md = gtk.MessageDialog(
                None, 0, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO,
                "No slice data has been written to disk.  You need to re-run the simulation with the dump_slices set to 1.  Would you like to do this now?  Note: This generates lots of files and will slow down the simulation."
            )

            response = md.run()

            if response == gtk.RESPONSE_YES:
                inp_update_token_value("dump.inp", "#dump_1d_slices", "1")
                os.system(get_exe_command())

            md.destroy()

            self.count_dumps()

        self.entry0.connect("changed", self.callback_edit)
        self.entry1.connect("changed", self.callback_edit)
        self.entry2.connect("changed", self.callback_edit)
        self.entry3.connect("changed", self.callback_edit)

        vbox.show_all()
        self.add(vbox)

        self.update(0)
        if self.dumps != 0:
            self.plot.do_plot()
            print("CONVERT!!!!!!!!!!!", type(self.plot.plot_token.key_units))
        self.set_border_width(10)
        self.set_title("Compare")
        self.set_icon_from_file(
            os.path.join(get_image_file_path(), "image.jpg"))

        self.connect('key_press_event', self.on_key_press_event)

        self.show()
コード例 #28
0
ファイル: qe.py プロジェクト: roderickmackenzie/gpvdm
	def update_graph(self):
		cmd = get_exe_command()+' --onlypos'
#		ret= os.system(cmd)
		self.fig.clf()
		self.draw_graph()
		self.fig.canvas.draw()