示例#1
0
    def simulate(self, run_simulation, generate_simulations, args=""):

        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()

        tree_load_config(self.sim_dir)
        if generate_simulations == True:
            build_scan(self.sim_dir, get_sim_path(), parent_window=self)

        if run_simulation == True:
            self.scan_run(args=args)

        self.save_combo()
        os.chdir(get_sim_path())
        gc.collect()
示例#2
0
 def build_scan(self):
     build_scan(self.sim_dir, get_sim_path())
示例#3
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)