mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 15:21:11 +00:00
Tesllation seems stable with new boundary handling procedure. Rooted out strange adjacency record-keeping due to some galaxies connecting to guard particles. Zobov still generates warning about guard particle encounters, but this is fine for observational datasets because we don't trust the tesselation at the edge galaxies anyway.
This commit is contained in:
parent
091cf5d1dc
commit
5d93a8a737
8 changed files with 63 additions and 12 deletions
|
@ -90,9 +90,10 @@ void readAdjacencyFile(const string& adjfile, PARTICLE*& p, pid_t& np)
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
p[i].adj[p[i].ncnt] = j;
|
p[i].adj[p[i].ncnt] = j;
|
||||||
p[j].adj[p[j].ncnt] = i;
|
|
||||||
p[i].ncnt++;
|
p[i].ncnt++;
|
||||||
p[j].ncnt++; }
|
p[j].adj[p[j].ncnt] = i;
|
||||||
|
p[j].ncnt++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -202,6 +202,44 @@ void placeGalaxiesInCube(NYU_VData& data, ParticleData& output_data,
|
||||||
% (1e-2*output_data.box[1][1]) % (1e-2*output_data.box[1][0])
|
% (1e-2*output_data.box[1][1]) % (1e-2*output_data.box[1][0])
|
||||||
% (1e-2*output_data.box[2][1]) % (1e-2*output_data.box[2][0]) << endl;
|
% (1e-2*output_data.box[2][1]) % (1e-2*output_data.box[2][0]) << endl;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
// TEST DEBUG
|
||||||
|
int nNewPerSide = 100;
|
||||||
|
Position p;
|
||||||
|
int idx = data.size() + 1;
|
||||||
|
float xwidth = output_data.box[0][0] - output_data.box[0][1];
|
||||||
|
float ywidth = output_data.box[1][0] - output_data.box[1][1];
|
||||||
|
float zwidth = output_data.box[2][0] - output_data.box[2][1];
|
||||||
|
|
||||||
|
float dx = xwidth / nNewPerSide;
|
||||||
|
float dy = ywidth / nNewPerSide;
|
||||||
|
float dz = zwidth / nNewPerSide;
|
||||||
|
|
||||||
|
for (int i = 0; i < nNewPerSide; i++) {
|
||||||
|
for (int j = 0; j < nNewPerSide; j++) {
|
||||||
|
for (int k = 0; k < nNewPerSide; k++) {
|
||||||
|
p.xyz[0] = output_data.box[0][1] + i*dx;
|
||||||
|
p.xyz[1] = output_data.box[1][1] + j*dy;
|
||||||
|
p.xyz[2] = output_data.box[2][1] + k*dz;
|
||||||
|
|
||||||
|
cout << "INSERT " << p.xyz[0] << ", " << p.xyz[1] << ", " << p.xyz[2] << endl;
|
||||||
|
cout << "COMPARING " << output_data.pos[i].xyz[0] << endl;
|
||||||
|
output_data.pos.push_back(p);
|
||||||
|
output_data.id_gal.push_back(idx);
|
||||||
|
output_data.ra.push_back(-1);
|
||||||
|
output_data.dec.push_back(-1);
|
||||||
|
output_data.redshift.push_back(-1);
|
||||||
|
output_data.uniqueID.push_back(-1);
|
||||||
|
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// END TEST DEBUG
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void flagEdgeGalaxies(prepObservation_info& args ,
|
void flagEdgeGalaxies(prepObservation_info& args ,
|
||||||
|
@ -230,8 +268,10 @@ void flagEdgeGalaxies(prepObservation_info& args ,
|
||||||
|
|
||||||
// write a small text file with galaxy position (for diagnostic purposes)
|
// write a small text file with galaxy position (for diagnostic purposes)
|
||||||
// TODO - remove this
|
// TODO - remove this
|
||||||
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
fp = fopen("galaxies.txt", "w");
|
fp = fopen("galaxies.txt", "w");
|
||||||
|
//for (int i = 0; i < output_data.id_gal.size(); i++) {
|
||||||
for (int i = 0; i < data.size(); i++) {
|
for (int i = 0; i < data.size(); i++) {
|
||||||
Position& p = output_data.pos[i];
|
Position& p = output_data.pos[i];
|
||||||
fprintf(fp, "%e %e %e\n",
|
fprintf(fp, "%e %e %e\n",
|
||||||
|
@ -326,7 +366,7 @@ void saveForZobov(ParticleData& pdata, const string& fname,
|
||||||
f.writeInt32(pdata.pos.size());
|
f.writeInt32(pdata.pos.size());
|
||||||
f.endCheckpoint();
|
f.endCheckpoint();
|
||||||
|
|
||||||
|
cout << format("Saving %d galaxies...") % pdata.pos.size() << endl;
|
||||||
for (int j = 0; j < 3; j++)
|
for (int j = 0; j < 3; j++)
|
||||||
{
|
{
|
||||||
cout << format("Writing %c components...") % axis[j] << endl;
|
cout << format("Writing %c components...") % axis[j] << endl;
|
||||||
|
|
|
@ -162,7 +162,7 @@ int main(int argc,char **argv) {
|
||||||
/*if (p[i].ncnt != p[i].nadj) {*/
|
/*if (p[i].ncnt != p[i].nadj) {*/
|
||||||
// END PMS
|
// END PMS
|
||||||
p[i].nadj = p[i].ncnt;
|
p[i].nadj = p[i].ncnt;
|
||||||
printf("We didn't get all of %d's adj's; %d != %d.\n",i,nin,p[i].nadj);
|
printf("jovoz: We didn't get all of %d's adj's; %d != %d.\n",i,nin,p[i].nadj);
|
||||||
/*exit(0);*/
|
/*exit(0);*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,7 +138,7 @@ int main(int argc, char *argv[]) {
|
||||||
if (isitinbuf) nvpbuf++;
|
if (isitinbuf) nvpbuf++;
|
||||||
if (isitinmain) nvp++;
|
if (isitinmain) nvp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
nvpbuf += 6*(NGUARD+1)*(NGUARD+1); /* number of guard
|
nvpbuf += 6*(NGUARD+1)*(NGUARD+1); /* number of guard
|
||||||
points */
|
points */
|
||||||
|
|
||||||
|
@ -305,8 +305,16 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
exitcode = vorvol(deladjs, points, intpoints, adjs[i].nadj, &(vols[i]));
|
exitcode = vorvol(deladjs, points, intpoints, adjs[i].nadj, &(vols[i]));
|
||||||
vols[i] *= (float)np;
|
vols[i] *= (float)np;
|
||||||
if (i % 1000 == 0)
|
//if (i % 1000 == 0)
|
||||||
printf("%d: %d, %f\n",i,adjs[i].nadj,vols[i]);
|
// printf("%d: %d, %f\n",i,adjs[i].nadj,vols[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// PMS - reset number of adjancies to not include links to border guards
|
||||||
|
for (i=0; i<nvp; i++) {
|
||||||
|
int nActual = 0;
|
||||||
|
for (j = 0; j < adjs[i].nadj; j++)
|
||||||
|
if (adjs[i].adj[j] < nvp) nActual++;
|
||||||
|
adjs[i].nadj = nActual;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the adjacencies back to their original values */
|
/* Get the adjacencies back to their original values */
|
||||||
|
@ -314,7 +322,7 @@ int main(int argc, char *argv[]) {
|
||||||
for (i=0; i<nvp; i++)
|
for (i=0; i<nvp; i++)
|
||||||
for (j = 0; j < adjs[i].nadj; j++)
|
for (j = 0; j < adjs[i].nadj; j++)
|
||||||
adjs[i].adj[j] = orig[adjs[i].adj[j]];
|
adjs[i].adj[j] = orig[adjs[i].adj[j]];
|
||||||
|
|
||||||
totalvol = 0.;
|
totalvol = 0.;
|
||||||
for (i=0;i<nvp; i++) {
|
for (i=0;i<nvp; i++) {
|
||||||
totalvol += (double)vols[i];
|
totalvol += (double)vols[i];
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from numpy import abs
|
from numpy import abs
|
||||||
import matplotlib as mpl
|
#import matplotlib as mpl
|
||||||
mpl.use('Agg')
|
#mpl.use('Agg')
|
||||||
|
|
||||||
LIGHT_SPEED = 299792.458
|
LIGHT_SPEED = 299792.458
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,7 @@ def launchPrep(sample, binPath, workDir=None, inputDataDir=None,
|
||||||
|
|
||||||
# flag edge galaxies with python routine for now
|
# flag edge galaxies with python routine for now
|
||||||
galFile = outputDir+"/zobov_slice_"+sampleName
|
galFile = outputDir+"/zobov_slice_"+sampleName
|
||||||
|
os.system("mv %s %s" % ("galaxies.txt", outputDir))
|
||||||
#galFile = outputDir + "galaxies.txt"
|
#galFile = outputDir + "galaxies.txt"
|
||||||
edgeGalFile = outputDir + "/galaxy_edge_flags.txt"
|
edgeGalFile = outputDir + "/galaxy_edge_flags.txt"
|
||||||
contourFile = outputDir + "/contour_map.fits"
|
contourFile = outputDir + "/contour_map.fits"
|
||||||
|
@ -481,7 +482,7 @@ def launchZobov(sample, binPath, outputDir=None, logDir=None, continueRun=None,
|
||||||
edgeFlags = np.loadtxt(edgeFile, dtype=np.int32)
|
edgeFlags = np.loadtxt(edgeFile, dtype=np.int32)
|
||||||
|
|
||||||
# set edge galaxy volumes to nearly 0 (implying very high density)
|
# set edge galaxy volumes to nearly 0 (implying very high density)
|
||||||
vols[ edgeFlags>0 ] = 1.e-4
|
vols[ edgeFlags>0 ] = 1.e-10
|
||||||
|
|
||||||
volFile = outputDir+"/vol_weighted_"+sampleName+".dat"
|
volFile = outputDir+"/vol_weighted_"+sampleName+".dat"
|
||||||
with open(volFile, mode='wb') as File:
|
with open(volFile, mode='wb') as File:
|
||||||
|
@ -493,7 +494,6 @@ def launchZobov(sample, binPath, outputDir=None, logDir=None, continueRun=None,
|
||||||
else:
|
else:
|
||||||
volFileToUse = outputDir+"/vol_"+sampleName+".dat"
|
volFileToUse = outputDir+"/vol_"+sampleName+".dat"
|
||||||
|
|
||||||
|
|
||||||
cmd = [binPath+"/jozov2", \
|
cmd = [binPath+"/jozov2", \
|
||||||
outputDir+"/adj_"+sampleName+".dat", \
|
outputDir+"/adj_"+sampleName+".dat", \
|
||||||
volFileToUse, \
|
volFileToUse, \
|
||||||
|
|
|
@ -146,6 +146,7 @@ def findEdgeGalaxies(galFile, maskFile, edgeGalFile, contourFile,
|
||||||
|
|
||||||
# load in galaxies
|
# load in galaxies
|
||||||
#galPos = np.genfromtxt(galFile)
|
#galPos = np.genfromtxt(galFile)
|
||||||
|
# TODO - WHY IS THIS FASTER THAN np.column_stack???
|
||||||
galPos = np.genfromtxt(outputDir+"/galaxies.txt")
|
galPos = np.genfromtxt(outputDir+"/galaxies.txt")
|
||||||
with open(galFile, 'rb') as File:
|
with open(galFile, 'rb') as File:
|
||||||
chk = np.fromfile(File, dtype=np.int32,count=1)
|
chk = np.fromfile(File, dtype=np.int32,count=1)
|
||||||
|
|
|
@ -484,6 +484,7 @@ def loadVoidCatalog(sampleDir, dataPortion="central", loadParticles=True,
|
||||||
catalog.part[p].adjs.append(pAdj)
|
catalog.part[p].adjs.append(pAdj)
|
||||||
catalog.part[pAdj].adjs.append(p)
|
catalog.part[pAdj].adjs.append(p)
|
||||||
|
|
||||||
|
|
||||||
print(" Sanity checking adjacenies...")
|
print(" Sanity checking adjacenies...")
|
||||||
for p in range(numPart):
|
for p in range(numPart):
|
||||||
catalog.part[p].nadjs = len(catalog.part[p].adjs)
|
catalog.part[p].nadjs = len(catalog.part[p].adjs)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue