carried boundary flags all the way through to pruning; cleaned up pruning routines

This commit is contained in:
Paul M. Sutter 2024-06-06 20:26:47 +02:00
parent dd181da42a
commit a45eca0b6e
5 changed files with 124 additions and 139 deletions

View file

@ -446,6 +446,31 @@ def launchZobov(sample, binPath, outputDir=None, logDir=None, continueRun=None,
else:
volFileToUse = outputDir+"/vol_"+sampleName+".dat"
# re-weight the volumes of any edge galaxies to prevent watershed
# from spilling outside of survey region
if sample.dataType == "observation":
# read in the appropriate volume file
with open(volFileToUse, mode="rb") as File:
numPartTot = np.fromfile(File, dtype=np.int32,count=1)[0]
vols = np.fromfile(File, dtype=np.float32, count=numPartTot)
# read in the edge flag information
edgeFile = outputDir+"/galaxy_edge_flags.txt"
edgeFlags = np.loadtxt(edgeFile, dtype=np.int32)
# set edge galaxy volumes to nearly 0 (implying very high density)
vols[ edgeFlags>0 ] = 1.e-4
volFile = outputDir+"/vol_weighted_"+sampleName+".dat"
with open(volFile, mode='wb') as File:
numPartTot.astype(np.int32).tofile(File)
vols.astype(np.float32).tofile(File)
volFileToUse = outputDir+"/vol_weighted_"+sampleName+".dat"
else:
volFileToUse = outputDir+"/vol_"+sampleName+".dat"
cmd = [binPath+"/jozov2", \
outputDir+"/adj_"+sampleName+".dat", \
@ -525,6 +550,7 @@ def launchPrune(sample, binPath,
cmd += " --zone2Part=" + outputDir+"/voidPart_"+str(sampleName)+".dat"
cmd += " --partVol=" + outputDir+"/vol_"+str(sampleName)+".dat"
cmd += " --partAdj=" + outputDir+"/adj_"+str(sampleName)+".dat"
cmd += " --partEdge=" + outputDir+"galaxy_edge_flags.txt"
cmd += " --extraInfo=" + outputDir+"/zobov_slice_"+str(sampleName)+\
".par"
cmd += " --tolerance=" + str(boundaryTolerance)

View file

@ -161,18 +161,19 @@ def findEdgeGalaxies(galFile, maskFile, edgeGalFile, edgeMaskFile,
phi, theta = convertAngle(RA, Dec)
# check the mask edges
neighbors = healpy.get_all_neighbours(nside, theta, phi)
isOnMaskEdge = any(p == 0 for p in neighbors)
ipix = healpy.ang2pix(nside, theta, phi)
neighbors = healpy.get_all_neighbours(nside, ipix)
isOnMaskEdge = any(mask[p] == 0 for p in neighbors)
# check the redshift boundaries
tol = 0.01 # TODO: made this user-adjustable
tol = 0.05 # TODO: made this user-adjustable
zbuffer = (zmax-zmin)*tol
isOnHighZEdge = (z >= zmax-zbuffer)
isOnLowZEdge = (z <= zmin+zbuffer)
print("DOING %f %f %f %f\n" % (zbuffer, z, zmax, zmin) )
if isOnMaskEdge:
edgeFile.write("1\n")
edgeMask[ipix] = 1
elif isOnHighZEdge:
edgeFile.write("2\n")
elif isOnLowZEdge: