mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 15:21:11 +00:00
Merge branch 'master' of https://bitbucket.org/cosmicvoids/vide_public
This commit is contained in:
commit
7ad355a64c
4 changed files with 79 additions and 10 deletions
7
README
7
README
|
@ -33,4 +33,9 @@ ccmake ./
|
|||
make
|
||||
cd pipeline/
|
||||
./prepareInputs.py --scripts path/to/dataset.py
|
||||
./generateCatalog.py path/to/parameter_file.py
|
||||
./generateCatalog.py path/to/parameter_file.py
|
||||
|
||||
Version Summary
|
||||
-----------------
|
||||
|
||||
v1.0 - Initial Release
|
|
@ -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
|
||||
|
@ -265,6 +266,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())
|
||||
|
@ -343,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", \
|
||||
volFileToUse, \
|
||||
zobovDir+"/voidPart_"+sampleName+".dat", \
|
||||
zobovDir+"/voidZone_"+sampleName+".dat", \
|
||||
zobovDir+"/voidDesc_"+sampleName+".out", \
|
||||
|
|
|
@ -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!"
|
||||
|
|
|
@ -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, getVoidPart
|
||||
|
||||
def fill_between(x, y1, y2=0, ax=None, **kwargs):
|
||||
"""Plot filled region between `y1` and `y2`.
|
||||
|
@ -183,7 +183,7 @@ def plotEllipDist(catalogList,
|
|||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
def plotVoidCells(catalogList,
|
||||
def plotVoidCells(catalog,
|
||||
voidID,
|
||||
figDir="./",
|
||||
plotName="cells",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue