mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-05 07:41:11 +00:00
start of code to do 'merger-tree' of subsamples
This commit is contained in:
parent
a6278b9fc6
commit
9ec3b1f0ee
4 changed files with 166 additions and 6 deletions
|
@ -16,7 +16,8 @@ import argparse
|
|||
|
||||
plotNameBase = "compdist"
|
||||
|
||||
obsFudgeFactor = .66 # what fraction of the volume are we *reall* capturing?
|
||||
obsFudgeFactor = 1.0 # what fraction of the volume are we *reall* capturing?
|
||||
#obsFudgeFactor = .66 # what fraction of the volume are we *reall* capturing?
|
||||
|
||||
parser = argparse.ArgumentParser(description='Plot.')
|
||||
parser.add_argument('--show', dest='showPlot', action='store_const',
|
||||
|
@ -52,6 +53,7 @@ plt.yscale('log')
|
|||
plt.xlim(xmax=120.)
|
||||
|
||||
plotName = plotNameBase
|
||||
allData = []
|
||||
|
||||
for (iSample,sample) in enumerate(dataSampleList):
|
||||
|
||||
|
@ -62,7 +64,8 @@ for (iSample,sample) in enumerate(dataSampleList):
|
|||
boxVol = vp.getSurveyProps(sample.maskFile,
|
||||
sample.zBoundary[0], sample.zBoundary[1],
|
||||
sample.zRange[0], sample.zRange[1], "all",
|
||||
selectionFuncFile=sample.selFunFile)[0]
|
||||
selectionFuncFile=None)[0]
|
||||
#selectionFuncFile=sample.selFunFile)[0]
|
||||
boxVol *= obsFudgeFactor
|
||||
else:
|
||||
boxVol = sample.boxLen*sample.boxLen*(sample.zBoundaryMpc[1] -
|
||||
|
@ -88,6 +91,9 @@ for (iSample,sample) in enumerate(dataSampleList):
|
|||
label=lineTitle, color=colorList[iSample],
|
||||
linewidth=linewidth)
|
||||
|
||||
hist, bin_edges = np.histogram(data, bins=100, range=(0,100))
|
||||
allData.append(hist)
|
||||
|
||||
plt.legend(title = "Samples", loc = "upper right", prop={'size':8})
|
||||
#plt.title(plotTitle)
|
||||
|
||||
|
@ -95,6 +101,20 @@ plt.savefig(figDir+"/fig_"+plotName+".pdf", bbox_inches="tight")
|
|||
plt.savefig(figDir+"/fig_"+plotName+".eps", bbox_inches="tight")
|
||||
plt.savefig(figDir+"/fig_"+plotName+".png", bbox_inches="tight")
|
||||
|
||||
dataFile = figDir+"/data_"+plotName+".dat"
|
||||
fp = open(dataFile, 'w')
|
||||
fp.write("# R [Mpc/h], N [h^3 Gpc^-3]\n")
|
||||
fp.write("# ")
|
||||
for sample in dataSampleList:
|
||||
fp.write(sample.fullName+" ")
|
||||
fp.write("\n")
|
||||
for i in xrange(100):
|
||||
fp.write(str(bin_edges[i]) + " ")
|
||||
for iSample in xrange(len(dataSampleList)):
|
||||
fp.write(str(allData[iSample][i])+" ")
|
||||
fp.write("\n")
|
||||
fp.close()
|
||||
|
||||
if args.showPlot:
|
||||
os.system("display %s" % figDir+"/fig_"+plotName+".png")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue