This commit is contained in:
P.M. Sutter 2014-01-15 16:04:56 -06:00
commit 615e60c5d2
4 changed files with 36 additions and 10 deletions

View file

@ -812,6 +812,8 @@ if (args.hod or args.all) and haloFileBase != "":
print " ", thisHod['name']
sys.stdout.flush()
sampleName = getSampleName(prefix+"hod_"+thisHod['name'], redshift, False)
parFileName = "./hod.par"
parFile = open(parFileName, 'w')
parFile.write(parFileText.format(omegaM=omegaM,
@ -831,19 +833,29 @@ if (args.hod or args.all) and haloFileBase != "":
sampleName=sampleName))
parFile.close()
sampleName = getSampleName(prefix+"hod_"+thisHod['name'], redshift, False)
tempFile = "./hod.out_"+sampleName
output = open(tempFile, 'w')
HOD_PATH = "/home/psutter2/projects/Voids/vide/c_tools/hod/hod"
HOD_PATH = "@CMAKE_BINARY_DIR@/c_tools/hod/hod"
#os.system(HOD_PATH+" "+parFileName+">& " + tempFile)
subprocess.call(HOD_PATH+" "+parFileName, stdout=output, stderr=output, shell=True)
subprocess.call(HOD_PATH+" "+parFileName, stdout=output, stderr=output,
shell=True)
output.close()
hodWorked = False
for line in open(tempFile):
if "MLO" in line:
print " (minimum halo mass = ", line.split()[1], ")"
hodWorked = True
break
os.unlink(tempFile)
if hodWorked:
os.unlink(tempFile)
else:
print "HOD Failed! Log follows:"
for line in open(tempFile):
print line
exit(-1)
outFileName = catalogDir+"/"+sampleName+".dat"
os.system("mv %s/hod_%s.mock %s" % (catalogDir, sampleName, outFileName))

View file

@ -32,6 +32,8 @@ import shutil
import glob
import subprocess
import sys
import matplotlib
matplotlib.use('Agg')
from pylab import figure
from netCDF4 import Dataset
from void_python_tools.backend.classes import *
@ -1266,6 +1268,7 @@ def launchFit(sample, stack, logFile=None, voidDir=None, figDir=None,
figure(1).savefig(figDir+"/stackedVoid_"+sampleName+\
"_"+runSuffix+".png")
print "Done!"
sys.stdout = sys.__stdout__
#sys.stderr = sys.__stderr__
if jobSuccessful(logFile, "Done!\n"):
@ -1451,11 +1454,14 @@ def launchHubble(dataPortions=None, dataSampleList=None, logDir=None,
#vp.do_all_obs(zbase, expList, workDir+"/avedistortion_",
vp.do_all_obs(zbase, expList, aveDistList,
rlist, plotTitle=plotTitle, plotAve=True)
figure(1).savefig(figDir+"/hubble_"+sampleName+"_"+thisDataPortion+\
figure(1).savefig(figDir+"/hubble_"+setName+"_"+sampleName+"_"+\
thisDataPortion+\
".eps",bbox_inches='tight')
figure(1).savefig(figDir+"/hubble_"+sampleName+"_"+thisDataPortion+\
figure(1).savefig(figDir+"/hubble_"+setName+"_"+sampleName+"_"+\
thisDataPortion+\
".pdf",bbox_inches='tight')
figure(1).savefig(figDir+"/hubble_"+sampleName+"_"+thisDataPortion+\
figure(1).savefig(figDir+"/hubble_"+setName+"_"+sampleName+"_"+\
thisDataPortion+\
".png",bbox_inches='tight')
else:
print "Skipping plot"