+ radial profiles now full actual density from survey volume, not zobov normalization

+ getVolNorm provides both zobov normalization and average density from survey volume for observations

+ significant update and cleanup to plotting routines
This commit is contained in:
Paul M. Sutter 2025-03-04 14:07:36 -05:00
parent b79046ac22
commit 326756b2bc
8 changed files with 73 additions and 61 deletions

View file

@ -57,8 +57,8 @@ def plotNumberFunction(catalogList,
# cumulative: if True, plots cumulative number function
# binWidth: width of histogram bins in Mpc/h
# returns:
# ellipDistList: array of len(catalogList),
# each element has array of size bins, number, +/- 1 sigma
# distList: array of len(catalogList),
# each element has array of size bins, number, +/- 1 sigma
print("Plotting number function")
@ -72,7 +72,7 @@ def plotNumberFunction(catalogList,
else:
plt.ylabel(r"log ($dn/dR$ [$h^3$ Gpc$^{-3}$])", fontsize=14)
ellipDistList = []
distList = []
for (iSample,catalog) in enumerate(catalogList):
sample = catalog.sampleInfo
@ -126,24 +126,25 @@ def plotNumberFunction(catalogList,
alpha = 0.55
fill_between(binCentersToUse, lower, upper,
label=lineTitle, color=lineColor,
label='', color=lineColor,
alpha=alpha,
)
lineStyle = '-'
plt.plot(binCentersToUse, mean, lineStyle,
color=lineColor,
label=lineTitle,
linewidth=3)
ellipDistList.append((binCentersToUse, mean, lower, upper))
distList.append((binCentersToUse, mean, lower, upper))
plt.legend(loc = "upper right", fancybox=True, prop={'size':14})
plt.savefig(figDir+"/fig_"+plotName+".pdf", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".eps", bbox_inches="tight")
#plt.savefig(figDir+"/fig_"+plotName+".eps", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".png", bbox_inches="tight")
return ellipDistList
return distList
# -----------------------------------------------------------------------------
@ -186,10 +187,10 @@ def plotEllipDist(catalogList,
plt.legend(loc = "upper right", fancybox=True, prop={'size':14})
plt.savefig(figDir+"/fig_"+plotName+".pdf", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".eps", bbox_inches="tight")
#plt.savefig(figDir+"/fig_"+plotName+".eps", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".png", bbox_inches="tight")
return
return ellipDistList
# -----------------------------------------------------------------------------
@ -297,7 +298,7 @@ def plotVoidCells(catalog,
plotName="cells"+str(voidID)
plt.savefig(figDir+"/fig_"+plotName+".pdf", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".eps", bbox_inches="tight")
#plt.savefig(figDir+"/fig_"+plotName+".eps", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".png", bbox_inches="tight")
return
@ -305,7 +306,7 @@ def plotVoidCells(catalog,
# -----------------------------------------------------------------------------
def plotVoronoi(catalog,
voidIndex=-1,
voidID=-1,
figDir="./",
plotName="voronoi",
plotCenter = (0,0,0),
@ -314,7 +315,7 @@ def plotVoronoi(catalog,
# plots the voronoi cells belonging to a void (or a slice if no void given)
# catalog: void catalog
# voidIndec: index of void to plot (-1 to use all particles)
# voidID: ID of void to plot (-1 to use all particles)
# figDir: output directory for figures
# plotName: name to prefix to all outputs
@ -327,7 +328,7 @@ def plotVoronoi(catalog,
print(" Selecting particles...")
if (voidIndex == -1):
if (voidID == -1):
xmin = plotCenter[0]-plotWidth[0]/2.
xmax = plotCenter[0]+plotWidth[0]/2.
ymin = plotCenter[1]-plotWidth[1]/2.
@ -348,7 +349,6 @@ 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[voidIndex].macrocenter
plotRadius = catalog.voids[voidIndex].radius
@ -381,7 +381,7 @@ def plotVoronoi(catalog,
print(" Saving...")
plt.savefig(figDir+"/fig_"+plotName+".pdf", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".eps", bbox_inches="tight")
#plt.savefig(figDir+"/fig_"+plotName+".eps", bbox_inches="tight")
plt.savefig(figDir+"/fig_"+plotName+".png", bbox_inches="tight")
print(" Done!")