mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 23:31:12 +00:00
switched to more general and universal subprocess command for launching
This commit is contained in:
parent
d8108d3a8e
commit
079656a8da
1 changed files with 79 additions and 29 deletions
|
@ -87,8 +87,12 @@ def launchGenerate(sample, binPath, workDir=None, inputDataDir=None,
|
||||||
|
|
||||||
if regenerate or not (continueRun and jobSuccessful(logFile, "Done!\n")):
|
if regenerate or not (continueRun and jobSuccessful(logFile, "Done!\n")):
|
||||||
file(parmFile, mode="w").write(conf)
|
file(parmFile, mode="w").write(conf)
|
||||||
cmd = "%s --configFile=%s &> %s" % (binPath,parmFile,logFile)
|
arg1 = "-configFile=%s" % parmFile
|
||||||
os.system(cmd)
|
log = open(logFile, 'w')
|
||||||
|
subprocess.call([binPath, arg1], stdout=log, stderr=log)
|
||||||
|
log.close()
|
||||||
|
#cmd = "%s --configFile=%s >& %s" % (binPath,parmFile,logFile)
|
||||||
|
#os.system(cmd)
|
||||||
if jobSuccessful(logFile, "Done!\n"):
|
if jobSuccessful(logFile, "Done!\n"):
|
||||||
print "done"
|
print "done"
|
||||||
else:
|
else:
|
||||||
|
@ -204,10 +208,16 @@ def launchGenerate(sample, binPath, workDir=None, inputDataDir=None,
|
||||||
file(parmFile, mode="w").write(conf)
|
file(parmFile, mode="w").write(conf)
|
||||||
|
|
||||||
if (prevSubSample == -1):
|
if (prevSubSample == -1):
|
||||||
cmd = "%s --configFile=%s &> %s" % (binPath,parmFile,logFile)
|
#cmd = "%s --configFile=%s &> %s" % (binPath,parmFile,logFile)
|
||||||
|
log = open(logFile, 'w')
|
||||||
else:
|
else:
|
||||||
cmd = "%s --configFile=%s &>> %s" % (binPath,parmFile,logFile)
|
#cmd = "%s --configFile=%s &>> %s" % (binPath,parmFile,logFile)
|
||||||
os.system(cmd)
|
log = open(logFile, 'a')
|
||||||
|
arg1 = "--configFile=%s" % parmFile
|
||||||
|
subprocess.call([binPath, arg1], stdout=log, stderr=log)
|
||||||
|
#subprocess.call([binPath, arg1], stdout=log, stderr=log)
|
||||||
|
log.close()
|
||||||
|
#os.system(cmd)
|
||||||
|
|
||||||
# remove intermediate files
|
# remove intermediate files
|
||||||
if (prevSubSample != -1):
|
if (prevSubSample != -1):
|
||||||
|
@ -322,24 +332,49 @@ def launchZobov(sample, binPath, zobovDir=None, logDir=None, continueRun=None,
|
||||||
if os.access(zobovDir+"/voidDesc_"+sampleName+".out", os.F_OK):
|
if os.access(zobovDir+"/voidDesc_"+sampleName+".out", os.F_OK):
|
||||||
os.unlink(zobovDir+"/voidDesc_"+sampleName+".out")
|
os.unlink(zobovDir+"/voidDesc_"+sampleName+".out")
|
||||||
|
|
||||||
cmd = "%s/vozinit %s 0.1 1.0 %g %s %g %s %s %s &> %s" % \
|
#cmd = "%s/vozinit %s 0.1 1.0 %g %s %g %s %s %s &> %s" % \
|
||||||
(binPath, datafile, numZobovDivisions, \
|
# (binPath, datafile, numZobovDivisions, \
|
||||||
"_"+sampleName, numZobovThreads, \
|
# "_"+sampleName, numZobovThreads, \
|
||||||
binPath, zobovDir, maskIndex, logFile)
|
# binPath, zobovDir, maskIndex, logFile)
|
||||||
os.system(cmd)
|
#os.system(cmd)
|
||||||
|
cmd = [binPath+"/vozinit", datafile, "0.1", "1.0", str(numZobovDivisions), \
|
||||||
|
"_"+sampleName, str(numZobovThreads), \
|
||||||
|
binPath, zobovDir, str(maskIndex)]
|
||||||
|
log = open(logFile, 'w')
|
||||||
|
subprocess.call(cmd, stdout=log, stderr=log)
|
||||||
|
log.close()
|
||||||
|
|
||||||
|
#cmd = "./%s >> %s 2>&1" % (vozScript, logFile)
|
||||||
|
#os.system(cmd)
|
||||||
|
cmd = ["./%s" % vozScript]
|
||||||
|
log = open(logFile, 'a')
|
||||||
|
subprocess.call(cmd, stdout=log, stderr=log)
|
||||||
|
log.close()
|
||||||
|
|
||||||
cmd = "./%s >> %s 2>&1" % (vozScript, logFile)
|
|
||||||
os.system(cmd)
|
|
||||||
# cmd = "%s/jozov %s %s %s %s %s %g %s >> %s 2>&1" % \
|
# cmd = "%s/jozov %s %s %s %s %s %g %s >> %s 2>&1" % \
|
||||||
cmd = "%s/../c_tools/zobov2/jozov2/jozov2 %s %s %s %s %s %g %s >> %s 2>&1" % \
|
#cmd = "%s/../c_tools/zobov2/jozov2/jozov2 %s %s %s %s %s %g %s >> %s 2>&1" % \
|
||||||
(binPath, \
|
# (binPath, \
|
||||||
|
# zobovDir+"/adj_"+sampleName+".dat", \
|
||||||
|
# zobovDir+"/vol_"+sampleName+".dat", \
|
||||||
|
# zobovDir+"/voidPart_"+sampleName+".dat", \
|
||||||
|
# zobovDir+"/voidZone_"+sampleName+".dat", \
|
||||||
|
# zobovDir+"/voidDesc_"+sampleName+".out", \
|
||||||
|
# maxDen, maskIndex, logFile)
|
||||||
|
#os.system(cmd)
|
||||||
|
cmd = [binPath+"../c_tools/zobov2/jozov2/jozov2", \
|
||||||
zobovDir+"/adj_"+sampleName+".dat", \
|
zobovDir+"/adj_"+sampleName+".dat", \
|
||||||
zobovDir+"/vol_"+sampleName+".dat", \
|
zobovDir+"/vol_"+sampleName+".dat", \
|
||||||
zobovDir+"/voidPart_"+sampleName+".dat", \
|
zobovDir+"/voidPart_"+sampleName+".dat", \
|
||||||
zobovDir+"/voidZone_"+sampleName+".dat", \
|
zobovDir+"/voidZone_"+sampleName+".dat", \
|
||||||
zobovDir+"/voidDesc_"+sampleName+".out", \
|
zobovDir+"/voidDesc_"+sampleName+".out", \
|
||||||
maxDen, maskIndex, logFile)
|
str(maxDen), str(maskIndex)]
|
||||||
os.system(cmd)
|
log = open(logFile, 'a')
|
||||||
|
subprocess.call(cmd, stdout=log, stderr=log)
|
||||||
|
log.close()
|
||||||
|
|
||||||
|
# don't need the subbox files
|
||||||
|
for fileName in glob.glob(zobovDir+"/part._"+sampleName+".*"):
|
||||||
|
os.unlink(fileName)
|
||||||
|
|
||||||
if jobSuccessful(logFile, "Done!\n"):
|
if jobSuccessful(logFile, "Done!\n"):
|
||||||
print "done"
|
print "done"
|
||||||
|
@ -412,11 +447,14 @@ def launchPrune(sample, binPath,
|
||||||
cmd += useComovingFlag
|
cmd += useComovingFlag
|
||||||
cmd += " --outputDir=" + zobovDir
|
cmd += " --outputDir=" + zobovDir
|
||||||
cmd += " --sampleName=" + str(sampleName)
|
cmd += " --sampleName=" + str(sampleName)
|
||||||
cmd += " &> " + logFile
|
#cmd += " &> " + logFile
|
||||||
f=file("run_prune.sh",mode="w")
|
#f=file("run_prune.sh",mode="w")
|
||||||
f.write(cmd)
|
#f.write(cmd)
|
||||||
f.close()
|
#f.close()
|
||||||
os.system(cmd)
|
#os.system(cmd)
|
||||||
|
log = open(logFile, 'w')
|
||||||
|
subprocess.call(cmd, stdout=log, stderr=log, shell=True)
|
||||||
|
log.close()
|
||||||
|
|
||||||
if jobSuccessful(logFile, "NetCDF: Not a valid ID\n") or \
|
if jobSuccessful(logFile, "NetCDF: Not a valid ID\n") or \
|
||||||
jobSuccessful(logFile, "Done!\n"):
|
jobSuccessful(logFile, "Done!\n"):
|
||||||
|
@ -485,9 +523,12 @@ def launchVoidOverlap(sample1, sample2, sample1Dir, sample2Dir,
|
||||||
if matchMethod == "useID": cmd += " --useID"
|
if matchMethod == "useID": cmd += " --useID"
|
||||||
cmd += periodicLine
|
cmd += periodicLine
|
||||||
cmd += " --outfile=" + outputFile
|
cmd += " --outfile=" + outputFile
|
||||||
cmd += " &> " + logFile
|
#cmd += " &> " + logFile
|
||||||
open("temp.par",'w').write(cmd)
|
#open("temp.par",'w').write(cmd)
|
||||||
os.system(cmd)
|
#os.system(cmd)
|
||||||
|
log = open(logFile, 'w')
|
||||||
|
subprocess.call(cmd, stdout=log, stderr=log, shell=True)
|
||||||
|
log.close()
|
||||||
|
|
||||||
if jobSuccessful(logFile, "Done!\n"):
|
if jobSuccessful(logFile, "Done!\n"):
|
||||||
print "done"
|
print "done"
|
||||||
|
@ -650,9 +691,14 @@ def launchStack(sample, stack, binPath, thisDataPortion=None, logDir=None,
|
||||||
fp.close()
|
fp.close()
|
||||||
|
|
||||||
if not (continueRun and jobSuccessful(logFile, "Done!\n")):
|
if not (continueRun and jobSuccessful(logFile, "Done!\n")):
|
||||||
cmd = "%s --configFile=%s &> %s" % \
|
#cmd = "%s --configFile=%s &> %s" % \
|
||||||
(binPath, parmFile, logFile)
|
# (binPath, parmFile, logFile)
|
||||||
os.system(cmd)
|
#os.system(cmd)
|
||||||
|
cmd = "%s --configFile=%s" % \
|
||||||
|
(binPath, parmFile)
|
||||||
|
log = open(logFile, 'w')
|
||||||
|
subprocess.call(cmd, stdout=log, stderr=log, shell=True)
|
||||||
|
log.close()
|
||||||
|
|
||||||
if jobSuccessful(logFile, "Done!\n"):
|
if jobSuccessful(logFile, "Done!\n"):
|
||||||
print "done"
|
print "done"
|
||||||
|
@ -1721,8 +1767,12 @@ def launchVelocityStack(sample, stack, binPath,
|
||||||
parameters="--velocityField=%s --voidCenters=%s --Rmax=%e --L0=%e --numBins=%d" % (velField_file, voidCenters, Rmax, Boxsize, numBins)
|
parameters="--velocityField=%s --voidCenters=%s --Rmax=%e --L0=%e --numBins=%d" % (velField_file, voidCenters, Rmax, Boxsize, numBins)
|
||||||
|
|
||||||
if not (continueRun and jobSuccessful(logFile, "Done!\n")):
|
if not (continueRun and jobSuccessful(logFile, "Done!\n")):
|
||||||
cmd = "%s %s &> %s" % (binPath,parameters,logFile)
|
#cmd = "%s %s &> %s" % (binPath,parameters,logFile)
|
||||||
os.system(cmd)
|
#os.system(cmd)
|
||||||
|
cmd = "%s %s" % (binPath,parameters)
|
||||||
|
log = open(logFile, 'w')
|
||||||
|
subprocess.call(cmd, stdout=log, stderr=log, shell=True)
|
||||||
|
log.close()
|
||||||
if jobSuccessful(logFile, "Done!\n"):
|
if jobSuccessful(logFile, "Done!\n"):
|
||||||
print "done"
|
print "done"
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue