changed voronoi plotting to take void index rather than ID

This commit is contained in:
Paul M. Sutter 2025-01-18 21:13:51 +10:00
parent ad2d3722cc
commit b79046ac22
2 changed files with 9 additions and 17 deletions

View file

@ -453,7 +453,7 @@ def loadVoidCatalog(sampleDir, dataPortion="central", loadParticles=True,
catalog.part[iEdge].edgeFlag = edgeFlags[iEdge]
else:
print(" Edge file not found!")
catalog.part[:].edgeFlag = 0
#catalog.part[:].edgeFlags = 0
print(" Loading volumes...")
if sample.hasWeightedVolumes:
@ -485,21 +485,12 @@ def loadVoidCatalog(sampleDir, dataPortion="central", loadParticles=True,
print(" Sanity checking adjacenies...")
nBad = 0
## TEST - writing bad galaxies to file
#badGalFile = open("badgal.txt", "w")
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 (flag: %d)" % (p, nHave, nExpected, catalog.part[p].edgeFlag))
#if (catalog.part[p].edgeFlag == 0):
# badGalFile.write("%e %e %e\n" % (catalog.part[p].x, catalog.part[p].y, catalog.part[p].z))
# nBad += 1
#print("NUMBER OF BAD GALAXIES: %d" % nBad)
#badGalFile.close()
if (nHave != nExpected and catalog.part[p].edgeFlag == 0):
print(" Error for particle %d: Have %d adj, expected %d (flag: %d)" % (p, nHave, nExpected, catalog.part[p].edgeFlag))
print(" Loading zone-void membership info...")
zoneFile = sampleDir+"/voidZone_"+sample.fullName+".dat"

View file

@ -305,7 +305,7 @@ def plotVoidCells(catalog,
# -----------------------------------------------------------------------------
def plotVoronoi(catalog,
voidID,
voidIndex=-1,
figDir="./",
plotName="voronoi",
plotCenter = (0,0,0),
@ -314,7 +314,7 @@ def plotVoronoi(catalog,
# plots the voronoi cells belonging to a void (or a slice if no void given)
# catalog: void catalog
# voidID: ID of void to plot (-1 to use all particles)
# voidIndec: index of void to plot (-1 to use all particles)
# figDir: output directory for figures
# plotName: name to prefix to all outputs
@ -327,7 +327,7 @@ def plotVoronoi(catalog,
print(" Selecting particles...")
if (voidID == -1):
if (voidIndex == -1):
xmin = plotCenter[0]-plotWidth[0]/2.
xmax = plotCenter[0]+plotWidth[0]/2.
ymin = plotCenter[1]-plotWidth[1]/2.
@ -348,9 +348,10 @@ def plotVoronoi(catalog,
#ax.set_ylim(ymin,ymax)
#ax_set.zlim(zmin,zmax)
else:
voidID = catalog.voids[voidIndex].voidID
partList = getVoidPart(catalog, voidID)
plotCenter = catalog.voids[voidID].macrocenter
plotRadius = catalog.voids[voidID].radius
plotCenter = catalog.voids[voidIndex].macrocenter
plotRadius = catalog.voids[voidIndex].radius
xmin = plotCenter[0]-plotRadius
xmax = plotCenter[0]+plotRadius