mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-05 07:41:11 +00:00
catalog loading routine now also includes edge flag and particle adjancy info
This commit is contained in:
parent
1a678eda5d
commit
ad752f21e8
1 changed files with 27 additions and 7 deletions
|
@ -33,7 +33,7 @@ ncFloat = 'f8'
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
def loadPart(sampleDir):
|
def loadPart(sampleDir):
|
||||||
print(" Loading particle data...")
|
print(" Loading particle data...")
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
with open(sampleDir+"/sample_info.dat", 'rb') as input:
|
with open(sampleDir+"/sample_info.dat", 'rb') as input:
|
||||||
|
@ -189,7 +189,7 @@ def getVolNorm(sampleDir):
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
def loadPartVel(sampleDir):
|
def loadPartVel(sampleDir):
|
||||||
#print " Loading particle velocities..."
|
#print " Loading particle velocities..."
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
with open(sampleDir+"/sample_info.dat", 'rb') as input:
|
with open(sampleDir+"/sample_info.dat", 'rb') as input:
|
||||||
|
@ -367,7 +367,7 @@ def loadVoidCatalog(sampleDir, dataPortion="central", loadParticles=True,
|
||||||
))
|
))
|
||||||
|
|
||||||
catalog.numVoids = len(catalog.voids)
|
catalog.numVoids = len(catalog.voids)
|
||||||
print("Read %d voids" % catalog.numVoids)
|
print(" Read %d voids" % catalog.numVoids)
|
||||||
|
|
||||||
print("Loading macrocenters...")
|
print("Loading macrocenters...")
|
||||||
iLine = 0
|
iLine = 0
|
||||||
|
@ -435,13 +435,25 @@ def loadVoidCatalog(sampleDir, dataPortion="central", loadParticles=True,
|
||||||
y = partData[i][1],
|
y = partData[i][1],
|
||||||
z = partData[i][2],
|
z = partData[i][2],
|
||||||
volume = 0,
|
volume = 0,
|
||||||
|
adjs = 0,
|
||||||
ra = extraData[i][0],
|
ra = extraData[i][0],
|
||||||
dec = extraData[i][1],
|
dec = extraData[i][1],
|
||||||
redshift = extraData[i][2],
|
redshift = extraData[i][2],
|
||||||
uniqueID = extraData[i][3]))
|
uniqueID = extraData[i][3],
|
||||||
|
edgeFlag = 0))
|
||||||
|
|
||||||
|
|
||||||
print("Loading volumes...")
|
if isObservationData:
|
||||||
|
print(" Loading edge flags...")
|
||||||
|
edgeFlagFile = sampleDir+"/galaxy_edge_flags.txt"
|
||||||
|
if os.path.isfile(edgeFlagFile):
|
||||||
|
edgeFlags = np.genfromtxt(edgeFlagFile, dtype=np.int32, skip_header=1)
|
||||||
|
for iEdge in range(len(edgeFlags)):
|
||||||
|
catalog.part[iEdge].edgeFlag = edgeFlags[iEdge]
|
||||||
|
else:
|
||||||
|
print(" Edge file not found!")
|
||||||
|
|
||||||
|
print(" Loading volumes...")
|
||||||
if sample.hasWeightedVolumes:
|
if sample.hasWeightedVolumes:
|
||||||
volFile = sampleDir+"/vol_weighted_"+sample.fullName+".dat"
|
volFile = sampleDir+"/vol_weighted_"+sample.fullName+".dat"
|
||||||
else:
|
else:
|
||||||
|
@ -452,7 +464,15 @@ def loadVoidCatalog(sampleDir, dataPortion="central", loadParticles=True,
|
||||||
for ivol in range(len(vols)):
|
for ivol in range(len(vols)):
|
||||||
catalog.part[ivol].volume = vols[ivol] / volNorm
|
catalog.part[ivol].volume = vols[ivol] / volNorm
|
||||||
|
|
||||||
print("Loading zone-void membership info...")
|
print(" Loading adjacencies...")
|
||||||
|
adjFile = sampleDir+"adj_"+sample.fullName+".dat"
|
||||||
|
with open(adjFile, mode="rb") as File:
|
||||||
|
numPart = np.fromfile(adjFile, dtype=np.int32,count=1)[0]
|
||||||
|
for p in range(numPart):
|
||||||
|
numAdjs = np.fromfile(File, dtype=np.int32,count=1)[0]
|
||||||
|
catalog.part[p].adjs = np.fromfile(File, dtype=np.int32, count=numAdjs)
|
||||||
|
|
||||||
|
print(" Loading zone-void membership info...")
|
||||||
zoneFile = sampleDir+"/voidZone_"+sample.fullName+".dat"
|
zoneFile = sampleDir+"/voidZone_"+sample.fullName+".dat"
|
||||||
catalog.void2Zones = []
|
catalog.void2Zones = []
|
||||||
with open(zoneFile, mode="rb") as File:
|
with open(zoneFile, mode="rb") as File:
|
||||||
|
@ -467,7 +487,7 @@ def loadVoidCatalog(sampleDir, dataPortion="central", loadParticles=True,
|
||||||
zoneID = np.fromfile(File, dtype=np.int32,count=1)[0]
|
zoneID = np.fromfile(File, dtype=np.int32,count=1)[0]
|
||||||
catalog.void2Zones[iZ].zoneIDs.append(zoneID)
|
catalog.void2Zones[iZ].zoneIDs.append(zoneID)
|
||||||
|
|
||||||
print("Loading particle-zone membership info...")
|
print(" Loading particle-zone membership info...")
|
||||||
zonePartFile = sampleDir+"/voidPart_"+sample.fullName+".dat"
|
zonePartFile = sampleDir+"/voidPart_"+sample.fullName+".dat"
|
||||||
catalog.zones2Parts = []
|
catalog.zones2Parts = []
|
||||||
with open(zonePartFile) as File:
|
with open(zonePartFile) as File:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue