mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-05 07:41:11 +00:00
fixed bug in adjacency reading
This commit is contained in:
parent
ad752f21e8
commit
7f3afca2d7
2 changed files with 27 additions and 4 deletions
|
@ -179,6 +179,7 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
|
/*
|
||||||
// PMS : remove mock galaxies and anything adjacent to a mock galaxy
|
// PMS : remove mock galaxies and anything adjacent to a mock galaxy
|
||||||
printf("\nRemoving mock galaxies...\n");
|
printf("\nRemoving mock galaxies...\n");
|
||||||
|
|
||||||
|
@ -221,6 +222,7 @@ int main(int argc, char *argv[]) {
|
||||||
printf("There are %d galaxies remaining.\n", mockIndex-numRemoved);
|
printf("There are %d galaxies remaining.\n", mockIndex-numRemoved);
|
||||||
|
|
||||||
// END PMS
|
// END PMS
|
||||||
|
*/
|
||||||
|
|
||||||
npnotdone = 0; avgnadj = 0.; avgvol = 0.;
|
npnotdone = 0; avgnadj = 0.; avgvol = 0.;
|
||||||
for (p=0;p<np;p++) {
|
for (p=0;p<np;p++) {
|
||||||
|
|
|
@ -435,7 +435,8 @@ def loadVoidCatalog(sampleDir, dataPortion="central", loadParticles=True,
|
||||||
y = partData[i][1],
|
y = partData[i][1],
|
||||||
z = partData[i][2],
|
z = partData[i][2],
|
||||||
volume = 0,
|
volume = 0,
|
||||||
adjs = 0,
|
nadjs = 0,
|
||||||
|
adjs = [],
|
||||||
ra = extraData[i][0],
|
ra = extraData[i][0],
|
||||||
dec = extraData[i][1],
|
dec = extraData[i][1],
|
||||||
redshift = extraData[i][2],
|
redshift = extraData[i][2],
|
||||||
|
@ -467,10 +468,29 @@ def loadVoidCatalog(sampleDir, dataPortion="central", loadParticles=True,
|
||||||
print(" Loading adjacencies...")
|
print(" Loading adjacencies...")
|
||||||
adjFile = sampleDir+"adj_"+sample.fullName+".dat"
|
adjFile = sampleDir+"adj_"+sample.fullName+".dat"
|
||||||
with open(adjFile, mode="rb") as File:
|
with open(adjFile, mode="rb") as File:
|
||||||
numPart = np.fromfile(adjFile, dtype=np.int32,count=1)[0]
|
numPart = np.fromfile(File, dtype=np.int32,count=1)[0]
|
||||||
|
|
||||||
|
# this the total number of adjancies per particle
|
||||||
|
nadjPerPart = np.fromfile(File, dtype=np.int32,count=numPart)
|
||||||
|
|
||||||
|
# but the file only stores one half of each pair, so we need to match
|
||||||
for p in range(numPart):
|
for p in range(numPart):
|
||||||
numAdjs = np.fromfile(File, dtype=np.int32,count=1)[0]
|
nin = np.fromfile(File, dtype=np.int32, count=1)[0]
|
||||||
catalog.part[p].adjs = np.fromfile(File, dtype=np.int32, count=numAdjs)
|
|
||||||
|
for n in range(nin):
|
||||||
|
pAdj = np.fromfile(File, dtype=np.int32, count=1)[0]
|
||||||
|
|
||||||
|
if (p < pAdj):
|
||||||
|
catalog.part[p].adjs.append(pAdj)
|
||||||
|
catalog.part[pAdj].adjs.append(p)
|
||||||
|
|
||||||
|
print(" Sanity checking adjacenies...")
|
||||||
|
for p in range(numPart):
|
||||||
|
catalog.part[p].nadjs = len(catalog.part[p].adjs)
|
||||||
|
nHave = len(catalog.part[p].adjs)
|
||||||
|
nExpected = nadjPerPart[p]
|
||||||
|
if (nHave != nExpected):
|
||||||
|
print(" Error for particle %d: Have %d adj, expected %d" % (p, nHave, nExpected))
|
||||||
|
|
||||||
print(" Loading zone-void membership info...")
|
print(" Loading zone-void membership info...")
|
||||||
zoneFile = sampleDir+"/voidZone_"+sample.fullName+".dat"
|
zoneFile = sampleDir+"/voidZone_"+sample.fullName+".dat"
|
||||||
|
@ -502,6 +522,7 @@ def loadVoidCatalog(sampleDir, dataPortion="central", loadParticles=True,
|
||||||
partID = np.fromfile(File, dtype=np.int32,count=1)[0]
|
partID = np.fromfile(File, dtype=np.int32,count=1)[0]
|
||||||
catalog.zones2Parts[iZ].partIDs.append(partID)
|
catalog.zones2Parts[iZ].partIDs.append(partID)
|
||||||
|
|
||||||
|
print("Done loading catalog.")
|
||||||
return catalog
|
return catalog
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue