Example #1
0
def scan_nested_simulation(root_simulation,nest_simulation):
	a=tree_gen_flat_list(root_simulation,level=1)
	print(a)
	return
	program_list=tree_load_program(nest_simulation)

	names=tree_load_flat_list(root_simulation)
	commands=[]

	flat_simulation_list=[]
	#tree_save_flat_list(self.sim_dir,flat_simulation_list)

	for i in range(0,len(names)):
		dest_name=os.path.join(root_simulation,names[i])
		tree_gen(flat_simulation_list,program_list,dest_name,dest_name)

		files = os.listdir(dest_name)
		for file in files:
			if file.endswith(".inp") or file.endswith(".gpvdm") or file.endswith(".dat") :
				os.remove(os.path.join(dest_name,file))

		print(names[i],flat_simulation_list)
	tree_save_flat_list(root_simulation,flat_simulation_list)

	return
Example #2
0
def build_scan(scan_path,base_path,parent_window=None):
	scan_clean_dir(scan_path,parent_window=parent_window)

	flat_simulation_list=[]
	program_list=tree_load_program(scan_path)
	path=os.getcwd()

	if tree_gen(flat_simulation_list,program_list,base_path,scan_path)==False:
		error_dlg(parent_window,_("Problem generating tree."))
		return False
	os.chdir(path)

	tree_save_flat_list(scan_path,flat_simulation_list)
Example #3
0
    def build_scan(self):
        self.clean_dir()

        flat_simulation_list = []

        path = os.getcwd()

        #print(self.scan_dir,flat_simulation_list,self.program_list,self.base_dir)
        if tree_gen(self.scan_dir, flat_simulation_list, self.program_list,
                    self.base_dir) == False:
            error_dlg(self.parent_window, _("Problem generating tree."))
            return False
        os.chdir(path)

        tree_save_flat_list(self.scan_dir, flat_simulation_list)
Example #4
0
def scan_build_nested_simulation(root_simulation, nest_simulation):

    if os.path.isdir(nest_simulation) == False:
        print("Path ", nest_simulation, "does not exist")
        sys.exit(0)

    progress_window = progress_class()
    progress_window.show()
    progress_window.start()

    process_events()

    nest_simulation_name = os.path.basename(nest_simulation)
    program_list = tree_load_program(nest_simulation)

    files = os.listdir(root_simulation)
    simulations = []
    for i in range(0, len(files)):
        if os.path.isfile(os.path.join(root_simulation, files[i],
                                       "sim.gpvdm")) == True:
            simulations.append(files[i])

    flat_simulation_list = []

    path = os.getcwd()
    for i in range(0, len(simulations)):
        dest_name = os.path.join(root_simulation, simulations[i],
                                 nest_simulation_name)
        base_dir = os.path.join(root_simulation, simulations[i])
        #print(">>>",dest_name,base_dir,"<<",nest_simulation_name)
        tree_gen(dest_name, flat_simulation_list, program_list, base_dir)

        progress_window.set_fraction(float(i) / float(len(simulations)))
        progress_window.set_text(simulations[i])
        process_events()

    progress_window.stop()

    os.chdir(path)

    flat_simulation_list = tree_gen_flat_list(root_simulation, level=1)

    #print(flat_simulation_list)
    tree_save_flat_list(root_simulation, flat_simulation_list)

    return
Example #5
0
	def simulate(self,run_simulation,generate_simulations,args):

		base_dir=os.getcwd()
		run=True

		if self.tab.rowCount() == 0:
			error_dlg(self,_("You have not selected any parameters to scan through.  Use the add button."))
			return


		if self.sim_name=="":
			error_dlg(self,_("No sim dir name"))
			return

		self.make_sim_dir()
		if generate_simulations==True:
			scan_clean_dir(self,self.sim_dir)

		print("Running")
		program_list=[]
		for i in range(0,self.tab.rowCount()):
			program_list.append([tab_get_value(self.tab,i,0),tab_get_value(self.tab,i,1),tab_get_value(self.tab,i,3),tab_get_value(self.tab,i,4)])

		print(program_list)
		tree_load_config(self.sim_dir)
		if generate_simulations==True:
			flat_simulation_list=[]
			if tree_gen(flat_simulation_list,program_list,base_dir,self.sim_dir)==False:
				error_dlg(self,_("Problem generating tree."))
				return

			print("flat list",flat_simulation_list)
			tree_save_flat_list(self.sim_dir,flat_simulation_list)

		commands=tree_load_flat_list(self.sim_dir)
		print("loaded commands",commands)
		if run_simulation==True:
			self.send_commands_to_server(commands,args)

		self.save_combo()
		os.chdir(base_dir)
		gc.collect()
Example #6
0
def scan_build_nested_simulation(root_simulation, nest_simulation):

    progress_window = progress_class()
    progress_window.show()
    progress_window.start()

    process_events()

    program_list = tree_load_program(nest_simulation)

    files = os.listdir(root_simulation)
    simulations = []
    for i in range(0, len(files)):
        if os.path.isfile(os.path.join(root_simulation, files[i],
                                       "sim.gpvdm")) == True:
            simulations.append(files[i])

    flat_simulation_list = []

    path = os.getcwd()
    for i in range(0, len(simulations)):
        dest_name = os.path.join(root_simulation, simulations[i])
        tree_gen(flat_simulation_list, program_list, dest_name, dest_name)

        progress_window.set_fraction(float(i) / float(len(simulations)))
        progress_window.set_text(simulations[i])
        process_events()

    progress_window.stop()

    os.chdir(path)

    flat_simulation_list = tree_gen_flat_list(root_simulation, level=1)

    print(flat_simulation_list)
    tree_save_flat_list(root_simulation, flat_simulation_list)

    return
Example #7
0
	def simulate(self,run_simulation,generate_simulations):

		base_dir=os.getcwd()
		run=True

		if len(self.liststore_combobox) == 0:
			message = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK)
			message.set_markup(_("You have not selected any parameters to scan through.  Use the add button."))
			message.run()
			message.destroy()
			return


		if self.sim_name=="":
			message = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK)
			message.set_markup(_("No sim dir name"))
			message.run()
			message.destroy()
			return

		self.make_sim_dir()
		if generate_simulations==True:
			scan_clean_dir(self.sim_dir)


		for i in range(0,len(self.liststore_combobox)):
			found=False
			for ii in range(0,len(self.liststore_op_type)):
				if self.liststore_combobox[i][2]==self.liststore_op_type[ii][0]:
					found=True
			if found==False:
				run=False

				md = gtk.MessageDialog(None, 
				0, gtk.MESSAGE_ERROR, 
				gtk.BUTTONS_CLOSE, self.liststore_combobox[i][2]+"Not valid")
				md.run()
				md.destroy()
				break



		if run==True:
			print "Running"
			program_list=[]
			for i in range(0,len(self.liststore_combobox)):
				program_list.append([self.liststore_combobox[i][0],self.liststore_combobox[i][1],self.liststore_combobox[i][2],self.liststore_combobox[i][3]])

			print program_list

			if generate_simulations==True:
				flat_simulation_list=[]
				tree_gen(flat_simulation_list,program_list,base_dir,self.sim_dir)
				print "flat list",flat_simulation_list
				tree_save_flat_list(self.sim_dir,flat_simulation_list)

			commands=[]
			server_find_simulations_to_run(commands,self.sim_dir)

			if run_simulation==True:
				self.send_commands_to_server(commands)

		self.save_combo()
		os.chdir(base_dir)
		gc.collect()