more consistent handling of void datasets

This commit is contained in:
P.M. Sutter 2014-05-06 18:00:27 -05:00
parent 1218ba3bdd
commit 2ae082069e
2 changed files with 48 additions and 56 deletions

View file

@ -1,51 +0,0 @@
#+
# VIDE -- Void IDentification and Examination -- ./analysis/datasetsToAnalyze.py
# Copyright (C) 2010-2014 Guilhem Lavaux
# Copyright (C) 2011-2014 P. M. Sutter
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#+
#!/usr/bin/env python
outputDir = "/home/psutter2/workspace/Voids/analysis/xcor/"
# Sim parameters
Ni = 1000237 # Number of dark matter particles per dimension in simulation
ss = 0.1 # Subsampling fraction of dark matter particles to read
Mpart = 8.721e9 # Particle mass [M_sol]
Npart = int(ss*Ni) # Particle number of subsample
Lboxcut = 0. # Size of optional margin to be cut from the box [h^(-1)Mpc]
Nmesh = 256 # Interpolation meshlength
Nbin = 70 # Number of bins for power spectrum and correlation function
r_H = 3000. # Hubble scale [h^(-1)Mpc]
ns = 0.95 # Spectral index
sigma_8 = 0.82 # Sigma_8
h = 0.7 # Dimensionless Hubble parameter
# Input files
matterDir = '/home/psutter2/workspace/Voids/catalogs/mergertree512/'
haloDir = '/home/psutter2/workspace/Voids/catalogs/mergertree512/'
matterFilename = 'mf_4s_1G_512_1.000'
haloFilename = 'mf_4s_1G_512_bgc2_1.000.sdf'
voidBaseDir = "/home/psutter2/workspace/Voids/"
sampleDirList = [
"mergertree512/mt_ss0.01/sample_mt_ss0.01_z0.00_d00/",
]
dataPortion = "central"

View file

@ -219,15 +219,17 @@ class Catalog:
zones2Parts = None
void2Zones = None
voids = None
sampleInfo = None
# -----------------------------------------------------------------------------
def loadVoidCatalog(sampleDir):
def loadVoidCatalog(sampleDir, dataPortion="central"):
#print " Loading particle data..."
sys.stdout.flush()
catalog = Catalog()
with open(sampleDir+"/sample_info.dat", 'rb') as input:
sample = pickle.load(input)
catalog.sampleInfo = sample
print "Loading info..."
infoFile = sampleDir+"/zobov_slice_"+sample.fullName+".par"
@ -248,6 +250,7 @@ def loadVoidCatalog(sampleDir):
partData, boxLen, volNorm, isObservationData, ranges = loadPart(sampleDir)
numPartTot = len(partData)
catalog.numPartTot = numPartTot
catalog.partPos = partData
catalog.part = []
for i in xrange(len(partData)):
catalog.part.append(Bunch(x = partData[i][0],
@ -269,7 +272,7 @@ def loadVoidCatalog(sampleDir):
catalog.part[ivol].volume = vols[ivol] / volNorm
print "Loading voids..."
fileName = sampleDir+"/voidDesc_central_"+sample.fullName+".out"
fileName = sampleDir+"/untrimmed_voidDesc_"+dataPortion+"_"+sample.fullName+".out"
catData = np.loadtxt(fileName, comments="#", skiprows=2)
catalog.voids = []
for line in catData:
@ -283,21 +286,61 @@ def loadVoidCatalog(sampleDir):
voidVol = line[7],
numPart = int(line[8]),
densCon = line[9],
voidProp = line[10],
voidProb = line[10],
radius = pow(line[7]/volNorm*3./4./np.pi, 1./3.),
barycenter = np.zeros((3))))
barycenter = np.zeros((3))
parentID = 0,
treeLevel = 0,
numChildren = 0,
centralDen = 0.,
eigenVals = np.zeros((3)),
eigenVecs = np.zeros((3,3)),
))
print "Read %d voids" % len(catalog.voids)
print "Loading barycenters..."
iLine = 0
for line in open(sampleDir+"/barycenters_central_"+sample.fullName+".out"):
for line in open(sampleDir+"/untrimmed_barycenters_"+dataPortion+"_"+sample.fullName+".out"):
line = line.split()
catalog.voids[iLine].barycenter[0] = float(line[1])
catalog.voids[iLine].barycenter[1] = float(line[2])
catalog.voids[iLine].barycenter[2] = float(line[3])
iLine += 1
print "Loading derived void information..."
iLine = 0
for line in open(sampleDir+"/untrimmed_centers_"+dataPortion+"_"+sample.fullName+".out"):
line = line.split()
catalog.voids[iLine].volume = float(line[6])
catalog.voids[iLine].radius = float(line[4])
catalog.voids[iLine].parentID = float(line[10])
catalog.voids[iLine].treeLevel = float(line[11])
catalog.voids[iLine].numChildren = float(line[12])
catalog.voids[iLine].centralDen = float(line[13])
iLine += 1
print "Loading shapes..."
iLine = 0
for line in open(sampleDir+"/untrimmed_shapes_"+dataPortion+"_"+sample.fullName+".out"):
line = line.split()
catalog.voids[iLine].eigenVals[0] = float(line[1])
catalog.voids[iLine].eigenVals[1] = float(line[2])
catalog.voids[iLine].eigenVals[2] = float(line[3])
catalog.voids[iLine].eigenVecs[0][0] = float(line[4])
catalog.voids[iLine].eigenVecs[0][1] = float(line[5])
catalog.voids[iLine].eigenVecs[0][2] = float(line[6])
catalog.voids[iLine].eigenVecs[1][0] = float(line[7])
catalog.voids[iLine].eigenVecs[1][1] = float(line[8])
catalog.voids[iLine].eigenVecs[1][2] = float(line[9])
catalog.voids[iLine].eigenVecs[2][0] = float(line[10])
catalog.voids[iLine].eigenVecs[2][1] = float(line[11])
catalog.voids[iLine].eigenVecs[2][2] = float(line[12])
iLine += 1
print "Loading zone-void membership info..."
zoneFile = sampleDir+"/voidZone_"+sample.fullName+".dat"