mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 23:31:12 +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,
|
void loadCatalog(const char *partFile, const char *volFile,
|
||||||
const char *voidFile, const char *zoneFile,
|
const char *voidFile, const char *zoneFile,
|
||||||
const char *infoFile, const char *barycenterFile,
|
const char *infoFile, const char *centerFile,
|
||||||
const char *zonePartFile, CATALOG& catalog);
|
const char *zonePartFile, CATALOG& catalog);
|
||||||
|
|
||||||
float getDist(CATALOG& catalog1, CATALOG& catalog2, int& iVoid1, int& iVoid2,
|
float getDist(CATALOG& catalog1, CATALOG& catalog2, int& iVoid1, int& iVoid2,
|
||||||
|
@ -110,7 +110,7 @@ int main(int argc, char **argv) {
|
||||||
float closestMatchDist;
|
float closestMatchDist;
|
||||||
float commonVolRatio;
|
float commonVolRatio;
|
||||||
MATCHPROPS newMatch;
|
MATCHPROPS newMatch;
|
||||||
int MAX_MATCHES = 20;
|
int MAX_MATCHES = 10;
|
||||||
|
|
||||||
CATALOG catalog1, catalog2;
|
CATALOG catalog1, catalog2;
|
||||||
|
|
||||||
|
@ -136,11 +136,11 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
loadCatalog(args.partFile1_arg, args.volFile1_arg, args.voidFile1_arg,
|
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);
|
args.zonePartFile1_arg, catalog1);
|
||||||
|
|
||||||
loadCatalog(args.partFile2_arg, args.volFile2_arg, args.voidFile2_arg,
|
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);
|
args.zonePartFile2_arg, catalog2);
|
||||||
|
|
||||||
// check for periodic box
|
// check for periodic box
|
||||||
|
@ -164,7 +164,6 @@ int main(int argc, char **argv) {
|
||||||
rdist = getDist(catalog1, catalog2, iVoid1, iVoid2,
|
rdist = getDist(catalog1, catalog2, iVoid1, iVoid2,
|
||||||
periodicX, periodicY, periodicZ);
|
periodicX, periodicY, periodicZ);
|
||||||
|
|
||||||
|
|
||||||
newMatch.matchID = iVoid2;
|
newMatch.matchID = iVoid2;
|
||||||
newMatch.commonVol = 0;
|
newMatch.commonVol = 0;
|
||||||
newMatch.dist = rdist;
|
newMatch.dist = rdist;
|
||||||
|
@ -319,7 +318,7 @@ int main(int argc, char **argv) {
|
||||||
//catalog1.voids[iVoid1].numPart;
|
//catalog1.voids[iVoid1].numPart;
|
||||||
catalog1.voids[iVoid1].vol;
|
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);
|
//fprintf(fp, "%.2f ", commonVolRatio);
|
||||||
} else {
|
} else {
|
||||||
fprintf(fp, "0.00 ");
|
fprintf(fp, "0.00 ");
|
||||||
|
@ -339,7 +338,7 @@ int main(int argc, char **argv) {
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void loadCatalog(const char *partFile, const char *volFile,
|
void loadCatalog(const char *partFile, const char *volFile,
|
||||||
const char *voidFile, const char *zoneFile,
|
const char *voidFile, const char *zoneFile,
|
||||||
const char *infoFile, const char *barycenterFile,
|
const char *infoFile, const char *centerFile,
|
||||||
const char *zonePartFile, CATALOG& catalog) {
|
const char *zonePartFile, CATALOG& catalog) {
|
||||||
|
|
||||||
int i, p, numPartTot, numZonesTot, dummy, iVoid, iZ, numVolTot;
|
int i, p, numPartTot, numZonesTot, dummy, iVoid, iZ, numVolTot;
|
||||||
|
@ -465,15 +464,22 @@ void loadCatalog(const char *partFile, const char *volFile,
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
|
catalog.numVoids = i - 1;
|
||||||
|
catalog.voids.resize(catalog.numVoids);
|
||||||
printf(" Read %d voids.\n", catalog.numVoids);
|
printf(" Read %d voids.\n", catalog.numVoids);
|
||||||
|
|
||||||
printf(" Loading barycenters\n");
|
printf(" Loading barycenters\n");
|
||||||
fp = fopen(barycenterFile, "r");
|
fp = fopen(centerFile, "r");
|
||||||
float tempBary[3];
|
float tempBary[3];
|
||||||
|
float tempFloat;
|
||||||
|
int tempInt;
|
||||||
iVoid = 0;
|
iVoid = 0;
|
||||||
while (fgets(line, sizeof(line), fp) != NULL) {
|
while (fgets(line, sizeof(line), fp) != NULL) {
|
||||||
sscanf(line, "%d %f %f %f\n", &voidID, &tempBary[0], &tempBary[1],
|
sscanf(line, "%f %f %f %f %f %f %f %d %f %d %d %d\n",
|
||||||
&tempBary[2]);
|
&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[0] = (tempBary[0] - ranges[0][0])/catalog.boxLen[0];
|
||||||
tempBary[1] = (tempBary[1] - ranges[1][0])/catalog.boxLen[1];
|
tempBary[1] = (tempBary[1] - ranges[1][0])/catalog.boxLen[1];
|
||||||
tempBary[2] = (tempBary[2] - ranges[2][0])/catalog.boxLen[2];
|
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 "infoFile1" - "Extra info file for catalog 1" string yes
|
||||||
option "zoneFile1" - "Zone 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 "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
|
# void data for file 2
|
||||||
option "partFile2" - "Particle file for catalog 2" string yes
|
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 "infoFile2" - "Extra info file for catalog 2" string yes
|
||||||
option "zoneFile2" - "Zone 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 "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
|
# options
|
||||||
option "outfile" - "Output file" string yes
|
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 i, p, p2, numPartTot, numZonesTot, dummy, iVoid, iZ;
|
||||||
int numVoids, mockIndex, numKept;
|
int numVoids, mockIndex;
|
||||||
double tolerance;
|
double tolerance;
|
||||||
FILE *fp, *fpZobov, *fpCenters, *fpCentersNoCut, *fpBarycenter,
|
FILE *fp, *fpZobov, *fpCenters, *fpCentersNoCut, *fpBarycenter,
|
||||||
*fpDistances, *fpShapes, *fpSkyPositions;
|
*fpDistances, *fpShapes, *fpSkyPositions;
|
||||||
|
@ -662,6 +662,21 @@ int main(int argc, char **argv) {
|
||||||
voids[iVoid].isLeaf = true;
|
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);
|
//voids.resize(iGood);
|
||||||
//printf(" 5th filter: rejected %d that are not leaf nodes\n", numAreParents);
|
//printf(" 5th filter: rejected %d that are not leaf nodes\n", numAreParents);
|
||||||
|
|
||||||
|
@ -699,7 +714,7 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
name = "central";
|
name = "central";
|
||||||
openFiles(outputDir, sampleName, name,
|
openFiles(outputDir, sampleName, name,
|
||||||
mockIndex, numKept,
|
mockIndex, voids.size(),
|
||||||
&fpZobov, &fpCenters, &fpCentersNoCut, &fpBarycenter,
|
&fpZobov, &fpCenters, &fpCentersNoCut, &fpBarycenter,
|
||||||
&fpDistances, &fpShapes, &fpSkyPositions);
|
&fpDistances, &fpShapes, &fpSkyPositions);
|
||||||
|
|
||||||
|
@ -716,7 +731,7 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
name = "all";
|
name = "all";
|
||||||
openFiles(outputDir, sampleName, name,
|
openFiles(outputDir, sampleName, name,
|
||||||
mockIndex, numKept,
|
mockIndex, voids.size(),
|
||||||
&fpZobov, &fpCenters, &fpCentersNoCut, &fpBarycenter,
|
&fpZobov, &fpCenters, &fpCentersNoCut, &fpBarycenter,
|
||||||
&fpDistances, &fpShapes, &fpSkyPositions);
|
&fpDistances, &fpShapes, &fpSkyPositions);
|
||||||
for (iVoid = 0; iVoid < voids.size(); iVoid++) {
|
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,
|
FILE* fpBarycenters, FILE* fpDistances, FILE* fpShapes,
|
||||||
bool isObservation, double *boxLen) {
|
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",
|
fprintf(fpZobov, "%d %d %d %f %f %d %d %f %d %f %f\n",
|
||||||
iVoid,
|
iVoid,
|
||||||
outVoid.voidID,
|
outVoid.voidID,
|
||||||
|
@ -819,18 +863,6 @@ void outputVoid(int iVoid, VOID outVoid, FILE* fpZobov, FILE* fpCenters,
|
||||||
outVoid.voidID,
|
outVoid.voidID,
|
||||||
outVoid.nearestMock);
|
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",
|
fprintf(fpCenters, "%.2f %.2f %.2f %.2f %.2f %.5f %.2f %d %f %d %d %d\n",
|
||||||
outCenter[0],
|
outCenter[0],
|
||||||
outCenter[1],
|
outCenter[1],
|
||||||
|
@ -844,22 +876,7 @@ void outputVoid(int iVoid, VOID outVoid, FILE* fpZobov, FILE* fpCenters,
|
||||||
outVoid.numPart,
|
outVoid.numPart,
|
||||||
outVoid.parentID,
|
outVoid.parentID,
|
||||||
outVoid.numChildren);
|
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",
|
fprintf(fpSkyPositions, "%.2f %.2f %.5f %.2f %d\n",
|
||||||
atan((outVoid.barycenter[1]-boxLen[1]/2.) /
|
atan((outVoid.barycenter[1]-boxLen[1]/2.) /
|
||||||
(outVoid.barycenter[0]-boxLen[0]/2.)) * 180/M_PI + 180,
|
(outVoid.barycenter[0]-boxLen[0]/2.)) * 180/M_PI + 180,
|
||||||
|
|
|
@ -394,8 +394,8 @@ def launchVoidOverlap(sample1, sample2, sample1Dir, sample2Dir,
|
||||||
thisDataPortion+"_"+str(sampleName1)+".out"
|
thisDataPortion+"_"+str(sampleName1)+".out"
|
||||||
cmd += " --infoFile1=" + sample1Dir+"/zobov_slice_" + \
|
cmd += " --infoFile1=" + sample1Dir+"/zobov_slice_" + \
|
||||||
str(sampleName1)+".par"
|
str(sampleName1)+".par"
|
||||||
cmd += " --barycenterFile1=" + sample1Dir + \
|
cmd += " --centerFile1=" + sample1Dir + \
|
||||||
"/barycenters_"+thisDataPortion+"_"+str(sampleName1)+".out"
|
"/centers_"+thisDataPortion+"_"+str(sampleName1)+".out"
|
||||||
cmd += " --zoneFile1=" + sample1Dir+"/voidZone_" + \
|
cmd += " --zoneFile1=" + sample1Dir+"/voidZone_" + \
|
||||||
str(sampleName1)+".dat"
|
str(sampleName1)+".dat"
|
||||||
cmd += " --zonePartFile1=" + sample1Dir+"/voidPart_" + \
|
cmd += " --zonePartFile1=" + sample1Dir+"/voidPart_" + \
|
||||||
|
@ -409,8 +409,8 @@ def launchVoidOverlap(sample1, sample2, sample1Dir, sample2Dir,
|
||||||
thisDataPortion+"_"+str(sampleName2)+".out"
|
thisDataPortion+"_"+str(sampleName2)+".out"
|
||||||
cmd += " --infoFile2=" + sample2Dir+"/zobov_slice_" + \
|
cmd += " --infoFile2=" + sample2Dir+"/zobov_slice_" + \
|
||||||
str(sampleName2)+".par"
|
str(sampleName2)+".par"
|
||||||
cmd += " --barycenterFile2=" + sample2Dir + \
|
cmd += " --centerFile2=" + sample2Dir + \
|
||||||
"/barycenters_"+thisDataPortion+"_"+str(sampleName2)+".out"
|
"/centers_"+thisDataPortion+"_"+str(sampleName2)+".out"
|
||||||
cmd += " --zoneFile2=" + sample2Dir+"/voidZone_" + \
|
cmd += " --zoneFile2=" + sample2Dir+"/voidZone_" + \
|
||||||
str(sampleName2)+".dat"
|
str(sampleName2)+".dat"
|
||||||
cmd += " --zonePartFile2=" + sample2Dir+"/voidPart_" + \
|
cmd += " --zonePartFile2=" + sample2Dir+"/voidPart_" + \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue