def displayTerminal(blockFile): path = blockFile.strip("_RAWDATA.arma") + ".dat" if not os.path.exists(path): print "Spesified file has not been blocked. Display canceled." return displayTool = Blocking(path, dynamic=False) displayTool.mainloop()
def main(): stdoutToFile, mpiFlag, openGUI, n_cores = parseCML(sys.argv) openGUI = openGUI&(not forceTerminal) makeJobScript = getJobFlag(sys.argv) if forceTerminal: display = displayTerminal selectFile = selectFileTerminal getYesNo = getYesNoTerminal getParams = getParamsTerminal else: display = lambda a : None selectFile = selectFileGUI getYesNo = getYesNoGUI getParams = getParamsGUI print "MPI nodes: ", n_cores if len(sys.argv) > 1: mainDir = sys.argv[1] if not os.path.exists(mainDir): print "First CML arg must be an existing path." sys.exit(1) fixedParams = {"dmc": [0,0,0], "vmc": [0,0,0]} #If we supply the correct CML args, we can #draw all runs under one comb, saving time. if len(sys.argv) > 2: for arg in sys.argv[2:]: key, val = arg.split("=") try: fixedParams[key] = eval(val) except: print "Invalid CML arg: ", arg sys.exit(1) print "successfully initialized blocking runs in path:" print mainDir print print "with parameters:" print fixedParams print proceed = raw_input("Continue? [y]") if proceed in ["", "y", "Y", "yes"]: initializeCoumbRuns(mainDir, fixedParams, n_cores, mpiFlag, makeJobScript) sys.exit(0) else: print "goodbye!" sys.exit(1) else: mainDir = pjoin(paths.scratchPath, "QMC_SCRATCH") if not forceTerminal: try: app = QApplication(sys.argv) except RuntimeError: app = QCoreApplication.instance() active = True GUIopened = False while active: blockFile = selectFile(mainDir) if not blockFile: print "No file selected. Breaking..." break path, fileName = os.path.split(blockFile) if openGUI and not GUIopened: subprocess.Popen(["python", pjoin(paths.toolsPath, 'qmcGUI.py'),\ path, ">", pjoin(path, "GUI_out.txt")]) GUIopened = True localSatisfaction = False lastParams = None while not localSatisfaction: lastParams = getParams(blockFile, lastParams, n_cores) if lastParams is None: break initRun(n_cores, mpiFlag, fileName, path, blockFile, lastParams, makeJobScript, display) if makeJobScript: localSatisfaction = True else: localSatisfaction = getYesNo("Satisfied with result?") active = getYesNo("View more files?") if not makeJobScript: if getYesNo("Save figs to file?"): plotTool = Blocking(toFile=True) for root, dirs, files in os.walk(mainDir): if root == mainDir: continue for outfile in files: if re.findall(plotTool.nametag, outfile): plotTool.filepath = pjoin(root, outfile) plotTool.mainloop() if not forceTerminal: app.exit()
def main(): stdoutToFile, mpiFlag, openGUI, n_cores = parseCML(sys.argv) global forceTerminal if not openGUI: forceTerminal = True makeJobScript = getJobFlag(sys.argv) if forceTerminal: display = displayTerminal selectFile = selectFileTerminal getYesNo = getYesNoTerminal getParams = getParamsTerminal else: display = lambda a: None selectFile = selectFileGUI getYesNo = getYesNoGUI getParams = getParamsGUI print "MPI nodes: ", n_cores if len(sys.argv) > 1: mainDir = sys.argv[1] if not os.path.exists(mainDir): print "First CML arg must be an existing path." sys.exit(1) fixedParams = {"dmc": [0, 0, 0], "vmc": [0, 0, 0]} #If we supply the correct CML args, we can #draw all runs under one comb, saving time. if len(sys.argv) > 2: for arg in sys.argv[2:]: key, val = arg.split("=") try: fixedParams[key] = eval(val) except: print "Invalid CML arg: ", arg sys.exit(1) print "successfully initialized blocking runs in path:" print mainDir print print "with parameters:" print fixedParams print proceed = raw_input("Continue? [y]") if proceed in ["", "y", "Y", "yes"]: initializeCoumbRuns(mainDir, fixedParams, n_cores, mpiFlag, makeJobScript) sys.exit(0) else: print "goodbye!" sys.exit(1) else: mainDir = pjoin(paths.scratchPath, "QMC_SCRATCH") if not forceTerminal: try: app = QApplication(sys.argv) except RuntimeError: app = QCoreApplication.instance() active = True GUIopened = False while active: blockFile = selectFile(mainDir) if not blockFile: print "No file selected. Breaking..." break path, fileName = os.path.split(blockFile) if openGUI and not GUIopened: subprocess.Popen(["python", pjoin(paths.toolsPath, 'qmcGUI.py'),\ path, ">", pjoin(path, "GUI_out.txt")]) GUIopened = True localSatisfaction = False lastParams = None while not localSatisfaction: lastParams = getParams(blockFile, lastParams, n_cores) if lastParams is None: break initRun(n_cores, mpiFlag, fileName, path, blockFile, lastParams, makeJobScript, display) if makeJobScript: localSatisfaction = True else: localSatisfaction = getYesNo("Satisfied with result?") active = getYesNo("View more files?") if not makeJobScript: if getYesNo("Save figs to file?"): plotTool = Blocking(toFile=True) for root, dirs, files in os.walk(mainDir): for outfile in files: if re.findall(plotTool.nametag, outfile): plotTool.filepath = pjoin(root, outfile) print "Figurizing", plotTool.filepath plotTool.mainloop() if not forceTerminal: app.exit()