From 35c7408ee584bf6ddc18fddbdc76d7932b2228d8 Mon Sep 17 00:00:00 2001 From: "P.M. Sutter" Date: Sat, 1 Mar 2014 17:59:08 -0600 Subject: [PATCH] futher improvements to AP handling --- c_tools/analysis/voidOverlap.cpp | 2 +- .../apTools/chi2/cosmologyTools.py | 25 ++++++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/c_tools/analysis/voidOverlap.cpp b/c_tools/analysis/voidOverlap.cpp index e164b22..209e728 100644 --- a/c_tools/analysis/voidOverlap.cpp +++ b/c_tools/analysis/voidOverlap.cpp @@ -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) { diff --git a/python_tools/void_python_tools/apTools/chi2/cosmologyTools.py b/python_tools/void_python_tools/apTools/chi2/cosmologyTools.py index b006d70..8337a9b 100644 --- a/python_tools/void_python_tools/apTools/chi2/cosmologyTools.py +++ b/python_tools/void_python_tools/apTools/chi2/cosmologyTools.py @@ -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 # -----------------------------------------------------------------------------