redshift boundary tolerance is now user-selectable

This commit is contained in:
Paul M. Sutter 2024-06-07 11:58:36 +02:00
parent c0a69c4536
commit 7e5a51d931
8 changed files with 26 additions and 20 deletions

View file

@ -73,6 +73,7 @@ class Sample:
selFunFile = "czselfunc.all.dr72dim.dat"
zBoundary = (0.0, 0.1)
zBoundaryMpc = (0., 300)
boundaryWidth = 0.02
shiftSimZ = False
zRange = (0.0, 0.1)
omegaM = 0.27
@ -100,7 +101,8 @@ class Sample:
def __init__(self, dataFile="", fullName="", dataUnit=1,
nickName="", maskFile="", nsideForMask=128, selFunFile="",
zBoundary=(), zRange=(), zBoundaryMpc=(), shiftSimZ=False,
zBoundary=(), zRange=(), zBoundaryMpc=(), boundaryWidth=0.1,
shiftSimZ=False,
minVoidRadius=-1, fakeDensity=0.01, volumeLimited=True,
numAPSlices=1,
includeInHubble=True, partOfCombo=False, isCombo=False,
@ -119,6 +121,7 @@ class Sample:
self.selFunFile = selFunFile
self.zBoundary = zBoundary
self.zBoundaryMpc = zBoundaryMpc
self.boundaryWidth = boundaryWidth
self.shiftSimZ = shiftSimZ
self.zRange = zRange
self.minVoidRadius = minVoidRadius

View file

@ -74,7 +74,7 @@ def launchPrep(sample, binPath, workDir=None, inputDataDir=None,
edgeMaskFile = outputDir + "/mask_edge_map.fits"
findEdgeGalaxies(datafile, sample.maskFile, edgeGalFile, edgeMaskFile,
sample.zBoundary[0], sample.zBoundary[1], sample.omegaM,
useComoving)
useComoving, sample.boundaryWidth)
if useComoving:
useComovingFlag = "useComoving"

View file

@ -130,11 +130,13 @@ def figureOutMask(galFile, nside, outMaskFile):
# figures out which galaxies live on a mask edge, and also writes the edge
# map to an auxillary file
def findEdgeGalaxies(galFile, maskFile, edgeGalFile, edgeMaskFile,
zmin, zmax, omegaM, useComoving=False):
zmin, zmax, omegaM, useComoving, boundaryWidth):
#if useComoving:
# zmin = LIGHT_SPEED/100.*comovingDistance(zmin, Om=omegaM)
# zmax = LIGHT_SPEED/100.*comovingDistance(zmax, Om=omegaM)
if useComoving:
zmin = comovingDistance(zmin, Om=omegaM)
zmax = comovingDistance(zmax, Om=omegaM)
#zmin = LIGHT_SPEED/100.*comovingDistance(zmin, Om=omegaM)
#zmax = LIGHT_SPEED/100.*comovingDistance(zmax, Om=omegaM)
#else:
# zmin *= LIGHT_SPEED/100.
# zmax *= LIGHT_SPEED/100.
@ -166,8 +168,7 @@ def findEdgeGalaxies(galFile, maskFile, edgeGalFile, edgeMaskFile,
isOnMaskEdge = any(mask[p] == 0 for p in neighbors)
# check the redshift boundaries
tol = 0.05 # TODO: made this user-adjustable
zbuffer = (zmax-zmin)*tol
zbuffer = (zmax-zmin)*boundaryWidth
isOnHighZEdge = (z >= zmax-zbuffer)
isOnLowZEdge = (z <= zmin+zbuffer)
@ -182,6 +183,7 @@ def findEdgeGalaxies(galFile, maskFile, edgeGalFile, edgeMaskFile,
edgeFile.write("0\n")
edgeFile.close()
healpy.write_map(edgeMaskFile, edgeMask, overwrite=True, dtype=np.dtype('float64'))
healpy.write_map(edgeMaskFile, edgeMask, overwrite=True,
dtype=np.dtype('float64'))
return