mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 15:21:11 +00:00
extra info in void catalog output (void type, max radius, nearest flagged galaxy), added filtering routines on these properties for post-analysis
This commit is contained in:
parent
f9fc9e8990
commit
dadfd8d40a
2 changed files with 70 additions and 45 deletions
|
@ -367,7 +367,8 @@ def loadVoidCatalog(sampleDir, dataPortion="central", loadParticles=True,
|
|||
numPart = int(line[8]),
|
||||
densCon = line[9],
|
||||
voidProb = line[10],
|
||||
radius = 0., # this is read in later
|
||||
# below values to be read in or computed later
|
||||
radius = 0.,
|
||||
macrocenter = np.zeros((3)),
|
||||
redshift = 0,
|
||||
RA = 0,
|
||||
|
@ -379,6 +380,9 @@ def loadVoidCatalog(sampleDir, dataPortion="central", loadParticles=True,
|
|||
ellipticity = 0.,
|
||||
eigenVals = np.zeros((3)),
|
||||
eigenVecs = np.zeros((3,3)),
|
||||
voidType = CENTRAL_VOID,
|
||||
maxRadius = 0.,
|
||||
nearestEdge = 0.
|
||||
))
|
||||
|
||||
catalog.numVoids = len(catalog.voids)
|
||||
|
@ -438,6 +442,19 @@ def loadVoidCatalog(sampleDir, dataPortion="central", loadParticles=True,
|
|||
|
||||
iLine += 1
|
||||
|
||||
fileName = sampleDir+"/"+prefix+"extraInfo_"+dataPortion+"_"+sample.fullName+".out"
|
||||
if os.path.exists(fileName):
|
||||
catData = np.loadtxt(filename, comments="#")
|
||||
for (iLine,line) in enumerate(cataData):
|
||||
catalog.voids[iLine].voidType = int(line[0])
|
||||
catalog.voids[iLine].maxRadius = float(line[1])
|
||||
catalog.voids[iLine].nearestEdge = float(line[2])
|
||||
|
||||
iLine += 1
|
||||
|
||||
else:
|
||||
print(" Extra info file not found!")
|
||||
|
||||
if loadParticles:
|
||||
print("Loading all particles...")
|
||||
partData, boxLen, volNorm, isObservationData, ranges, extraData, mockPart = loadPart(sampleDir)
|
||||
|
@ -473,7 +490,7 @@ def loadVoidCatalog(sampleDir, dataPortion="central", loadParticles=True,
|
|||
#catalog.part[:].edgeFlags = 0
|
||||
|
||||
print(" Loading volumes...")
|
||||
if sample.hasWeightedVolumes:
|
||||
if hasattr(sample, "hasWeightedVolumes") and sample.hasWeightedVolumes:
|
||||
volFile = sampleDir+"/vol_weighted_"+sample.fullName+".dat"
|
||||
else:
|
||||
volFile = sampleDir+"/vol_"+sample.fullName+".dat"
|
||||
|
@ -589,12 +606,13 @@ def getVoidPart(catalog, voidID):
|
|||
return partOut
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# various handy catalog filtering routines
|
||||
|
||||
def filterVoidsOnSize(catalog, rMin):
|
||||
catalog.voids = [v for v in catalog.voids if v.radius >= rMin]
|
||||
catalog.numVoids = len(catalog.voids)
|
||||
return catalog
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
def filterVoidsOnTreeLevel(catalog, level):
|
||||
catalog.voids = [v for v in catalog.voids if v.treeLevel == level]
|
||||
if level == -1:
|
||||
|
@ -602,24 +620,31 @@ def filterVoidsOnTreeLevel(catalog, level):
|
|||
catalog.numVoids = len(catalog.voids)
|
||||
return catalog
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
def filterVoidsOnCentralDen(catalog, maxCentralDen):
|
||||
catalog.voids = [v for v in catalog.voids if v.centralDen <= maxCentralDen]
|
||||
catalog.numVoids = len(catalog.voids)
|
||||
return catalog
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
def filterVoidsOnCoreDen(catalog, maxCoreDen):
|
||||
catalog.voids = [v for v in catalog.voids if v.coreDens <= maxCoreDen]
|
||||
catalog.numVoids = len(catalog.voids)
|
||||
return catalog
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
def filterVoidsOnDenCon(catalog, minDenCon):
|
||||
catalog.voids = [v for v in catalog.voids if v.densCon >= minDenCon]
|
||||
catalog.numVoids = len(catalog.voids)
|
||||
return catalog
|
||||
|
||||
def filterVoidsOnType(catalog, voidType):
|
||||
catalog.voids = [v for v in catalog.voids if v.voidType == voidType]
|
||||
catalog.numVoids = len(catalog.voids)
|
||||
return catalog
|
||||
|
||||
def filterVoidsOnNearestEdge(catalog, factor=1.0):
|
||||
catalog.voids = [v for v in catalog.voids if \
|
||||
factor*v.maxRadius <= v.nearestEdge]
|
||||
catalog.numVoids = len(catalog.voids)
|
||||
return catalog
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue