From 3e5e89c8cf43f3af29a0004fb4e69cdf87c69b6e Mon Sep 17 00:00:00 2001 From: Paul Matthew Sutter Date: Wed, 1 Jan 2014 08:25:26 +0100 Subject: [PATCH 1/4] removed extraneous Done! signifier in fitting --- python_tools/void_python_tools/backend/launchers.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python_tools/void_python_tools/backend/launchers.py b/python_tools/void_python_tools/backend/launchers.py index a615416..edbbfe2 100644 --- a/python_tools/void_python_tools/backend/launchers.py +++ b/python_tools/void_python_tools/backend/launchers.py @@ -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 * @@ -1192,6 +1194,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"): From ece821de773407bbf969402b1871598fba5751df Mon Sep 17 00:00:00 2001 From: Paul Matthew Sutter Date: Wed, 1 Jan 2014 08:27:14 +0100 Subject: [PATCH 2/4] switched to a different plotting backend to better support running on headless machines From 89082b2f1e0eee3a587530c42f536f6f4621f53a Mon Sep 17 00:00:00 2001 From: Paul Matthew Sutter Date: Tue, 14 Jan 2014 11:06:29 +0100 Subject: [PATCH 3/4] merger --- c_tools/mock/generateMock.cpp | 8 ++++++++ python_tools/void_python_tools/backend/launchers.py | 9 ++++++--- zobov/jozov.c | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/c_tools/mock/generateMock.cpp b/c_tools/mock/generateMock.cpp index 1635a05..8192f42 100644 --- a/c_tools/mock/generateMock.cpp +++ b/c_tools/mock/generateMock.cpp @@ -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); 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++) { 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; abort(); } + if (z > maxZ) maxZ = z; + if (z < minZ) minZ = z; } + printf("Range of z: %.2f - %.2f\n", minZ, maxZ); } // slightly perturb particle positions diff --git a/python_tools/void_python_tools/backend/launchers.py b/python_tools/void_python_tools/backend/launchers.py index d9b2525..83873b4 100644 --- a/python_tools/void_python_tools/backend/launchers.py +++ b/python_tools/void_python_tools/backend/launchers.py @@ -1451,11 +1451,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" diff --git a/zobov/jozov.c b/zobov/jozov.c index a4ee12b..e2ed619 100644 --- a/zobov/jozov.c +++ b/zobov/jozov.c @@ -131,7 +131,7 @@ int main(int argc,char **argv) { printf("OVERFLOW for particle %d (pending %d). List of accepted:\n", i, j); for (q=0;q Date: Tue, 14 Jan 2014 11:36:19 +0100 Subject: [PATCH 4/4] cleaner handling of HOD errors --- .../pipeline_source/prepareCatalogs.in.py | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/python_tools/pipeline_source/prepareCatalogs.in.py b/python_tools/pipeline_source/prepareCatalogs.in.py index d853ac3..e5e6c87 100644 --- a/python_tools/pipeline_source/prepareCatalogs.in.py +++ b/python_tools/pipeline_source/prepareCatalogs.in.py @@ -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))