mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 15:21:11 +00:00
Merge branch 'master' of bitbucket.org:cosmicvoids/void_identification
This commit is contained in:
commit
0879abed75
4 changed files with 70 additions and 47 deletions
|
@ -88,7 +88,7 @@ typedef struct catalog {
|
|||
|
||||
void loadCatalog(const char *partFile, const char *volFile,
|
||||
const char *voidFile, const char *zoneFile,
|
||||
const char *infoFile, const char *barycenterFile,
|
||||
const char *infoFile, const char *centerFile,
|
||||
const char *zonePartFile, CATALOG& catalog);
|
||||
|
||||
float getDist(CATALOG& catalog1, CATALOG& catalog2, int& iVoid1, int& iVoid2,
|
||||
|
@ -110,7 +110,7 @@ int main(int argc, char **argv) {
|
|||
float closestMatchDist;
|
||||
float commonVolRatio;
|
||||
MATCHPROPS newMatch;
|
||||
int MAX_MATCHES = 20;
|
||||
int MAX_MATCHES = 10;
|
||||
|
||||
CATALOG catalog1, catalog2;
|
||||
|
||||
|
@ -136,11 +136,11 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
|
||||
loadCatalog(args.partFile1_arg, args.volFile1_arg, args.voidFile1_arg,
|
||||
args.zoneFile1_arg, args.infoFile1_arg, args.barycenterFile1_arg,
|
||||
args.zoneFile1_arg, args.infoFile1_arg, args.centerFile1_arg,
|
||||
args.zonePartFile1_arg, catalog1);
|
||||
|
||||
loadCatalog(args.partFile2_arg, args.volFile2_arg, args.voidFile2_arg,
|
||||
args.zoneFile2_arg, args.infoFile2_arg, args.barycenterFile2_arg,
|
||||
args.zoneFile2_arg, args.infoFile2_arg, args.centerFile2_arg,
|
||||
args.zonePartFile2_arg, catalog2);
|
||||
|
||||
// check for periodic box
|
||||
|
@ -164,7 +164,6 @@ int main(int argc, char **argv) {
|
|||
rdist = getDist(catalog1, catalog2, iVoid1, iVoid2,
|
||||
periodicX, periodicY, periodicZ);
|
||||
|
||||
|
||||
newMatch.matchID = iVoid2;
|
||||
newMatch.commonVol = 0;
|
||||
newMatch.dist = rdist;
|
||||
|
@ -319,7 +318,7 @@ int main(int argc, char **argv) {
|
|||
//catalog1.voids[iVoid1].numPart;
|
||||
catalog1.voids[iVoid1].vol;
|
||||
|
||||
fprintf(fp, "%.3f ", catalog1.voids[iVoid1].matches[iMatch].dist);
|
||||
fprintf(fp, "%.3f %.2f ", catalog1.voids[iVoid1].matches[iMatch].dist, commonVolRatio);
|
||||
//fprintf(fp, "%.2f ", commonVolRatio);
|
||||
} else {
|
||||
fprintf(fp, "0.00 ");
|
||||
|
@ -339,7 +338,7 @@ int main(int argc, char **argv) {
|
|||
// ----------------------------------------------------------------------------
|
||||
void loadCatalog(const char *partFile, const char *volFile,
|
||||
const char *voidFile, const char *zoneFile,
|
||||
const char *infoFile, const char *barycenterFile,
|
||||
const char *infoFile, const char *centerFile,
|
||||
const char *zonePartFile, CATALOG& catalog) {
|
||||
|
||||
int i, p, numPartTot, numZonesTot, dummy, iVoid, iZ, numVolTot;
|
||||
|
@ -465,15 +464,22 @@ void loadCatalog(const char *partFile, const char *volFile,
|
|||
}
|
||||
fclose(fp);
|
||||
|
||||
catalog.numVoids = i - 1;
|
||||
catalog.voids.resize(catalog.numVoids);
|
||||
printf(" Read %d voids.\n", catalog.numVoids);
|
||||
|
||||
printf(" Loading barycenters\n");
|
||||
fp = fopen(barycenterFile, "r");
|
||||
fp = fopen(centerFile, "r");
|
||||
float tempBary[3];
|
||||
float tempFloat;
|
||||
int tempInt;
|
||||
iVoid = 0;
|
||||
while (fgets(line, sizeof(line), fp) != NULL) {
|
||||
sscanf(line, "%d %f %f %f\n", &voidID, &tempBary[0], &tempBary[1],
|
||||
&tempBary[2]);
|
||||
sscanf(line, "%f %f %f %f %f %f %f %d %f %d %d %d\n",
|
||||
&tempBary[0], &tempBary[1], &tempBary[2],
|
||||
&tempFloat, &tempFloat, &tempFloat, &tempFloat, &tempInt,
|
||||
&tempFloat, &tempInt, &tempInt);
|
||||
|
||||
tempBary[0] = (tempBary[0] - ranges[0][0])/catalog.boxLen[0];
|
||||
tempBary[1] = (tempBary[1] - ranges[1][0])/catalog.boxLen[1];
|
||||
tempBary[2] = (tempBary[2] - ranges[2][0])/catalog.boxLen[2];
|
||||
|
|
|
@ -10,7 +10,7 @@ option "voidFile1" - "Void info file for catalog 1" string yes
|
|||
option "infoFile1" - "Extra info file for catalog 1" string yes
|
||||
option "zoneFile1" - "Zone file for catalog 1" string yes
|
||||
option "zonePartFile1" - "Zone-particle file for catalog 1" string yes
|
||||
option "barycenterFile1" - "Barycenter file for catalog 1" string yes
|
||||
option "centerFile1" - "Barycenter file for catalog 1" string yes
|
||||
|
||||
# void data for file 2
|
||||
option "partFile2" - "Particle file for catalog 2" string yes
|
||||
|
@ -19,7 +19,7 @@ option "voidFile2" - "Void info file for catalog 2" string yes
|
|||
option "infoFile2" - "Extra info file for catalog 2" string yes
|
||||
option "zoneFile2" - "Zone file for catalog 2" string yes
|
||||
option "zonePartFile2" - "Zone-particle file for catalog 2" string yes
|
||||
option "barycenterFile2" - "Barycenter file for catalog 2" string yes
|
||||
option "centerFile2" - "Barycenter file for catalog 2" string yes
|
||||
|
||||
# options
|
||||
option "outfile" - "Output file" string yes
|
||||
|
|
|
@ -125,7 +125,7 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
|
||||
int i, p, p2, numPartTot, numZonesTot, dummy, iVoid, iZ;
|
||||
int numVoids, mockIndex, numKept;
|
||||
int numVoids, mockIndex;
|
||||
double tolerance;
|
||||
FILE *fp, *fpZobov, *fpCenters, *fpCentersNoCut, *fpBarycenter,
|
||||
*fpDistances, *fpShapes, *fpSkyPositions;
|
||||
|
@ -662,6 +662,21 @@ int main(int argc, char **argv) {
|
|||
voids[iVoid].isLeaf = true;
|
||||
}
|
||||
}
|
||||
|
||||
// TEST - grabbing only top-level voids
|
||||
numAreParents = 0;
|
||||
iGood = 0;
|
||||
for (iVoid = 0; iVoid < voids.size(); iVoid++) {
|
||||
if (voids[iVoid].parentID != -1) {
|
||||
numAreParents++;
|
||||
voids[iVoid].isLeaf = false;
|
||||
} else {
|
||||
//voids[iGood++] = voids[iVoid];
|
||||
voids[iVoid].isLeaf = true;
|
||||
}
|
||||
}
|
||||
// END TEST
|
||||
|
||||
//voids.resize(iGood);
|
||||
//printf(" 5th filter: rejected %d that are not leaf nodes\n", numAreParents);
|
||||
|
||||
|
@ -699,7 +714,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
name = "central";
|
||||
openFiles(outputDir, sampleName, name,
|
||||
mockIndex, numKept,
|
||||
mockIndex, voids.size(),
|
||||
&fpZobov, &fpCenters, &fpCentersNoCut, &fpBarycenter,
|
||||
&fpDistances, &fpShapes, &fpSkyPositions);
|
||||
|
||||
|
@ -716,7 +731,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
name = "all";
|
||||
openFiles(outputDir, sampleName, name,
|
||||
mockIndex, numKept,
|
||||
mockIndex, voids.size(),
|
||||
&fpZobov, &fpCenters, &fpCentersNoCut, &fpBarycenter,
|
||||
&fpDistances, &fpShapes, &fpSkyPositions);
|
||||
for (iVoid = 0; iVoid < voids.size(); iVoid++) {
|
||||
|
@ -796,6 +811,35 @@ void outputVoid(int iVoid, VOID outVoid, FILE* fpZobov, FILE* fpCenters,
|
|||
FILE* fpBarycenters, FILE* fpDistances, FILE* fpShapes,
|
||||
bool isObservation, double *boxLen) {
|
||||
|
||||
double outCenter[3];
|
||||
outCenter[0] = outVoid.barycenter[0];
|
||||
outCenter[1] = outVoid.barycenter[1];
|
||||
outCenter[2] = outVoid.barycenter[2];
|
||||
|
||||
if (isObservation) {
|
||||
outCenter[0] = (outVoid.barycenter[0]-boxLen[0]/2.)*100.;
|
||||
outCenter[1] = (outVoid.barycenter[1]-boxLen[1]/2.)*100.;
|
||||
outCenter[2] = (outVoid.barycenter[2]-boxLen[2]/2.)*100.;
|
||||
}
|
||||
|
||||
fprintf(fpCentersNoCut, "%.2f %.2f %.2f %.2f %.2f %.5f %.2f %d %f %d %d %d\n",
|
||||
outCenter[0],
|
||||
outCenter[1],
|
||||
outCenter[2],
|
||||
outVoid.vol,
|
||||
outVoid.radius,
|
||||
outVoid.redshift,
|
||||
4./3.*M_PI*pow(outVoid.radius, 3),
|
||||
outVoid.voidID,
|
||||
outVoid.densCon,
|
||||
outVoid.numPart,
|
||||
outVoid.parentID,
|
||||
outVoid.numChildren);
|
||||
|
||||
if (outVoid.hasHighCentralDen || !outVoid.isLeaf) {
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(fpZobov, "%d %d %d %f %f %d %d %f %d %f %f\n",
|
||||
iVoid,
|
||||
outVoid.voidID,
|
||||
|
@ -819,18 +863,6 @@ void outputVoid(int iVoid, VOID outVoid, FILE* fpZobov, FILE* fpCenters,
|
|||
outVoid.voidID,
|
||||
outVoid.nearestMock);
|
||||
|
||||
double outCenter[3];
|
||||
outCenter[0] = outVoid.barycenter[0];
|
||||
outCenter[1] = outVoid.barycenter[1];
|
||||
outCenter[2] = outVoid.barycenter[2];
|
||||
|
||||
if (isObservation) {
|
||||
outCenter[0] = (outVoid.barycenter[0]-boxLen[0]/2.)*100.;
|
||||
outCenter[1] = (outVoid.barycenter[1]-boxLen[1]/2.)*100.;
|
||||
outCenter[2] = (outVoid.barycenter[2]-boxLen[2]/2.)*100.;
|
||||
}
|
||||
|
||||
if (!outVoid.hasHighCentralDen && outVoid.isLeaf) {
|
||||
fprintf(fpCenters, "%.2f %.2f %.2f %.2f %.2f %.5f %.2f %d %f %d %d %d\n",
|
||||
outCenter[0],
|
||||
outCenter[1],
|
||||
|
@ -844,22 +876,7 @@ void outputVoid(int iVoid, VOID outVoid, FILE* fpZobov, FILE* fpCenters,
|
|||
outVoid.numPart,
|
||||
outVoid.parentID,
|
||||
outVoid.numChildren);
|
||||
}
|
||||
|
||||
fprintf(fpCentersNoCut, "%.2f %.2f %.2f %.2f %.2f %.5f %.2f %d %f %d %d %d\n",
|
||||
outCenter[0],
|
||||
outCenter[1],
|
||||
outCenter[2],
|
||||
outVoid.vol,
|
||||
outVoid.radius,
|
||||
outVoid.redshift,
|
||||
4./3.*M_PI*pow(outVoid.radius, 3),
|
||||
outVoid.voidID,
|
||||
outVoid.densCon,
|
||||
outVoid.numPart,
|
||||
outVoid.parentID,
|
||||
outVoid.numChildren);
|
||||
|
||||
|
||||
fprintf(fpSkyPositions, "%.2f %.2f %.5f %.2f %d\n",
|
||||
atan((outVoid.barycenter[1]-boxLen[1]/2.) /
|
||||
(outVoid.barycenter[0]-boxLen[0]/2.)) * 180/M_PI + 180,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue