mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 15:21:11 +00:00
carried boundary flags all the way through to pruning; cleaned up pruning routines
This commit is contained in:
parent
dd181da42a
commit
a45eca0b6e
5 changed files with 124 additions and 139 deletions
|
@ -59,6 +59,7 @@ typedef struct partStruct {
|
||||||
float x, y, z, vol;
|
float x, y, z, vol;
|
||||||
int nadj, ncnt;
|
int nadj, ncnt;
|
||||||
int *adj;
|
int *adj;
|
||||||
|
int edgeFlag;
|
||||||
} PART;
|
} PART;
|
||||||
|
|
||||||
typedef struct zoneStruct {
|
typedef struct zoneStruct {
|
||||||
|
@ -390,7 +391,7 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// and finally volumes
|
// and volumes
|
||||||
printf(" Loading particle volumes...\n");
|
printf(" Loading particle volumes...\n");
|
||||||
fp = fopen(args.partVol_arg, "r");
|
fp = fopen(args.partVol_arg, "r");
|
||||||
fread(&mask_index, 1, 4, fp);
|
fread(&mask_index, 1, 4, fp);
|
||||||
|
@ -404,7 +405,16 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
/*
|
// and finally edge flag info
|
||||||
|
printf(" Loading particle edge flags...\n");
|
||||||
|
fp = fopen(args.partEdge_arg, "r");
|
||||||
|
for (p = 0; p < mask_index; p++) {
|
||||||
|
fscanf(fp, "%d", &part[p].edgeFlag);
|
||||||
|
//printf("EDGE VALUE %d\n", part[p].edgeFlag);
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
/* this was used for testing at one point
|
||||||
// and finally finally adjacencies
|
// and finally finally adjacencies
|
||||||
printf(" Loading particle adjacencies...\n");
|
printf(" Loading particle adjacencies...\n");
|
||||||
fp = fopen(args.partAdj_arg, "r");
|
fp = fopen(args.partAdj_arg, "r");
|
||||||
|
@ -458,61 +468,59 @@ int main(int argc, char **argv) {
|
||||||
interval = 1.*(clock4 - clock3)/CLOCKS_PER_SEC;
|
interval = 1.*(clock4 - clock3)/CLOCKS_PER_SEC;
|
||||||
printf(" Read voids (%.2f sec)...\n", interval);
|
printf(" Read voids (%.2f sec)...\n", interval);
|
||||||
|
|
||||||
// load voids *again* using Guilhem's code so we can get tree
|
// load voids *again* using Guilhem's code so we can get tree information
|
||||||
clock3 = clock();
|
clock3 = clock();
|
||||||
//if (!args.isObservation_flag) {
|
printf(" Re-loading voids and building tree..\n");
|
||||||
printf(" Re-loading voids and building tree..\n");
|
ZobovRep zobovCat;
|
||||||
ZobovRep zobovCat;
|
if (!loadZobov(args.voidDesc_arg, args.zone2Part_arg, args.void2Zone_arg,
|
||||||
if (!loadZobov(args.voidDesc_arg, args.zone2Part_arg,
|
0, zobovCat)) {
|
||||||
args.void2Zone_arg,
|
|
||||||
0, zobovCat)) {
|
|
||||||
printf("Error loading catalog!\n");
|
printf("Error loading catalog!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
VoidTree *tree;
|
VoidTree *tree;
|
||||||
tree = new VoidTree(zobovCat);
|
tree = new VoidTree(zobovCat);
|
||||||
zobovCat.allZones.erase(zobovCat.allZones.begin(), zobovCat.allZones.end());
|
zobovCat.allZones.erase(zobovCat.allZones.begin(), zobovCat.allZones.end());
|
||||||
|
|
||||||
// copy tree information to our own data structures
|
// copy tree information to our own data structures
|
||||||
for (iVoid = 0; iVoid < numVoids; iVoid++) {
|
for (iVoid = 0; iVoid < numVoids; iVoid++) {
|
||||||
voidID = voids[iVoid].voidID;
|
voidID = voids[iVoid].voidID;
|
||||||
voids[iVoid].parentID = tree->getParent(voidID);
|
voids[iVoid].parentID = tree->getParent(voidID);
|
||||||
voids[iVoid].numChildren = tree->getChildren(voidID).size();
|
voids[iVoid].numChildren = tree->getChildren(voidID).size();
|
||||||
|
|
||||||
// compute level in tree
|
// compute level in tree
|
||||||
int level = 0;
|
int level = 0;
|
||||||
int parentID = tree->getParent(voidID);
|
int parentID = tree->getParent(voidID);
|
||||||
while (parentID != -1) {
|
while (parentID != -1) {
|
||||||
level++;
|
level++;
|
||||||
parentID = tree->getParent(parentID);
|
parentID = tree->getParent(parentID);
|
||||||
}
|
|
||||||
voids[iVoid].level = level;
|
|
||||||
}
|
}
|
||||||
//} // end re-load
|
voids[iVoid].level = level;
|
||||||
|
}
|
||||||
clock4 = clock();
|
clock4 = clock();
|
||||||
interval = 1.*(clock4 - clock3)/CLOCKS_PER_SEC;
|
interval = 1.*(clock4 - clock3)/CLOCKS_PER_SEC;
|
||||||
printf(" Re-read voids (%.2f sec)...\n", interval);
|
printf(" Re-read voids (%.2f sec)...\n", interval);
|
||||||
|
|
||||||
// check boundaries
|
|
||||||
printf(" Computing void properties...\n");
|
printf(" Computing void properties...\n");
|
||||||
|
|
||||||
|
// allocate space for a particle buffer
|
||||||
maxNumPart = 0;
|
maxNumPart = 0;
|
||||||
for (iVoid = 0; iVoid < numVoids; iVoid++) {
|
for (iVoid = 0; iVoid < numVoids; iVoid++) {
|
||||||
if (voids[iVoid].numPart > maxNumPart) maxNumPart = voids[iVoid].numPart;
|
if (voids[iVoid].numPart > maxNumPart) maxNumPart = voids[iVoid].numPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
voidPart = (PART *) malloc(maxNumPart * sizeof(PART));
|
voidPart = (PART *) malloc(maxNumPart * sizeof(PART));
|
||||||
|
|
||||||
|
// main processing of each void
|
||||||
for (iVoid = 0; iVoid < numVoids; iVoid++) {
|
for (iVoid = 0; iVoid < numVoids; iVoid++) {
|
||||||
|
|
||||||
voidID = voids[iVoid].voidID;
|
voidID = voids[iVoid].voidID;
|
||||||
printf(" DOING %d (of %d) %d %d %f\n", iVoid+1, numVoids, voidID,
|
printf(" Working on void %d (of %d) %d %d %f\n",iVoid+1, numVoids, voidID,
|
||||||
voids[iVoid].numPart,
|
voids[iVoid].numPart,
|
||||||
voids[iVoid].radius);
|
voids[iVoid].radius);
|
||||||
|
|
||||||
voids[iVoid].center[0] = part[voids[iVoid].coreParticle].x;
|
voids[iVoid].center[0] = part[voids[iVoid].coreParticle].x;
|
||||||
voids[iVoid].center[1] = part[voids[iVoid].coreParticle].y;
|
voids[iVoid].center[1] = part[voids[iVoid].coreParticle].y;
|
||||||
voids[iVoid].center[2] = part[voids[iVoid].coreParticle].z;
|
voids[iVoid].center[2] = part[voids[iVoid].coreParticle].z;
|
||||||
|
|
||||||
|
voids[iVoid].voidType = CENTRAL_VOID;
|
||||||
|
|
||||||
// first load up particles into a buffer
|
// first load up particles into a buffer
|
||||||
clock3 = clock();
|
clock3 = clock();
|
||||||
|
@ -523,6 +531,7 @@ int main(int argc, char **argv) {
|
||||||
for (p = 0; p < zones2Parts[zoneID].numPart; p++) {
|
for (p = 0; p < zones2Parts[zoneID].numPart; p++) {
|
||||||
partID = zones2Parts[zoneID].partIDs[p];
|
partID = zones2Parts[zoneID].partIDs[p];
|
||||||
|
|
||||||
|
// something went haywire
|
||||||
if (partID > mask_index ||
|
if (partID > mask_index ||
|
||||||
(part[partID].vol < 1.e-27 && part[partID].vol > 0.)) {
|
(part[partID].vol < 1.e-27 && part[partID].vol > 0.)) {
|
||||||
printf("BAD PART!? %d %d %e", partID, mask_index, part[partID].vol);
|
printf("BAD PART!? %d %d %e", partID, mask_index, part[partID].vol);
|
||||||
|
@ -533,6 +542,12 @@ int main(int argc, char **argv) {
|
||||||
voidPart[i].y = part[partID].y;
|
voidPart[i].y = part[partID].y;
|
||||||
voidPart[i].z = part[partID].z;
|
voidPart[i].z = part[partID].z;
|
||||||
voidPart[i].vol = part[partID].vol;
|
voidPart[i].vol = part[partID].vol;
|
||||||
|
voidPart[i].edgeFlag = part[partID].edgeFlag;
|
||||||
|
|
||||||
|
// check for edge contamination
|
||||||
|
if (voidPart[i].edgeFlag > 0) {
|
||||||
|
voids[iVoid].voidType = EDGE_VOID;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// testing for edge contamination
|
// testing for edge contamination
|
||||||
|
@ -549,7 +564,7 @@ int main(int argc, char **argv) {
|
||||||
*/
|
*/
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
} // loading particles
|
||||||
|
|
||||||
clock4 = clock();
|
clock4 = clock();
|
||||||
interval = 1.*(clock4 - clock3)/CLOCKS_PER_SEC;
|
interval = 1.*(clock4 - clock3)/CLOCKS_PER_SEC;
|
||||||
|
@ -632,75 +647,30 @@ int main(int argc, char **argv) {
|
||||||
interval = 1.*(clock4 - clock3)/CLOCKS_PER_SEC;
|
interval = 1.*(clock4 - clock3)/CLOCKS_PER_SEC;
|
||||||
//printf(" %.2f for central density\n", interval);
|
//printf(" %.2f for central density\n", interval);
|
||||||
|
|
||||||
//coreParticle = voids[iVoid].coreParticle;
|
// compute maximum extent of void
|
||||||
//voids[iVoid].rescaledCoreDens = voids[iVoid].coreDens*(pow(1.*mockIndex/numPartTot,3));
|
clock3 = clock();
|
||||||
// // compute distance from core to nearest mock
|
maxDist = 0.;
|
||||||
// minDist = 1.e99;
|
for (p = 0; p < voids[iVoid].numPart; p++) {
|
||||||
// for (p = mockIndex; p < numPartTot; p++) {
|
dist[0] = fabs(voidPart[p].x - voids[iVoid].macrocenter[0]);
|
||||||
// dist[0] = part[coreParticle].x - part[p].x;
|
dist[1] = fabs(voidPart[p].y - voids[iVoid].macrocenter[1]);
|
||||||
// dist[1] = part[coreParticle].y - part[p].y;
|
dist[2] = fabs(voidPart[p].z - voids[iVoid].macrocenter[2]);
|
||||||
// dist[2] = part[coreParticle].z - part[p].z;
|
|
||||||
//
|
|
||||||
// dist2 = pow(dist[0],2) + pow(dist[1],2) + pow(dist[2],2);
|
|
||||||
// if (dist2 < minDist) minDist = dist2;
|
|
||||||
// }
|
|
||||||
// voids[iVoid].nearestMockFromCore = sqrt(minDist);
|
|
||||||
//
|
|
||||||
// // compute distance from core to nearest mock
|
|
||||||
// minDist = 1.e99;
|
|
||||||
// for (p = 0; p < mockIndex; p++) {
|
|
||||||
// dist[0] = part[coreParticle].x - part[p].x;
|
|
||||||
// dist[1] = part[coreParticle].y - part[p].y;
|
|
||||||
// dist[2] = part[coreParticle].z - part[p].z;
|
|
||||||
//
|
|
||||||
// dist2 = pow(dist[0],2) + pow(dist[1],2) + pow(dist[2],2);
|
|
||||||
// if (dist2 < minDist && dist2 > 1.e-10) minDist = dist2;
|
|
||||||
// }
|
|
||||||
// voids[iVoid].nearestGalFromCore = sqrt(minDist);
|
|
||||||
|
|
||||||
// compute maximum extent
|
if (periodicX) dist[0] = fmin(dist[0], boxLen[0]-dist[0]);
|
||||||
/*
|
if (periodicY) dist[1] = fmin(dist[1], boxLen[1]-dist[1]);
|
||||||
if (args.isObservation_flag) {
|
if (periodicZ) dist[2] = fmin(dist[2], boxLen[2]-dist[2]);
|
||||||
maxDist = 0.;
|
|
||||||
for (p = 0; p < voids[iVoid].numPart; p++) {
|
|
||||||
for (p2 = p; p2 < voids[iVoid].numPart; p2++) {
|
|
||||||
|
|
||||||
dist[0] = voidPart[p].x - voidPart[p2].x;
|
|
||||||
dist[1] = voidPart[p].y - voidPart[p2].y;
|
|
||||||
dist[2] = voidPart[p].z - voidPart[p2].z;
|
|
||||||
|
|
||||||
dist2 = pow(dist[0],2) + pow(dist[1],2) + pow(dist[2],2);
|
dist2 = pow(dist[0],2) + pow(dist[1],2) + pow(dist[2],2);
|
||||||
if (dist2 > maxDist) maxDist = dist2;
|
if (dist2 > maxDist) maxDist = dist2;
|
||||||
}
|
}
|
||||||
}
|
voids[iVoid].maxRadius = sqrt(maxDist);
|
||||||
voids[iVoid].maxRadius = sqrt(maxDist)/2.;
|
clock4 = clock();
|
||||||
} else {
|
interval = 1.*(clock4 - clock3)/CLOCKS_PER_SEC;
|
||||||
*/
|
//printf(" %.2f for maximum extent\n", interval);
|
||||||
|
|
||||||
clock3 = clock();
|
|
||||||
maxDist = 0.;
|
|
||||||
for (p = 0; p < voids[iVoid].numPart; p++) {
|
|
||||||
|
|
||||||
dist[0] = fabs(voidPart[p].x - voids[iVoid].macrocenter[0]);
|
|
||||||
dist[1] = fabs(voidPart[p].y - voids[iVoid].macrocenter[1]);
|
|
||||||
dist[2] = fabs(voidPart[p].z - voids[iVoid].macrocenter[2]);
|
|
||||||
|
|
||||||
if (periodicX) dist[0] = fmin(dist[0], boxLen[0]-dist[0]);
|
|
||||||
if (periodicY) dist[1] = fmin(dist[1], boxLen[1]-dist[1]);
|
|
||||||
if (periodicZ) dist[2] = fmin(dist[2], boxLen[2]-dist[2]);
|
|
||||||
|
|
||||||
dist2 = pow(dist[0],2) + pow(dist[1],2) + pow(dist[2],2);
|
|
||||||
if (dist2 > maxDist) maxDist = dist2;
|
|
||||||
}
|
|
||||||
voids[iVoid].maxRadius = sqrt(maxDist);
|
|
||||||
clock4 = clock();
|
|
||||||
interval = 1.*(clock4 - clock3)/CLOCKS_PER_SEC;
|
|
||||||
//printf(" %.2f for maximum extent\n", interval);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
// compute distance from center to nearest mock boundary particle
|
||||||
|
// (with new boundary handling this will go away)
|
||||||
clock3 = clock();
|
clock3 = clock();
|
||||||
if (args.isObservation_flag) {
|
if (args.isObservation_flag) {
|
||||||
// compute distance from center to nearest mock
|
|
||||||
minDist = 1.e99;
|
minDist = 1.e99;
|
||||||
for (p = mockIndex; p < numPartTot; p++) {
|
for (p = mockIndex; p < numPartTot; p++) {
|
||||||
dist[0] = voids[iVoid].macrocenter[0] - part[p].x;
|
dist[0] = voids[iVoid].macrocenter[0] - part[p].x;
|
||||||
|
@ -727,7 +697,6 @@ int main(int argc, char **argv) {
|
||||||
if (args.useComoving_flag) {
|
if (args.useComoving_flag) {
|
||||||
redshift = gsl_interp_eval(interp, dL, redshifts,
|
redshift = gsl_interp_eval(interp, dL, redshifts,
|
||||||
voids[iVoid].redshiftInMpc, acc);
|
voids[iVoid].redshiftInMpc, acc);
|
||||||
//printf("HELLO %e %e\n", redshift, args.zMax_arg);
|
|
||||||
nearestEdge = fabs((redshift-args.zMax_arg)*LIGHT_SPEED/100.);
|
nearestEdge = fabs((redshift-args.zMax_arg)*LIGHT_SPEED/100.);
|
||||||
voids[iVoid].redshift = redshift;
|
voids[iVoid].redshift = redshift;
|
||||||
} else {
|
} else {
|
||||||
|
@ -796,7 +765,7 @@ int main(int argc, char **argv) {
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
for (int j = i; j < 3; j++) {
|
for (int j = i; j < 3; j++) {
|
||||||
if (i == j) inertia[i*3+j] += dist[0]*dist[0] + dist[1]*dist[1] +
|
if (i == j) inertia[i*3+j] += dist[0]*dist[0] + dist[1]*dist[1] +
|
||||||
dist[2]*dist[2];
|
dist[2]*dist[2];
|
||||||
inertia[i*3+j] -= dist[i]*dist[j];
|
inertia[i*3+j] -= dist[i]*dist[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -828,24 +797,16 @@ int main(int argc, char **argv) {
|
||||||
if (gsl_vector_get(voids[iVoid].eval,i) > largest)
|
if (gsl_vector_get(voids[iVoid].eval,i) > largest)
|
||||||
largest = gsl_vector_get(voids[iVoid].eval,i);
|
largest = gsl_vector_get(voids[iVoid].eval,i);
|
||||||
}
|
}
|
||||||
// TEST
|
|
||||||
voids[iVoid].ellip = 1.0 - sqrt(sqrt(fabs(smallest/largest)));
|
voids[iVoid].ellip = 1.0 - sqrt(sqrt(fabs(smallest/largest)));
|
||||||
|
|
||||||
//if (a < c) ca = a/c;
|
|
||||||
//if (a >= c) ca = c/a;
|
|
||||||
//voids[iVoid].ellip = fabs(1.0 - ca);
|
|
||||||
|
|
||||||
//if (a < c) ca = a*a/(c*c);
|
|
||||||
//if (a >= c) ca = (c*c)/(a*a);
|
|
||||||
//voids[iVoid].ellip = sqrt(fabs(1.0 - ca));
|
|
||||||
|
|
||||||
clock4 = clock();
|
clock4 = clock();
|
||||||
interval = 1.*(clock4 - clock3)/CLOCKS_PER_SEC;
|
interval = 1.*(clock4 - clock3)/CLOCKS_PER_SEC;
|
||||||
//printf(" %.2f for ellipticity\n", interval);
|
|
||||||
} // iVoid
|
} // iVoid
|
||||||
|
|
||||||
gsl_eigen_symmv_free(eigw);
|
gsl_eigen_symmv_free(eigw);
|
||||||
|
|
||||||
|
|
||||||
|
// now filter and categorize the voids based on various criteria
|
||||||
int numWrong = 0;
|
int numWrong = 0;
|
||||||
int numHighDen = 0;
|
int numHighDen = 0;
|
||||||
int numCentral = 0;
|
int numCentral = 0;
|
||||||
|
@ -861,15 +822,6 @@ int main(int argc, char **argv) {
|
||||||
voids[iVoid].accepted = 1;
|
voids[iVoid].accepted = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
int j = 0;
|
|
||||||
for (iVoid = 0; iVoid < voids.size(); iVoid++) {
|
|
||||||
if (voids[iVoid].densCon < 1.5) {
|
|
||||||
// voids[iVoid].accepted = -4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// toss out voids that are obviously wrong
|
// toss out voids that are obviously wrong
|
||||||
int iGood = 0;
|
int iGood = 0;
|
||||||
for (iVoid = 0; iVoid < voids.size(); iVoid++) {
|
for (iVoid = 0; iVoid < voids.size(); iVoid++) {
|
||||||
|
@ -883,6 +835,7 @@ int main(int argc, char **argv) {
|
||||||
voids.resize(iGood);
|
voids.resize(iGood);
|
||||||
printf(" 1st filter: rejected %d obviously bad\n", numWrong);
|
printf(" 1st filter: rejected %d obviously bad\n", numWrong);
|
||||||
|
|
||||||
|
// toss out voids that are too small
|
||||||
iGood = 0;
|
iGood = 0;
|
||||||
for (iVoid = 0; iVoid < voids.size(); iVoid++) {
|
for (iVoid = 0; iVoid < voids.size(); iVoid++) {
|
||||||
if (voids[iVoid].radius < args.rMin_arg) {
|
if (voids[iVoid].radius < args.rMin_arg) {
|
||||||
|
@ -895,9 +848,9 @@ int main(int argc, char **argv) {
|
||||||
printf(" 2nd filter: rejected %d too small\n", numTooSmall);
|
printf(" 2nd filter: rejected %d too small\n", numTooSmall);
|
||||||
|
|
||||||
|
|
||||||
|
// toss out voids near non-periodic box edges
|
||||||
iGood = 0;
|
iGood = 0;
|
||||||
for (iVoid = 0; iVoid < voids.size(); iVoid++) {
|
for (iVoid = 0; iVoid < voids.size(); iVoid++) {
|
||||||
// *always* clean out near edges since there are no mocks there
|
|
||||||
if (tolerance*voids[iVoid].maxRadius > voids[iVoid].nearestEdge ||
|
if (tolerance*voids[iVoid].maxRadius > voids[iVoid].nearestEdge ||
|
||||||
tolerance*voids[iVoid].radius > voids[iVoid].nearestEdge) {
|
tolerance*voids[iVoid].radius > voids[iVoid].nearestEdge) {
|
||||||
numNearZ++;
|
numNearZ++;
|
||||||
|
@ -908,6 +861,7 @@ int main(int argc, char **argv) {
|
||||||
voids.resize(iGood);
|
voids.resize(iGood);
|
||||||
printf(" 3rd filter: rejected %d too close to high redshift boundaries\n", numNearZ);
|
printf(" 3rd filter: rejected %d too close to high redshift boundaries\n", numNearZ);
|
||||||
|
|
||||||
|
// toss out voids that are beyond redshift boundaries
|
||||||
numNearZ = 0;
|
numNearZ = 0;
|
||||||
iGood = 0;
|
iGood = 0;
|
||||||
for (iVoid = 0; iVoid < voids.size(); iVoid++) {
|
for (iVoid = 0; iVoid < voids.size(); iVoid++) {
|
||||||
|
@ -921,24 +875,18 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
voids.resize(iGood);
|
voids.resize(iGood);
|
||||||
|
|
||||||
//Maubert - Uncommented this part : to be sure that voids do not cross maximum redshift asked for in zrange
|
|
||||||
iGood = 0;
|
iGood = 0;
|
||||||
for (iVoid = 0; iVoid < voids.size(); iVoid++) {
|
for (iVoid = 0; iVoid < voids.size(); iVoid++) {
|
||||||
// just in case
|
if (args.isObservation_flag && voids[iVoid].redshift > args.zMax_arg) {
|
||||||
if (args.isObservation_flag &&
|
|
||||||
voids[iVoid].redshift > args.zMax_arg) {
|
|
||||||
numNearZ++;
|
numNearZ++;
|
||||||
} else {
|
} else {
|
||||||
voids[iGood++] = voids[iVoid];
|
voids[iGood++] = voids[iVoid];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
voids.resize(iGood);
|
voids.resize(iGood);
|
||||||
// Maubert - End of Uncommented part
|
|
||||||
|
|
||||||
|
|
||||||
printf(" 4th filter: rejected %d outside redshift boundaries\n", numNearZ);
|
printf(" 4th filter: rejected %d outside redshift boundaries\n", numNearZ);
|
||||||
|
|
||||||
// take only top-level voids
|
// find top-level voids
|
||||||
numAreParents = 0;
|
numAreParents = 0;
|
||||||
iGood = 0;
|
iGood = 0;
|
||||||
for (iVoid = 0; iVoid < voids.size(); iVoid++) {
|
for (iVoid = 0; iVoid < voids.size(); iVoid++) {
|
||||||
|
@ -950,7 +898,7 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// mark high-density voids
|
||||||
for (iVoid = 0; iVoid < voids.size(); iVoid++) {
|
for (iVoid = 0; iVoid < voids.size(); iVoid++) {
|
||||||
if (voids[iVoid].centralDen > args.maxCentralDen_arg) {
|
if (voids[iVoid].centralDen > args.maxCentralDen_arg) {
|
||||||
voids[iVoid].accepted = -1;
|
voids[iVoid].accepted = -1;
|
||||||
|
@ -961,6 +909,17 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// count voids near survey edges
|
||||||
|
for (iVoid = 0; iVoid < voids.size(); iVoid++) {
|
||||||
|
if (voids[iVoid].voidType == CENTRAL_VOID) {
|
||||||
|
numCentral++;
|
||||||
|
} else {
|
||||||
|
numEdge++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
// mark voids near survey edges
|
||||||
for (iVoid = 0; iVoid < voids.size(); iVoid++) {
|
for (iVoid = 0; iVoid < voids.size(); iVoid++) {
|
||||||
if (tolerance*voids[iVoid].maxRadius < voids[iVoid].nearestMock) {
|
if (tolerance*voids[iVoid].maxRadius < voids[iVoid].nearestMock) {
|
||||||
voids[iVoid].voidType = CENTRAL_VOID;
|
voids[iVoid].voidType = CENTRAL_VOID;
|
||||||
|
@ -970,6 +929,7 @@ int main(int argc, char **argv) {
|
||||||
numEdge++;
|
numEdge++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
printf(" Number kept: %d (out of %d)\n", (int) voids.size(), numVoids);
|
printf(" Number kept: %d (out of %d)\n", (int) voids.size(), numVoids);
|
||||||
printf(" We have %d edge voids\n", numEdge);
|
printf(" We have %d edge voids\n", numEdge);
|
||||||
|
@ -988,7 +948,6 @@ int main(int argc, char **argv) {
|
||||||
prefix = "";
|
prefix = "";
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
dataPortion = dataPortions[i];
|
dataPortion = dataPortions[i];
|
||||||
|
|
||||||
outputVoids(outputDir, sampleName, prefix, dataPortion,
|
outputVoids(outputDir, sampleName, prefix, dataPortion,
|
||||||
mockIndex,
|
mockIndex,
|
||||||
voids,
|
voids,
|
||||||
|
@ -999,7 +958,6 @@ int main(int argc, char **argv) {
|
||||||
prefix = "untrimmed_";
|
prefix = "untrimmed_";
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
dataPortion = dataPortions[i];
|
dataPortion = dataPortions[i];
|
||||||
|
|
||||||
outputVoids(outputDir, sampleName, prefix, dataPortion,
|
outputVoids(outputDir, sampleName, prefix, dataPortion,
|
||||||
mockIndex,
|
mockIndex,
|
||||||
voids,
|
voids,
|
||||||
|
@ -1010,7 +968,6 @@ int main(int argc, char **argv) {
|
||||||
prefix = "untrimmed_dencut_";
|
prefix = "untrimmed_dencut_";
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
dataPortion = dataPortions[i];
|
dataPortion = dataPortions[i];
|
||||||
|
|
||||||
outputVoids(outputDir, sampleName, prefix, dataPortion,
|
outputVoids(outputDir, sampleName, prefix, dataPortion,
|
||||||
mockIndex,
|
mockIndex,
|
||||||
voids,
|
voids,
|
||||||
|
@ -1020,7 +977,6 @@ int main(int argc, char **argv) {
|
||||||
prefix = "trimmed_nodencut_";
|
prefix = "trimmed_nodencut_";
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
dataPortion = dataPortions[i];
|
dataPortion = dataPortions[i];
|
||||||
|
|
||||||
outputVoids(outputDir, sampleName, prefix, dataPortion,
|
outputVoids(outputDir, sampleName, prefix, dataPortion,
|
||||||
mockIndex,
|
mockIndex,
|
||||||
voids,
|
voids,
|
||||||
|
@ -1207,7 +1163,7 @@ void outputVoids(string outputDir, string sampleName, string prefix,
|
||||||
|
|
||||||
} // end iVoid
|
} // end iVoid
|
||||||
|
|
||||||
closeFiles(fpZobov, fpCenters, fpBarycenter,
|
closeFiles(fpZobov, fpCenters, fpBarycenter,
|
||||||
fpDistances, fpShapes, fpSkyPositions);
|
fpDistances, fpShapes, fpSkyPositions);
|
||||||
|
|
||||||
} // end outputVoids
|
} // end outputVoids
|
||||||
|
|
|
@ -16,6 +16,8 @@ option "partVol" - "Particle volume file from ZOBOV" string required
|
||||||
|
|
||||||
option "partAdj" - "Adjacency file from ZOBOV" string required
|
option "partAdj" - "Adjacency file from ZOBOV" string required
|
||||||
|
|
||||||
|
option "partEdge" - "Boundary flag file" string required
|
||||||
|
|
||||||
option "zone2Part" - "Particle file from ZOBOV" string required
|
option "zone2Part" - "Particle file from ZOBOV" string required
|
||||||
option "mockIndex" - "Beginning index of mock particles" int required
|
option "mockIndex" - "Beginning index of mock particles" int required
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ continueRun = False
|
||||||
# 1 : extract redshift slices from data
|
# 1 : extract redshift slices from data
|
||||||
# 2 : void extraction using zobov
|
# 2 : void extraction using zobov
|
||||||
# 3 : removal of small voids and voids near the edge
|
# 3 : removal of small voids and voids near the edge
|
||||||
startCatalogStage = 1
|
startCatalogStage = 3
|
||||||
endCatalogStage = 3
|
endCatalogStage = 3
|
||||||
|
|
||||||
basePath = os.path.dirname(os.path.abspath(__file__))
|
basePath = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
|
@ -446,6 +446,31 @@ def launchZobov(sample, binPath, outputDir=None, logDir=None, continueRun=None,
|
||||||
else:
|
else:
|
||||||
volFileToUse = outputDir+"/vol_"+sampleName+".dat"
|
volFileToUse = outputDir+"/vol_"+sampleName+".dat"
|
||||||
|
|
||||||
|
# re-weight the volumes of any edge galaxies to prevent watershed
|
||||||
|
# from spilling outside of survey region
|
||||||
|
if sample.dataType == "observation":
|
||||||
|
|
||||||
|
# read in the appropriate volume file
|
||||||
|
with open(volFileToUse, mode="rb") as File:
|
||||||
|
numPartTot = np.fromfile(File, dtype=np.int32,count=1)[0]
|
||||||
|
vols = np.fromfile(File, dtype=np.float32, count=numPartTot)
|
||||||
|
|
||||||
|
# read in the edge flag information
|
||||||
|
edgeFile = outputDir+"/galaxy_edge_flags.txt"
|
||||||
|
edgeFlags = np.loadtxt(edgeFile, dtype=np.int32)
|
||||||
|
|
||||||
|
# set edge galaxy volumes to nearly 0 (implying very high density)
|
||||||
|
vols[ edgeFlags>0 ] = 1.e-4
|
||||||
|
|
||||||
|
volFile = outputDir+"/vol_weighted_"+sampleName+".dat"
|
||||||
|
with open(volFile, mode='wb') as File:
|
||||||
|
numPartTot.astype(np.int32).tofile(File)
|
||||||
|
vols.astype(np.float32).tofile(File)
|
||||||
|
|
||||||
|
volFileToUse = outputDir+"/vol_weighted_"+sampleName+".dat"
|
||||||
|
else:
|
||||||
|
volFileToUse = outputDir+"/vol_"+sampleName+".dat"
|
||||||
|
|
||||||
|
|
||||||
cmd = [binPath+"/jozov2", \
|
cmd = [binPath+"/jozov2", \
|
||||||
outputDir+"/adj_"+sampleName+".dat", \
|
outputDir+"/adj_"+sampleName+".dat", \
|
||||||
|
@ -525,6 +550,7 @@ def launchPrune(sample, binPath,
|
||||||
cmd += " --zone2Part=" + outputDir+"/voidPart_"+str(sampleName)+".dat"
|
cmd += " --zone2Part=" + outputDir+"/voidPart_"+str(sampleName)+".dat"
|
||||||
cmd += " --partVol=" + outputDir+"/vol_"+str(sampleName)+".dat"
|
cmd += " --partVol=" + outputDir+"/vol_"+str(sampleName)+".dat"
|
||||||
cmd += " --partAdj=" + outputDir+"/adj_"+str(sampleName)+".dat"
|
cmd += " --partAdj=" + outputDir+"/adj_"+str(sampleName)+".dat"
|
||||||
|
cmd += " --partEdge=" + outputDir+"galaxy_edge_flags.txt"
|
||||||
cmd += " --extraInfo=" + outputDir+"/zobov_slice_"+str(sampleName)+\
|
cmd += " --extraInfo=" + outputDir+"/zobov_slice_"+str(sampleName)+\
|
||||||
".par"
|
".par"
|
||||||
cmd += " --tolerance=" + str(boundaryTolerance)
|
cmd += " --tolerance=" + str(boundaryTolerance)
|
||||||
|
|
|
@ -161,18 +161,19 @@ def findEdgeGalaxies(galFile, maskFile, edgeGalFile, edgeMaskFile,
|
||||||
phi, theta = convertAngle(RA, Dec)
|
phi, theta = convertAngle(RA, Dec)
|
||||||
|
|
||||||
# check the mask edges
|
# check the mask edges
|
||||||
neighbors = healpy.get_all_neighbours(nside, theta, phi)
|
ipix = healpy.ang2pix(nside, theta, phi)
|
||||||
isOnMaskEdge = any(p == 0 for p in neighbors)
|
neighbors = healpy.get_all_neighbours(nside, ipix)
|
||||||
|
isOnMaskEdge = any(mask[p] == 0 for p in neighbors)
|
||||||
|
|
||||||
# check the redshift boundaries
|
# check the redshift boundaries
|
||||||
tol = 0.01 # TODO: made this user-adjustable
|
tol = 0.05 # TODO: made this user-adjustable
|
||||||
zbuffer = (zmax-zmin)*tol
|
zbuffer = (zmax-zmin)*tol
|
||||||
isOnHighZEdge = (z >= zmax-zbuffer)
|
isOnHighZEdge = (z >= zmax-zbuffer)
|
||||||
isOnLowZEdge = (z <= zmin+zbuffer)
|
isOnLowZEdge = (z <= zmin+zbuffer)
|
||||||
|
|
||||||
print("DOING %f %f %f %f\n" % (zbuffer, z, zmax, zmin) )
|
|
||||||
if isOnMaskEdge:
|
if isOnMaskEdge:
|
||||||
edgeFile.write("1\n")
|
edgeFile.write("1\n")
|
||||||
|
edgeMask[ipix] = 1
|
||||||
elif isOnHighZEdge:
|
elif isOnHighZEdge:
|
||||||
edgeFile.write("2\n")
|
edgeFile.write("2\n")
|
||||||
elif isOnLowZEdge:
|
elif isOnLowZEdge:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue