futher improvements to AP handling

This commit is contained in:
P.M. Sutter 2014-03-01 17:59:08 -06:00
parent 3f5a767b48
commit 35c7408ee5
2 changed files with 22 additions and 5 deletions

View file

@ -367,7 +367,7 @@ int main(int argc, char **argv) {
filename = string(args.outfile_arg);
filename = filename.append("summary.out");
fp = fopen(filename.c_str(), "w");
fprintf(fp, "# void ID, radius, radius ratio, common volume ratio (to original), common volume ratio (to match), relative dist, num matches, num significant matches, match ID, merit, ellipticity ratio, density contrast\n");
fprintf(fp, "# void ID, radius, radius ratio, common volume ratio (to original), common volume ratio (to match), relative dist, num matches, num significant matches, match ID, merit, ellipticity ratio, density contrast, cosTheta, major axis ratio, minor axis ratio, ellipticity\n");
for (iVoid1 = 0; iVoid1 < catalog1.numVoids; iVoid1++) {
int voidID = catalog1.voids[iVoid1].voidID;
if (catalog1.voids[iVoid1].numMatches > 0) {

View file

@ -114,7 +114,8 @@ def aveStretch(sample, zStart, zEnd,
# returns average expected void stretch for a given redshift range
# weighted by an actual void distribution
def aveWeightedStretch(zStart, zEnd, skyFrac = 0.19, Om = 0.27, Ot = 1.0,
w0 = -1.0, wa = 0.0, dist=None, bins=None):
w0 = -1.0, wa = 0.0, dist=None, bins=None,
useComoving=True, OmFid=None):
if zStart == 0.0: zStart = 1.e-6
def weightedSlice(x):
@ -126,10 +127,26 @@ def aveWeightedStretch(zStart, zEnd, skyFrac = 0.19, Om = 0.27, Ot = 1.0,
ave = integrate.quad(weightedFunc, zStart, zEnd, args=(Om, Ot, w0, wa),
full_output=1)[0]
volume = integrate.quad(weightedSlice, zStart, zEnd, full_output=1)[0]
return ave/volume
if volume == 0.0: volume = 1.0
stretch = ave/volume
# if in comoving space, calculate stretch for fiducial cosmology
# and take relative amount
if useComoving:
ave = integrate.quad(weightedFunc, zStart, zEnd, args=(OmFid,
Ot, w0, wa),
full_output=1)[0]
volume = integrate.quad(weightedSlice, zStart, zEnd, full_output=1)[0]
if volume == 0.0: volume = 1.0
stretchFid = ave/volume
if stretchFid != 0.0:
stretch = stretchFid/stretch
return stretch
# -----------------------------------------------------------------------------