コード例 #1
0
def plot_populate_plot_token(plot_token, file_name):
    if file_name != None:
        ret = plot_load_info(plot_token, file_name)
        print("ret====", ret)
        if ret == True:
            return True

    #check to see if I have been provided with a token

    if plot_token != None:
        my_token_lib = tokens()
        result0 = my_token_lib.find(plot_token.tag0)
        result1 = my_token_lib.find(plot_token.tag1)
        print("one=", plot_token.tag0, result0)
        print("two=", plot_token.tag1, result1)
        if result0 != False:
            plot_token.x_label = result0.info
            plot_token.x_units = result0.units
            plot_token.x_mul = result0.number_mul

            plot_token.data_label = result1.info
            plot_token.data_units = result1.units
            plot_token.data_mul = result1.number_mul

            plot_token.title = result0.info + " " + result1.info

            print("Found tokens", plot_token.tag0, plot_token.tag1)
            return True
        else:
            print("Tokens not found", plot_token.tag0, plot_token.tag1)

    return False
コード例 #2
0
ファイル: plot.py プロジェクト: roderickmackenzie/opvdm
def plot_populate_plot_token(plot_token,file_name):
	if file_name!=None:
		ret=plot_load_info(plot_token,file_name)
		print "ret====",ret
		if ret==True:
			return True

	#check to see if I have been provided with a token

	if plot_token!=None:
		my_token_lib=tokens()
		result0=my_token_lib.find(plot_token.tag0)
		result1=my_token_lib.find(plot_token.tag1)
		print "one=",plot_token.tag0,result0
		print "two=",plot_token.tag1,result1
		if result0!=False:
			plot_token.x_label=result0.info
			plot_token.x_units=result0.units
			plot_token.x_mul=result0.number_mul

			plot_token.y_label=result1.info
			plot_token.y_units=result1.units
			plot_token.y_mul=result1.number_mul

			plot_token.title=result0.info+" "+result1.info

			print "Found tokens",plot_token.tag0,plot_token.tag1
			return True
		else:
			print "Tokens not found",plot_token.tag0,plot_token.tag1

	return False
コード例 #3
0
	def append(self,file_name):
		plot_token=dat_file()
		if plot_load_info(plot_token,file_name)==True:
			menu_item = gtk.MenuItem(os.path.basename(file_name).split(".")[0])
			self.menu.append(menu_item)
			self.list.append(plot_token)
			menu_item.connect("activate", self.callback,self.list[len(self.list)-1])
			menu_item.show()
コード例 #4
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]
コード例 #5
0
	def append(self,file_name):
		plot_token=plot_state()
		if plot_load_info(plot_token,file_name)==True:
			menu_item = gtk.MenuItem(os.path.basename(file_name).split(".")[0])
			self.menu.append(menu_item)
			self.list.append(plot_token)
			menu_item.connect("activate", self.callback,self.list[len(self.list)-1])
			menu_item.show()
コード例 #6
0
ファイル: import_data.py プロジェクト: xj361685640/gpvdm
    def load_file(self):
        if self.file_name != None:
            if os.path.isfile(self.file_name) == True:
                f = open(self.file_name, "r")
                lines = f.readlines()
                f.close()
                text = ""
                for l in range(0, len(lines)):
                    text = text + lines[l].rstrip() + "\n"
                self.raw_data_path.setText(self.file_name)
                self.raw_data.setText(text)

                got_info = plot_load_info(self.info_token, self.file_name)
                self.ribbon.import_data.setEnabled(True)
                self.ribbon.plot.setEnabled(True)
コード例 #7
0
ファイル: make_man.py プロジェクト: roderickmackenzie/gpvdm
def make_man():
	file_paths = []  # List which will store all of the full filepaths.
	out=""
	files=glob.glob("*.dat")
	section_one=[]
	section_two=[]
	text_list=[]
	for filename in files:

		if filename.endswith(".dat")==True:

			temp=plot_state()
			ret=plot_load_info(temp,filename)
			if ret==True:

				section_one.append(temp.section_one)
				section_two.append(temp.section_two)
				out=""
				filename=filename.replace("_","\\_")
				out=out+"\\textbf{"+filename+"}:"+ temp.title+"\\newline\n"
				out=out+"x-axis:"+temp.x_label+"($"+temp.x_units+"$)\\newline\n"
				out=out+"y-axis:"+temp.y_label+"($"+temp.y_units+"$)\\newline\n"
				out=out+"\\newline\n"
				text_list.append(out)


				file_paths.append(filename)

	section_one, section_two, text_list = zip(*sorted(zip(section_one, section_two,text_list),key = operator.itemgetter(1, 2)))



	text_file = open("./man_src/files.tex", "w")
	last_section_one=""
	last_section_two=""
	for i in range(0,len(text_list)):
		if section_one[i]!="":
			if last_section_one!=section_one[i]:
				last_section_one=section_one[i]
				text_file.write("\subsubsection{"+section_one[i]+"}\n")

			if last_section_two!=section_two[i]:
				last_section_two=section_two[i]
				text_file.write("\paragraph{"+section_two[i]+"}\n")

			text_file.write(text_list[i])
	text_file.close()
コード例 #8
0
ファイル: make_man.py プロジェクト: xingangahu/gpvdm
def make_man():
	file_paths = []  # List which will store all of the full filepaths.
	out=""
	files=glob.glob("*.dat")
	section_one=[]
	section_two=[]
	text_list=[]
	for filename in files:

		if filename.endswith(".dat")==True:

			temp=dat_file()
			ret=plot_load_info(temp,filename)
			if ret==True:

				section_one.append(temp.section_one)
				section_two.append(temp.section_two)
				out=""
				filename=filename.replace("_","\\_")
				out=out+"\\textbf{"+filename+"}:"+ temp.title+"\\newline\n"
				out=out+"x-axis:"+temp.x_label+"($"+temp.x_units+"$)\\newline\n"
				out=out+"y-axis:"+temp.data_label+"($"+temp.data_units+"$)\\newline\n"
				out=out+"\\newline\n"
				text_list.append(out)


				file_paths.append(filename)

	section_one, section_two, text_list = zip(*sorted(zip(section_one, section_two,text_list),key = operator.itemgetter(1, 2)))



	text_file = open("./man_src/files.tex", "w")
	last_section_one=""
	last_section_two=""
	for i in range(0,len(text_list)):
		if section_one[i]!="":
			if last_section_one!=section_one[i]:
				last_section_one=section_one[i]
				text_file.write("\subsubsection{"+section_one[i]+"}\n")

			if last_section_two!=section_two[i]:
				last_section_two=section_two[i]
				text_file.write("\paragraph{"+section_two[i]+"}\n")

			text_file.write(text_list[i])
	text_file.close()
コード例 #9
0
ファイル: workbook.py プロジェクト: roderickmackenzie/gpvdm
def gen_workbook(input_file_or_dir,output_file):
	wb = Workbook()
	info_token=plot_state()
	if os.path.isfile(input_file_or_dir):
		files=[input_file_or_dir]
	if os.path.isdir(input_file_or_dir):
		files=glob.glob(os.path.join(input_file_or_dir,"*.dat"))
	else:
		return
	
	for my_file in files:
		print("about to save1",my_file)

		if plot_load_info(info_token,my_file)==True:
			x=[]
			y=[]
			z=[]
			data=dat_file()
			if dat_file_read(data,my_file)==True:
				print("read",my_file)
				ws = wb.create_sheet(title=title_truncate(os.path.basename(my_file)))
				ws.cell(column=1, row=1, value=info_token.title)
				ws.cell(column=1, row=2, value=info_token.x_label+" ("+info_token.x_units+") ")
				ws.cell(column=2, row=2, value=info_token.y_label+" ("+info_token.y_units+") ")
		
				for i in range(0,data.y_len):
					ws.cell(column=1, row=i+3, value=data.y_scale[i])
					ws.cell(column=2, row=i+3, value=data.data[0][0][i])

				c1 = ScatterChart()
				c1.title = info_token.title
				c1.style = 13
				c1.height=20
				c1.width=20
				c1.y_axis.title = info_token.y_label+" ("+info_token.y_units+") "
				c1.x_axis.title = info_token.x_label+" ("+info_token.x_units+") "

				xdata = Reference(ws, min_col=1, min_row=3, max_row=3+data.y_len)
				ydata = Reference(ws, min_col=2, min_row=3, max_row=3+data.y_len)

				series = Series(ydata,xdata,  title_from_data=True)
				c1.series.append(series)
				ws.add_chart(c1, "G4")

	print("about to save1")
	wb.save(filename = output_file)
	print("about to save0")
コード例 #10
0
ファイル: cmp_class.py プロジェクト: roderickmackenzie/gpvdm
	def callback_scale(self, adj):
		self.update(self.adj1.value)

		if plot_load_info(self.plot_token,self.file_names[0])==True:
			self.plot.do_plot()
コード例 #11
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)
コード例 #12
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.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:
            scan = scans_io(os.getcwd())
            scan.clean_all()
            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.unpack:
            archive_decompress(os.path.join(os.getcwd(), "sim.gpvdm"),
                               remove_gpvdm_file=False)
            sys.exit(0)
        elif args.pack:
            archive_compress(os.path.join(os.getcwd(), "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)
コード例 #13
0
ファイル: cmp_class.py プロジェクト: xingangahu/gpvdm
    def callback_scale(self, adj):
        self.update(self.adj1.value)

        if plot_load_info(self.plot_token, self.file_names[0]) == True:
            self.plot.do_plot()
コード例 #14
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)
コード例 #15
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)
コード例 #16
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"