From 80c2b7f603bc6c94a905ac8a279e55a9832fecc6 Mon Sep 17 00:00:00 2001 From: "P.M. Sutter" Date: Sun, 18 Nov 2012 22:47:49 -0600 Subject: [PATCH] more bug fixes for the minimum halo mass cuts...sigh --- README | 17 ++++----------- c_tools/mock/generateFromCatalog.cpp | 10 ++++----- c_tools/mock/generateMock.cpp | 21 ++++++++++++------- c_tools/stacking/pruneVoids.cpp | 17 ++++++++------- external/cosmotool/src/loadSimu.hpp | 2 +- pipeline/generateCatalog.py | 4 ++-- pipeline/prepareCatalogs.py | 3 ++- plotting/datasetsToPlot.py | 2 +- .../void_python_tools/backend/launchers.py | 6 +++--- 9 files changed, 41 insertions(+), 41 deletions(-) diff --git a/README b/README index 8bf010a..15924e2 100644 --- a/README +++ b/README @@ -1,13 +1,10 @@ After compiling, go to the pipeline directory. -Edit the parameters at the top of prepareGadgetCatalog.py: decide -where to put outputs, how many redshifts to do, how many slices, -subdivisions, subsamples, etc. etc. +Create a dataset parameter file. Look at datasets/multidark.py for +an example. Describe the simulation, where to put outputs, how many +redshift slices, subvolumes, etc. etc. -Note that eventually prepareGadgetCatalog will be replaced by the more -general and flexible prepareCatalogs. - -prepareGadgetCatalogs will produce a pipeline script for each +prepareCatalogs will produce a pipeline script for each subsampling you choose. If you have multiple redshift particle files, and choose multiple slices and/or subdivisions, they will be packaged in the same pipeline script. @@ -22,16 +19,10 @@ Check the logfiles for any error messages. See the README of the public void catalog for the format of the outputs. -I'm also working on incorporating plotting into the pipeline script, -so that you can immediately get some basic info about the voids. - Please do not change the outputs of pruneVoids etc. without discussion, since further analysis relies on the current formats. If you're wondering why these scripts are rather complex, it's because it can also support A-P analysis, which is much more complicated :) -We can talk about ways to incorporate your analysis into the pipline -and to have your tools under this umbrella. - Good luck! diff --git a/c_tools/mock/generateFromCatalog.cpp b/c_tools/mock/generateFromCatalog.cpp index 1d49da3..2b47389 100644 --- a/c_tools/mock/generateFromCatalog.cpp +++ b/c_tools/mock/generateFromCatalog.cpp @@ -295,10 +295,10 @@ void generateSurfaceMask(generateFromCatalog_info& args , int nPart = 100; // TEST - //for (int iDir = 0; iDir < 0; iDir++) { - //for (int iFace = 0; iFace < 0; iFace++) { - for (int iDir = 0; iDir < 3; iDir++) { - for (int iFace = 0; iFace < 2; iFace++) { + for (int iDir = 0; iDir < 0; iDir++) { + for (int iFace = 0; iFace < 0; iFace++) { + //for (int iDir = 0; iDir < 3; iDir++) { + //for (int iFace = 0; iFace < 2; iFace++) { int iy = (iDir + 1) % 3; int iz = (iDir + 2) % 3; @@ -334,7 +334,7 @@ void generateSurfaceMask(generateFromCatalog_info& args , // TEST - insert mock galaxies along spheres of survey redshift boundaries fp = fopen("mock_sphere.txt", "w"); - for (int p = 0; p < full_mask_list.size(); p++) { + for (int p = 0; p < full_mask_list.size(); p++) { vec3 v = mask.pix2vec(full_mask_list[p]); Position p; diff --git a/c_tools/mock/generateMock.cpp b/c_tools/mock/generateMock.cpp index 7dacef6..93e7e72 100644 --- a/c_tools/mock/generateMock.cpp +++ b/c_tools/mock/generateMock.cpp @@ -179,14 +179,18 @@ SimuData *doLoadMultidark(const char *multidarkname) outd->Pos[k] = new float[outd->NumPart]; outd->Vel[2] = new float[outd->NumPart]; outd->Id = new int[outd->NumPart]; + outd->uniqueID = new float[outd->NumPart]; cout << "loading multidark particles" << endl; actualNumPart = 0; for (int i = 0; i < outd->NumPart; i++) { - fscanf(fp, "%d %d %f %f %f\n", &outd->Id[i], + fscanf(fp, "%d %f %f %f %f\n", &outd->Id[i], &outd->Pos[0][i], &outd->Pos[1][i], &outd->Pos[2][i], &outd->Vel[2][i]); + outd->uniqueID[i] = 1.0; + //outd->uniqueID[i] = 1.0 * outd->Id[i]; + if (outd->Id[i] == -99 && outd->Pos[0][i] == -99 && outd->Pos[1][i] == -99 && outd->Pos[2][i] == -99 && outd->Vel[2][i] == -99) { @@ -368,7 +372,7 @@ void generateOutput(SimuData *data, int axis, f.beginCheckpoint(); for (uint32_t i = 0; i < data->NumPart; i++) { - f.writeReal32(data->Id[i]); + f.writeReal32(data->Pos[x0][i]); } f.endCheckpoint(); @@ -376,7 +380,7 @@ void generateOutput(SimuData *data, int axis, f.beginCheckpoint(); for (uint32_t i = 0; i < data->NumPart; i++) { - f.writeReal32(data->Id[i]); + f.writeReal32(data->Pos[x1][i]); } f.endCheckpoint(); @@ -384,7 +388,7 @@ void generateOutput(SimuData *data, int axis, f.beginCheckpoint(); for (uint32_t i = 0; i < data->NumPart; i++) { - f.writeReal32(data->Id[i]); + f.writeReal32(data->Pos[x2][i]); } f.endCheckpoint(); @@ -392,11 +396,11 @@ void generateOutput(SimuData *data, int axis, f.beginCheckpoint(); for (uint32_t i = 0; i < data->NumPart; i++) { - f.writeReal32(data->Id[i]); + //printf("HELLO %d %d\n", i, data->Id[i]); + //f.writeReal32(data->Id[i]); + f.writeReal32(data->uniqueID[i]); } f.endCheckpoint(); - - } void makeBox(SimuData *simu, double *efac, SimuData *&boxed, generateMock_info& args_info) @@ -456,6 +460,7 @@ void makeBox(SimuData *simu, double *efac, SimuData *&boxed, generateMock_info& boxed->Vel[j] = 0; mul[j] = 1.0/(ranges[j][1] - ranges[j][0]); } + boxed->uniqueID = new float[goodParticles]; cout << "Rescaling factors = " << mul[0] << " " << mul[1] << " " << mul[2] << endl; boxed->NumPart = goodParticles; @@ -476,6 +481,8 @@ void makeBox(SimuData *simu, double *efac, SimuData *&boxed, generateMock_info& assert(boxed->Pos[j][k] > 0); assert(boxed->Pos[j][k] < 1); } + boxed->uniqueID[k] = simu->uniqueID[i]; + particle_id[k] = i; expansion_fac[k] = efac[i]; k++; diff --git a/c_tools/stacking/pruneVoids.cpp b/c_tools/stacking/pruneVoids.cpp index 88d077f..0bc81ba 100644 --- a/c_tools/stacking/pruneVoids.cpp +++ b/c_tools/stacking/pruneVoids.cpp @@ -451,28 +451,29 @@ int main(int argc, char **argv) { //voids[iVoid].accepted = 0; } + if (voids[iVoid].centralDen > args_info.maxCentralDen_arg) { + voids[iVoid].accepted = -1; + } + // toss out voids that are obviously wrong if (voids[iVoid].densCon > 1.e3) { - voids[iVoid].accepted = 0; + voids[iVoid].accepted = -4; } if (strcmp(args_info.dataPortion_arg, "edge") == 0 && tolerance*voids[iVoid].maxRadius < voids[iVoid].nearestMock) { - voids[iVoid].accepted = 0; + voids[iVoid].accepted = -3; } if (strcmp(args_info.dataPortion_arg, "central") == 0 && tolerance*voids[iVoid].maxRadius > voids[iVoid].nearestMock) { - voids[iVoid].accepted = 0; + voids[iVoid].accepted = -3; } if (voids[iVoid].radius < args_info.rMin_arg) { - voids[iVoid].accepted = 0; + voids[iVoid].accepted = -2; } - if (voids[iVoid].centralDen > args_info.maxCentralDen_arg) { - voids[iVoid].accepted = -1; - } } numKept = 0; @@ -559,7 +560,7 @@ int main(int argc, char **argv) { fprintf(fpInfo, "# center x,y,z (km/s), volume (normalized), radius (Mpc/h), redshift, volume (Mpc/h^3), void ID\n"); for (iVoid = 0; iVoid < numVoids; iVoid++) { - if (voids[iVoid].accepted == 0) continue; + if (voids[iVoid].accepted < -1) continue; double outCenter[3]; outCenter[0] = voids[iVoid].barycenter[0]; diff --git a/external/cosmotool/src/loadSimu.hpp b/external/cosmotool/src/loadSimu.hpp index 35567f2..5d9f64d 100644 --- a/external/cosmotool/src/loadSimu.hpp +++ b/external/cosmotool/src/loadSimu.hpp @@ -27,7 +27,7 @@ namespace CosmoTool float *uniqueID; int *type; public: - SimuData() : Id(0),NumPart(0),type(0), uniqueID(0) { Pos[0]=Pos[1]=Pos[2]=0; Vel[0]=Vel[1]=Vel[2]=0; uniqueID=0} + SimuData() : Id(0),NumPart(0),type(0), uniqueID(0) { Pos[0]=Pos[1]=Pos[2]=0; Vel[0]=Vel[1]=Vel[2]=0; uniqueID=0;} ~SimuData() { for (int j = 0; j < 3; j++) diff --git a/pipeline/generateCatalog.py b/pipeline/generateCatalog.py index b60a6db..5abacb5 100755 --- a/pipeline/generateCatalog.py +++ b/pipeline/generateCatalog.py @@ -78,8 +78,8 @@ for sample in dataSampleList: fp.write("Additional subsampling fraction: %g\n" % sample.subsample) fp.write("Simulation box length (Mpc/h): %g\n" % sample.boxLen) fp.write("Simulation Omega_M: %g\n" % sample.omegaM) - fp.write("Number of simulation subvolumes: %g\n", sample.numSubvolumes) - fp.write("My subvolume index: %g\n", sample.mySubvolume) + fp.write("Number of simulation subvolumes: %s\n" % sample.numSubvolumes) + fp.write("My subvolume index: %s\n" % sample.mySubvolume) fp.close() # --------------------------------------------------------------------------- diff --git a/pipeline/prepareCatalogs.py b/pipeline/prepareCatalogs.py index 13a96e9..8d766b4 100755 --- a/pipeline/prepareCatalogs.py +++ b/pipeline/prepareCatalogs.py @@ -364,7 +364,7 @@ if args.halos or args.all: numPart += 1 inFile.close() - sampleName = "md.halos_z"+redshift + sampleName = "md.halos_min"+str(minHaloMass)+"_z"+redshift outFile = open(catalogDir+"/"+sampleName+".dat", 'w') outFile.write("%f\n" %(lbox)) @@ -385,6 +385,7 @@ if args.halos or args.all: # write to output file outFile.write("%d %e %e %e %e\n" %(iHalo,x,y,z,vz)) + outFile.write("-99 -99 -99 -99 -99\n") inFile.close() outFile.close() diff --git a/plotting/datasetsToPlot.py b/plotting/datasetsToPlot.py index 1217ed8..e4d6ac3 100755 --- a/plotting/datasetsToPlot.py +++ b/plotting/datasetsToPlot.py @@ -5,7 +5,7 @@ workDir = "/home/psutter2/workspace/Voids/" figDir = "./figs" sampleDirList = [ "multidark/md_ss0.1_pv/sample_md_ss0.1_pv_z0.56_d00/", - "multidark/md_ss01.0_pv/sample_md_ss1.0_pv_z0.56_d00/", + #"multidark/md_ss01.0_pv/sample_md_ss1.0_pv_z0.56_d00/", "multidark/md_halos_min1.23e13_pv/sample_md_halos_min1.23e13_pv_z0.56_d00/", "random/ran_ss0.0004/sample_ran_ss0.0004_z0.56_d00/", "random/ran_ss0.1/sample_ran_ss0.1_z0.56_d00/", diff --git a/python_tools/void_python_tools/backend/launchers.py b/python_tools/void_python_tools/backend/launchers.py index be2c12b..3965f96 100755 --- a/python_tools/void_python_tools/backend/launchers.py +++ b/python_tools/void_python_tools/backend/launchers.py @@ -55,7 +55,7 @@ def launchGenerate(sample, binPath, workDir=None, inputDataDir=None, sample.zBoundary[0], sample.zBoundary[1], sample.fakeDensity, useLCDMFlag) - parmFile = os.getcwd()+"/generate.par" + parmFile = os.getcwd()+"/generate_"+sample.fullName+".par" file(parmFile, mode="w").write(conf) @@ -143,7 +143,7 @@ def launchGenerate(sample, binPath, workDir=None, inputDataDir=None, sample.zBoundaryMpc[0], sample.zBoundaryMpc[1], sample.subsample) - parmFile = os.getcwd()+"/generate.par" + parmFile = os.getcwd()+"/generate_"+sample.fullName+".par" file(parmFile, mode="w").write(conf) @@ -405,7 +405,7 @@ def launchStack(sample, stack, binPath, thisDataPortion=None, logDir=None, zobovDir+"/boundaryDistances_"+thisDataPortion+"_"+sampleName+".out", rescaleFlag) - parmFile = os.getcwd()+"/stack.par" + parmFile = os.getcwd()+"/stack_"+sample.fullName+".par" fp = file(parmFile, mode="w") fp.write(conf)