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

@ -116,6 +116,11 @@ void metricTransform(SimuData *data, int axis, bool reshift, bool pecvel, double
baseComovingDistance = LIGHT_SPEED/100.* gslIntegrate(e_computer, 0, z0, 1e-3); baseComovingDistance = LIGHT_SPEED/100.* gslIntegrate(e_computer, 0, z0, 1e-3);
cout << "Comoving distance = " << baseComovingDistance << " Mpc/h" << endl; cout << "Comoving distance = " << baseComovingDistance << " Mpc/h" << endl;
if (cosmo_flag) cout << "Will place particles on a lightcone..." << endl;
float minZ = 1.e99;
float maxZ = 0;
for (uint32_t i = 0; i < data->NumPart; i++) for (uint32_t i = 0; i < data->NumPart; i++)
{ {
float& x = data->Pos[x0][i]; float& x = data->Pos[x0][i];
@ -148,8 +153,11 @@ void metricTransform(SimuData *data, int axis, bool reshift, bool pecvel, double
cout << "The offending value is z=" << reduced_red << endl; cout << "The offending value is z=" << reduced_red << endl;
abort(); abort();
} }
if (z > maxZ) maxZ = z;
if (z < minZ) minZ = z;
} }
printf("Range of z: %.2f - %.2f\n", minZ, maxZ);
} }
// slightly perturb particle positions // slightly perturb particle positions

View file

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

View file

@ -32,6 +32,8 @@ import shutil
import glob import glob
import subprocess import subprocess
import sys import sys
import matplotlib
matplotlib.use('Agg')
from pylab import figure from pylab import figure
from netCDF4 import Dataset from netCDF4 import Dataset
from void_python_tools.backend.classes import * 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+\ figure(1).savefig(figDir+"/stackedVoid_"+sampleName+\
"_"+runSuffix+".png") "_"+runSuffix+".png")
print "Done!"
sys.stdout = sys.__stdout__ sys.stdout = sys.__stdout__
#sys.stderr = sys.__stderr__ #sys.stderr = sys.__stderr__
if jobSuccessful(logFile, "Done!\n"): 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, workDir+"/avedistortion_",
vp.do_all_obs(zbase, expList, aveDistList, vp.do_all_obs(zbase, expList, aveDistList,
rlist, plotTitle=plotTitle, plotAve=True) rlist, plotTitle=plotTitle, plotAve=True)
figure(1).savefig(figDir+"/hubble_"+sampleName+"_"+thisDataPortion+\ figure(1).savefig(figDir+"/hubble_"+setName+"_"+sampleName+"_"+\
thisDataPortion+\
".eps",bbox_inches='tight') ".eps",bbox_inches='tight')
figure(1).savefig(figDir+"/hubble_"+sampleName+"_"+thisDataPortion+\ figure(1).savefig(figDir+"/hubble_"+setName+"_"+sampleName+"_"+\
thisDataPortion+\
".pdf",bbox_inches='tight') ".pdf",bbox_inches='tight')
figure(1).savefig(figDir+"/hubble_"+sampleName+"_"+thisDataPortion+\ figure(1).savefig(figDir+"/hubble_"+setName+"_"+sampleName+"_"+\
thisDataPortion+\
".png",bbox_inches='tight') ".png",bbox_inches='tight')
else: else:
print "Skipping plot" print "Skipping plot"

View file

@ -131,7 +131,7 @@ int main(int argc,char **argv) {
printf("OVERFLOW for particle %d (pending %d). List of accepted:\n", i, j); printf("OVERFLOW for particle %d (pending %d). List of accepted:\n", i, j);
for (q=0;q<p[i].nadj;q++) for (q=0;q<p[i].nadj;q++)
printf(" %d\n", p[i].adj[q]); printf(" %d\n", p[i].adj[q]);
abort(); //abort();
} }
if (p[j].ncnt == p[j].nadj) if (p[j].ncnt == p[j].nadj)
{ {
@ -139,7 +139,7 @@ int main(int argc,char **argv) {
printf("OVERFLOW for particle %d (pending %d). List of accepted:\n", j, i); printf("OVERFLOW for particle %d (pending %d). List of accepted:\n", j, i);
for (q=0;q<p[j].nadj;q++) for (q=0;q<p[j].nadj;q++)
printf(" %d\n", p[j].adj[q]); printf(" %d\n", p[j].adj[q]);
abort(); //abort();
} }
p[i].adj[p[i].ncnt] = j; p[i].adj[p[i].ncnt] = j;