mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-06 00:01: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
5
README
5
README
|
@ -34,3 +34,8 @@ make
|
||||||
cd pipeline/
|
cd pipeline/
|
||||||
./prepareInputs.py --scripts path/to/dataset.py
|
./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 *
|
from void_python_tools.backend.classes import *
|
||||||
import pickle
|
import pickle
|
||||||
import void_python_tools.apTools as vp
|
import void_python_tools.apTools as vp
|
||||||
|
import scipy.interpolate
|
||||||
|
|
||||||
NetCDFFile = Dataset
|
NetCDFFile = Dataset
|
||||||
ncFloat = 'f8' # Double precision
|
ncFloat = 'f8' # Double precision
|
||||||
|
@ -265,6 +266,7 @@ def launchGenerate(sample, binPath, workDir=None, inputDataDir=None,
|
||||||
zMax = sample.zBoundaryMpc[1]
|
zMax = sample.zBoundaryMpc[1]
|
||||||
|
|
||||||
boxVol = (xMax-xMin)*(yMax-yMin)*(zMax-zMin)
|
boxVol = (xMax-xMin)*(yMax-yMin)*(zMax-zMin)
|
||||||
|
nbar = 1.0
|
||||||
|
|
||||||
numTracers = int(open(zobovDir+"/mask_index.txt", "r").read())
|
numTracers = int(open(zobovDir+"/mask_index.txt", "r").read())
|
||||||
numTotal = int(open(zobovDir+"/total_particles.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)
|
subprocess.call(cmd, stdout=log, stderr=log)
|
||||||
log.close()
|
log.close()
|
||||||
|
|
||||||
# TODO re-weight the volumes based on selection function
|
# re-weight the volumes based on selection function
|
||||||
#volFile = zobovDir+"/vol_"+sampleName+".dat"
|
if sample.dataType == "observation" and \
|
||||||
#File = file(volFile)
|
sample.selFunFile != None:
|
||||||
#chk = np.fromfile(File, dtype=np.int32,count=1)
|
|
||||||
#vols = np.fromfile(File, dtype=np.float32,count=numPartTot)
|
# 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", \
|
cmd = [binPath+"../c_tools/zobov2/jozov2/jozov2", \
|
||||||
zobovDir+"/adj_"+sampleName+".dat", \
|
zobovDir+"/adj_"+sampleName+".dat", \
|
||||||
zobovDir+"/vol_weighted_"+sampleName+".dat", \
|
volFileToUse, \
|
||||||
#zobovDir+"/vol_"+sampleName+".dat", \
|
|
||||||
zobovDir+"/voidPart_"+sampleName+".dat", \
|
zobovDir+"/voidPart_"+sampleName+".dat", \
|
||||||
zobovDir+"/voidZone_"+sampleName+".dat", \
|
zobovDir+"/voidZone_"+sampleName+".dat", \
|
||||||
zobovDir+"/voidDesc_"+sampleName+".out", \
|
zobovDir+"/voidDesc_"+sampleName+".out", \
|
||||||
|
|
|
@ -456,9 +456,13 @@ def getArray(objectList, attr):
|
||||||
if hasattr(objectList[0], attr):
|
if hasattr(objectList[0], attr):
|
||||||
ndim = np.shape( np.atleast_1d( getattr(objectList[0], attr) ) )[0]
|
ndim = np.shape( np.atleast_1d( getattr(objectList[0], attr) ) )[0]
|
||||||
attrArr = np.zeros(( len(objectList), ndim ))
|
attrArr = np.zeros(( len(objectList), ndim ))
|
||||||
|
}
|
||||||
for idim in xrange(ndim):
|
for idim in xrange(ndim):
|
||||||
attrArr[:,idim] = np.fromiter((np.atleast_1d(getattr(v, attr))[idim] \
|
attrArr[:,idim] = np.fromiter((np.atleast_1d(getattr(v, attr))[idim] \
|
||||||
for v in objectList), float )
|
for v in objectList), float )
|
||||||
|
|
||||||
|
if ndim == 1: attrArr = attArr[:,0]
|
||||||
|
|
||||||
return attrArr
|
return attrArr
|
||||||
else:
|
else:
|
||||||
print " Attribute", attr, "not found!"
|
print " Attribute", attr, "not found!"
|
||||||
|
|
|
@ -25,7 +25,7 @@ import numpy as np
|
||||||
import os
|
import os
|
||||||
import pylab as plt
|
import pylab as plt
|
||||||
import void_python_tools.apTools as vp
|
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):
|
def fill_between(x, y1, y2=0, ax=None, **kwargs):
|
||||||
"""Plot filled region between `y1` and `y2`.
|
"""Plot filled region between `y1` and `y2`.
|
||||||
|
@ -183,7 +183,7 @@ def plotEllipDist(catalogList,
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
def plotVoidCells(catalogList,
|
def plotVoidCells(catalog,
|
||||||
voidID,
|
voidID,
|
||||||
figDir="./",
|
figDir="./",
|
||||||
plotName="cells",
|
plotName="cells",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue