mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-05 07:41:11 +00:00
removed mock particle tracking, since that is no longer used
This commit is contained in:
parent
fc2d7157f4
commit
d9efa15474
8 changed files with 71 additions and 173 deletions
|
@ -116,7 +116,7 @@ double expanFun (double z, void * p) {
|
|||
|
||||
void openFiles(string outputDir, string sampleName,
|
||||
string prefix, string dataPortion,
|
||||
int mockIndex, int numKept,
|
||||
int numPartTot, int numKept,
|
||||
FILE** fpZobov, FILE** fpCenters,
|
||||
FILE** fpCentersNoCut,
|
||||
FILE** fpBarycenter, FILE** fpShapes,
|
||||
|
@ -128,7 +128,7 @@ void closeFiles(FILE* fpZobov, FILE* fpCenters,
|
|||
FILE* fpSkyPositions);
|
||||
|
||||
void outputVoids(string outputDir, string sampleName, string prefix,
|
||||
string dataPortion, int mockIndex,
|
||||
string dataPortion, int numPartTot,
|
||||
vector<VOID> voids,
|
||||
bool isObservation, double *boxLen,
|
||||
bool doTrim, bool doCentralDenCut);
|
||||
|
@ -187,7 +187,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
|
||||
int i, p, p2, numPartTot, numZonesTot, dummy, iVoid;
|
||||
int numVoids, mockIndex;
|
||||
int numVoids;
|
||||
double tolerance;
|
||||
FILE *fp;
|
||||
PART *part, *voidPart, *flaggedPart;
|
||||
|
@ -202,7 +202,6 @@ int main(int argc, char **argv) {
|
|||
double nearestEdge, redshift;
|
||||
char line[500], junkStr[10];
|
||||
string outputDir, sampleName, dataPortion, prefix;
|
||||
int mask_index;
|
||||
double ranges[3][2], boxLen[3], mul;
|
||||
double volNorm, radius;
|
||||
int clock1, clock2, clock3, clock4;
|
||||
|
@ -213,7 +212,6 @@ int main(int argc, char **argv) {
|
|||
gsl_eigen_symmv_workspace *eigw = gsl_eigen_symmv_alloc(3);
|
||||
|
||||
numVoids = args.numVoids_arg;
|
||||
mockIndex = args.mockIndex_arg;
|
||||
tolerance = args.tolerance_arg;
|
||||
|
||||
clock1 = clock();
|
||||
|
@ -309,9 +307,6 @@ int main(int argc, char **argv) {
|
|||
interval = 1.*(clock4 - clock3)/CLOCKS_PER_SEC;
|
||||
printf(" Read %d particles (%.2f sec)...\n", numPartTot, interval);
|
||||
|
||||
|
||||
if (mockIndex == -1) mockIndex = numPartTot;
|
||||
|
||||
// read in desired voids
|
||||
clock3 = clock();
|
||||
printf(" Loading voids...\n");
|
||||
|
@ -393,12 +388,8 @@ int main(int argc, char **argv) {
|
|||
// and volumes
|
||||
printf(" Loading particle volumes...\n");
|
||||
fp = fopen(args.partVol_arg, "r");
|
||||
fread(&mask_index, 1, 4, fp);
|
||||
if (mask_index != mockIndex) {
|
||||
printf("NON-MATCHING MOCK INDICES!? %d %d\n", mask_index, mockIndex);
|
||||
exit(-1);
|
||||
}
|
||||
for (p = 0; p < mask_index; p++) {
|
||||
fread(&numPartTot, 1, 4, fp);
|
||||
for (p = 0; p < numPartTot; p++) {
|
||||
fread(&temp[0], 1, 4, fp);
|
||||
part[p].vol = temp[0];
|
||||
}
|
||||
|
@ -408,7 +399,7 @@ int main(int argc, char **argv) {
|
|||
printf(" Loading particle edge flags...\n");
|
||||
int numFlagged = 0;
|
||||
fp = fopen(args.partEdge_arg, "r");
|
||||
for (p = 0; p < mask_index; p++) {
|
||||
for (p = 0; p < numPartTot; p++) {
|
||||
fscanf(fp, "%d", &part[p].edgeFlag);
|
||||
if (part[p].edgeFlag > 0) numFlagged++;
|
||||
}
|
||||
|
@ -417,7 +408,7 @@ int main(int argc, char **argv) {
|
|||
// copy flagged galaxies to separate array for faster processing later
|
||||
flaggedPart = (PART *) malloc(numFlagged * sizeof(PART));
|
||||
int iFlag = 0;
|
||||
for (p = 0; p < mask_index; p++) {
|
||||
for (p = 0; p < numPartTot; p++) {
|
||||
if (part[p].edgeFlag > 0) {
|
||||
flaggedPart[iFlag] = part[p];
|
||||
iFlag++;
|
||||
|
@ -428,20 +419,20 @@ int main(int argc, char **argv) {
|
|||
// and finally finally adjacencies
|
||||
printf(" Loading particle adjacencies...\n");
|
||||
fp = fopen(args.partAdj_arg, "r");
|
||||
fread(&mask_index, 1, 4, fp);
|
||||
if (mask_index != mockIndex) {
|
||||
printf("NON-MATCHING MOCK INDICES!? %d %d\n", mask_index, mockIndex);
|
||||
fread(&numPartTot, 1, 4, fp);
|
||||
if (numPartTot != numPartTot) {
|
||||
printf("NON-MATCHING MOCK INDICES!? %d %d\n", numPartTot, numPartTot);
|
||||
exit(-1);
|
||||
}
|
||||
int tempInt;
|
||||
for (p = 0; p < mask_index; p++) {
|
||||
for (p = 0; p < numPartTot; p++) {
|
||||
fread(&tempInt, 1, 4, fp);
|
||||
part[p].nadj = tempInt;
|
||||
part[p].ncnt = 0;
|
||||
if (part[p].nadj > 0)
|
||||
part[p].adj = (int *) malloc(part[p].nadj * sizeof(int));
|
||||
}
|
||||
for (p = 0; p < mask_index; p++) {
|
||||
for (p = 0; p < numPartTot; p++) {
|
||||
fread(&tempInt, 1, 4, fp);
|
||||
int nin = tempInt;
|
||||
if (nin > 0) {
|
||||
|
@ -452,7 +443,7 @@ int main(int argc, char **argv) {
|
|||
// this bit has been readjusted just in case we are
|
||||
// accidentally still linking to mock particles
|
||||
|
||||
//if (tempAdj < mask_index) {
|
||||
//if (tempAdj < numPartTot) {
|
||||
assert(p < tempAdj);
|
||||
//if (part[p].ncnt == part[p].nadj) {
|
||||
// printf("OVERFLOW %d\n", p);
|
||||
|
@ -461,7 +452,7 @@ int main(int argc, char **argv) {
|
|||
//} else {
|
||||
part[p].adj[part[p].ncnt] = tempAdj;
|
||||
part[p].ncnt++;
|
||||
if (tempAdj < mask_index) {
|
||||
if (tempAdj < numPartTot) {
|
||||
part[tempAdj].adj[part[tempAdj].ncnt] = p;
|
||||
part[tempAdj].ncnt++;
|
||||
}
|
||||
|
@ -542,9 +533,8 @@ int main(int argc, char **argv) {
|
|||
partID = zones2Parts[zoneID].partIDs[p];
|
||||
|
||||
// something went haywire
|
||||
if (partID > mask_index ||
|
||||
(part[partID].vol < 1.e-27 && part[partID].vol > 0.)) {
|
||||
printf("BAD PART!? %d %d %e", partID, mask_index, part[partID].vol);
|
||||
if (part[partID].vol < 1.e-27 && part[partID].vol > 0.) {
|
||||
printf("BAD PART!? %d %d %e", partID, numPartTot, part[partID].vol);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
@ -567,7 +557,7 @@ int main(int argc, char **argv) {
|
|||
//printf("NORMAL!! %d %d %e\n", iVoid, partID, part[partID].vol);
|
||||
}
|
||||
for (int iAdj = 0; iAdj < part[partID].ncnt; iAdj++) {
|
||||
if (part[partID].adj[iAdj] > mockIndex) {
|
||||
if (part[partID].adj[iAdj] > numPartTot) {
|
||||
printf("CONTAMINATED!! %d %d %d\n", iVoid, partID, iAdj);
|
||||
}
|
||||
}
|
||||
|
@ -949,7 +939,7 @@ int main(int argc, char **argv) {
|
|||
for (int i = 0; i < 2; i++) {
|
||||
dataPortion = dataPortions[i];
|
||||
outputVoids(outputDir, sampleName, prefix, dataPortion,
|
||||
mockIndex,
|
||||
numPartTot,
|
||||
voids,
|
||||
args.isObservation_flag, boxLen, true, true);
|
||||
}
|
||||
|
@ -959,7 +949,7 @@ int main(int argc, char **argv) {
|
|||
for (int i = 0; i < 2; i++) {
|
||||
dataPortion = dataPortions[i];
|
||||
outputVoids(outputDir, sampleName, prefix, dataPortion,
|
||||
mockIndex,
|
||||
numPartTot,
|
||||
voids,
|
||||
args.isObservation_flag, boxLen, false, false);
|
||||
}
|
||||
|
@ -977,14 +967,14 @@ int main(int argc, char **argv) {
|
|||
// ----------------------------------------------------------------------------
|
||||
void openFiles(string outputDir, string sampleName,
|
||||
string prefix, string dataPortion,
|
||||
int mockIndex, int numKept,
|
||||
int numPartTot, int numKept,
|
||||
FILE** fpZobov, FILE** fpCenters,
|
||||
FILE** fpBarycenter, FILE** fpShapes,
|
||||
FILE** fpExtra,
|
||||
FILE** fpSkyPositions) {
|
||||
|
||||
*fpZobov = fopen((outputDir+"/"+prefix+"voidDesc_"+dataPortion+"_"+sampleName).c_str(), "w");
|
||||
fprintf(*fpZobov, "%d particles, %d voids.\n", mockIndex, numKept);
|
||||
fprintf(*fpZobov, "%d particles, %d voids.\n", numPartTot, numKept);
|
||||
fprintf(*fpZobov, "Void# FileVoid# CoreParticle CoreDens ZoneVol Zone#Part Void#Zones VoidVol Void#Part VoidDensContrast VoidProb\n");
|
||||
|
||||
*fpBarycenter = fopen((outputDir+"/"+prefix+"macrocenters_"+dataPortion+"_"+sampleName).c_str(), "w");
|
||||
|
@ -1022,7 +1012,7 @@ void closeFiles(FILE* fpZobov, FILE* fpCenters,
|
|||
|
||||
// ----------------------------------------------------------------------------
|
||||
void outputVoids(string outputDir, string sampleName, string prefix,
|
||||
string dataPortion, int mockIndex,
|
||||
string dataPortion, int numPartTot,
|
||||
vector<VOID> voids,
|
||||
bool isObservation, double *boxLen, bool doTrim,
|
||||
bool doCentralDenCut) {
|
||||
|
@ -1034,7 +1024,7 @@ void outputVoids(string outputDir, string sampleName, string prefix,
|
|||
|
||||
|
||||
openFiles(outputDir, sampleName, prefix, dataPortion,
|
||||
mockIndex, voids.size(),
|
||||
numPartTot, voids.size(),
|
||||
&fpZobov, &fpCenters, &fpBarycenter,
|
||||
&fpShapes, &fpExtra, &fpSkyPositions);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue