From 3e75a1ee1350dd7a69970f8da38bda8b95c01682 Mon Sep 17 00:00:00 2001 From: "P.M. Sutter" Date: Tue, 27 May 2014 15:40:46 -0500 Subject: [PATCH 1/6] fix variable name --- python_tools/void_python_tools/voidUtil/plotUtil.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_tools/void_python_tools/voidUtil/plotUtil.py b/python_tools/void_python_tools/voidUtil/plotUtil.py index 4ccf599..8ac1dce 100644 --- a/python_tools/void_python_tools/voidUtil/plotUtil.py +++ b/python_tools/void_python_tools/voidUtil/plotUtil.py @@ -183,7 +183,7 @@ def plotEllipDist(catalogList, # ----------------------------------------------------------------------------- -def plotVoidCells(catalogList, +def plotVoidCells(catalog, voidID, figDir="./", plotName="cells", From 92764cd55ed2a7f42eed98328c6992583003638e Mon Sep 17 00:00:00 2001 From: Paul Sutter Date: Wed, 28 May 2014 03:50:42 +0000 Subject: [PATCH 2/6] README edited online with Bitbucket --- README | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README b/README index f194250..6a9d7d2 100644 --- a/README +++ b/README @@ -33,4 +33,9 @@ ccmake ./ make cd pipeline/ ./prepareInputs.py --scripts path/to/dataset.py -./generateCatalog.py path/to/parameter_file.py \ No newline at end of file +./generateCatalog.py path/to/parameter_file.py + +Version Summary +----------------- + +v1.0 - Initial Release \ No newline at end of file From a649b07b54275860d249ceff9701849829a1dc44 Mon Sep 17 00:00:00 2001 From: "P.M. Sutter" Date: Wed, 28 May 2014 11:54:27 -0500 Subject: [PATCH 3/6] bug fixes --- python_tools/void_python_tools/backend/launchers.py | 1 + python_tools/void_python_tools/voidUtil/plotUtil.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/python_tools/void_python_tools/backend/launchers.py b/python_tools/void_python_tools/backend/launchers.py index 8676989..d3ca1b1 100644 --- a/python_tools/void_python_tools/backend/launchers.py +++ b/python_tools/void_python_tools/backend/launchers.py @@ -265,6 +265,7 @@ def launchGenerate(sample, binPath, workDir=None, inputDataDir=None, zMax = sample.zBoundaryMpc[1] boxVol = (xMax-xMin)*(yMax-yMin)*(zMax-zMin) + nbar = 1.0 numTracers = int(open(zobovDir+"/mask_index.txt", "r").read()) numTotal = int(open(zobovDir+"/total_particles.txt", "r").read()) diff --git a/python_tools/void_python_tools/voidUtil/plotUtil.py b/python_tools/void_python_tools/voidUtil/plotUtil.py index 8ac1dce..d5ac3cd 100644 --- a/python_tools/void_python_tools/voidUtil/plotUtil.py +++ b/python_tools/void_python_tools/voidUtil/plotUtil.py @@ -25,7 +25,7 @@ import numpy as np import os import pylab as plt import void_python_tools.apTools as vp -from void_python_tools.voidUtil import getArray +from void_python_tools.voidUtil import getArray, shiftPart def fill_between(x, y1, y2=0, ax=None, **kwargs): """Plot filled region between `y1` and `y2`. From cea02c5e311f4c22dc7f6d2db1aeaeebbe4bf9d4 Mon Sep 17 00:00:00 2001 From: "P.M. Sutter" Date: Wed, 28 May 2014 12:46:41 -0500 Subject: [PATCH 4/6] incorporated volume-weighting in zobov --- .../void_python_tools/backend/launchers.py | 73 +++++++++++++++++-- 1 file changed, 66 insertions(+), 7 deletions(-) diff --git a/python_tools/void_python_tools/backend/launchers.py b/python_tools/void_python_tools/backend/launchers.py index d3ca1b1..e66d949 100644 --- a/python_tools/void_python_tools/backend/launchers.py +++ b/python_tools/void_python_tools/backend/launchers.py @@ -37,6 +37,7 @@ from netCDF4 import Dataset from void_python_tools.backend.classes import * import pickle import void_python_tools.apTools as vp +import scipy.interpolate NetCDFFile = Dataset ncFloat = 'f8' # Double precision @@ -344,17 +345,75 @@ def launchZobov(sample, binPath, zobovDir=None, logDir=None, continueRun=None, subprocess.call(cmd, stdout=log, stderr=log) log.close() - # TODO re-weight the volumes based on selection function - #volFile = zobovDir+"/vol_"+sampleName+".dat" - #File = file(volFile) - #chk = np.fromfile(File, dtype=np.int32,count=1) - #vols = np.fromfile(File, dtype=np.float32,count=numPartTot) + # re-weight the volumes based on selection function + if sample.dataType == "observation" and \ + sample.selFunFile != None: + + # load volumes + volFile = zobovDir+"/vol_"+sampleName+".dat" + File = file(volFile) + numPartTot = np.fromfile(File, dtype=np.int32,count=1) + vols = np.fromfile(File, dtype=np.float32,count=numPartTot) + File.close() + + # load redshifts + partFile = sampleDir+"/zobov_slice_"+sample.fullName + File = file(partFile) + chk = np.fromfile(File, dtype=np.int32,count=1) + Np = np.fromfile(File, dtype=np.int32,count=1) + chk = np.fromfile(File, dtype=np.int32,count=1) + + # x + chk = np.fromfile(File, dtype=np.int32,count=1) + redshifts = np.fromfile(File, dtype=np.float32,count=Np) + chk = np.fromfile(File, dtype=np.int32,count=1) + + # y + chk = np.fromfile(File, dtype=np.int32,count=1) + redshifts = np.fromfile(File, dtype=np.float32,count=Np) + chk = np.fromfile(File, dtype=np.int32,count=1) + + # z + chk = np.fromfile(File, dtype=np.int32,count=1) + redshifts = np.fromfile(File, dtype=np.float32,count=Np) + chk = np.fromfile(File, dtype=np.int32,count=1) + + # RA + chk = np.fromfile(File, dtype=np.int32,count=1) + redshifts = np.fromfile(File, dtype=np.float32,count=Np) + chk = np.fromfile(File, dtype=np.int32,count=1) + + # Dec + chk = np.fromfile(File, dtype=np.int32,count=1) + redshifts = np.fromfile(File, dtype=np.float32,count=Np) + chk = np.fromfile(File, dtype=np.int32,count=1) + + # z + chk = np.fromfile(File, dtype=np.int32,count=1) + redshifts = np.fromfile(File, dtype=np.float32,count=Np) + chk = np.fromfile(File, dtype=np.int32,count=1) + File.close() + + # build selection function interpolation + selfuncData = np.genfromtxt(sample.selFunFile) + selfunc = interpolate.interp1d(selfuncData[:,0], selfuncData[:,1], + kind='cubic') + # re-weight and write + vols *= selfunc(redshifts) + + volFile = zobovDir+"/vol_"+sampleName+".dat" + File = file(volFile, 'w') + chk.astype('np.int32').tofile(File) + vols.astype('np.float32').tofile(File) + + volFileToUse = zobovDir+"/vol_weighted"+sampleName+".dat" + else: + volFileToUse = zobovDir+"/vol_"+sampleName+".dat" cmd = [binPath+"../c_tools/zobov2/jozov2/jozov2", \ zobovDir+"/adj_"+sampleName+".dat", \ - zobovDir+"/vol_weighted_"+sampleName+".dat", \ - #zobovDir+"/vol_"+sampleName+".dat", \ + voleFileToUse, \ zobovDir+"/voidPart_"+sampleName+".dat", \ zobovDir+"/voidZone_"+sampleName+".dat", \ zobovDir+"/voidDesc_"+sampleName+".out", \ From 8b746392b46fa774acc0649eb558fe05c7a8c15b Mon Sep 17 00:00:00 2001 From: "P.M. Sutter" Date: Wed, 28 May 2014 15:41:29 -0500 Subject: [PATCH 5/6] fixed bug in getArray --- python_tools/void_python_tools/voidUtil/catalogUtil.py | 4 ++++ python_tools/void_python_tools/voidUtil/plotUtil.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/python_tools/void_python_tools/voidUtil/catalogUtil.py b/python_tools/void_python_tools/voidUtil/catalogUtil.py index 363293d..f5270fa 100644 --- a/python_tools/void_python_tools/voidUtil/catalogUtil.py +++ b/python_tools/void_python_tools/voidUtil/catalogUtil.py @@ -456,9 +456,13 @@ def getArray(objectList, attr): if hasattr(objectList[0], attr): ndim = np.shape( np.atleast_1d( getattr(objectList[0], attr) ) )[0] attrArr = np.zeros(( len(objectList), ndim )) + } for idim in xrange(ndim): attrArr[:,idim] = np.fromiter((np.atleast_1d(getattr(v, attr))[idim] \ for v in objectList), float ) + + if ndim == 1: attrArr = attArr[:,0] + return attrArr else: print " Attribute", attr, "not found!" diff --git a/python_tools/void_python_tools/voidUtil/plotUtil.py b/python_tools/void_python_tools/voidUtil/plotUtil.py index d5ac3cd..34752a8 100644 --- a/python_tools/void_python_tools/voidUtil/plotUtil.py +++ b/python_tools/void_python_tools/voidUtil/plotUtil.py @@ -25,7 +25,7 @@ import numpy as np import os import pylab as plt import void_python_tools.apTools as vp -from void_python_tools.voidUtil import getArray, shiftPart +from void_python_tools.voidUtil import getArray, shiftPart, getVoidPart def fill_between(x, y1, y2=0, ax=None, **kwargs): """Plot filled region between `y1` and `y2`. From 395f8fbb352b1103e6f99c67301335a00674b3f7 Mon Sep 17 00:00:00 2001 From: "P.M. Sutter" Date: Wed, 28 May 2014 15:51:19 -0500 Subject: [PATCH 6/6] bug fix in reweighting --- python_tools/void_python_tools/backend/launchers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_tools/void_python_tools/backend/launchers.py b/python_tools/void_python_tools/backend/launchers.py index e66d949..c20b076 100644 --- a/python_tools/void_python_tools/backend/launchers.py +++ b/python_tools/void_python_tools/backend/launchers.py @@ -413,7 +413,7 @@ def launchZobov(sample, binPath, zobovDir=None, logDir=None, continueRun=None, cmd = [binPath+"../c_tools/zobov2/jozov2/jozov2", \ zobovDir+"/adj_"+sampleName+".dat", \ - voleFileToUse, \ + volFileToUse, \ zobovDir+"/voidPart_"+sampleName+".dat", \ zobovDir+"/voidZone_"+sampleName+".dat", \ zobovDir+"/voidDesc_"+sampleName+".out", \