weighted volumes now propagate to pruning step

This commit is contained in:
Paul M. Sutter 2024-06-07 12:17:17 +02:00
parent 7e5a51d931
commit 78678881af
3 changed files with 14 additions and 5 deletions

View file

@ -101,7 +101,7 @@ newSample = Sample(
# width of redshift boundaries to flag edge galaxies # width of redshift boundaries to flag edge galaxies
# (interpreted as boundaryWidth*(zMax-zMin)) # (interpreted as boundaryWidth*(zMax-zMin))
boundaryWidth = 0.1, boundaryWidth = 0.01,
# leave this at -1 for mean particle separation, # leave this at -1 for mean particle separation,
# or specify your own in Mpc/h # or specify your own in Mpc/h

View file

@ -79,6 +79,7 @@ class Sample:
omegaM = 0.27 omegaM = 0.27
minVoidRadius = -1 minVoidRadius = -1
fakeDensity = 0.01 fakeDensity = 0.01
hasWeightedVolumes = False
profileBinSize = 2 # Mpc profileBinSize = 2 # Mpc
autoNumInStack = -1 # set to >0 to automatically generate stacks of size N autoNumInStack = -1 # set to >0 to automatically generate stacks of size N
autoPartInStack = -1 # set to >0 to automatically generate stacks with N particles autoPartInStack = -1 # set to >0 to automatically generate stacks with N particles
@ -104,7 +105,7 @@ class Sample:
zBoundary=(), zRange=(), zBoundaryMpc=(), boundaryWidth=0.1, zBoundary=(), zRange=(), zBoundaryMpc=(), boundaryWidth=0.1,
shiftSimZ=False, shiftSimZ=False,
minVoidRadius=-1, fakeDensity=0.01, volumeLimited=True, minVoidRadius=-1, fakeDensity=0.01, volumeLimited=True,
numAPSlices=1, numAPSlices=1, hasWeightedVolumes=False,
includeInHubble=True, partOfCombo=False, isCombo=False, includeInHubble=True, partOfCombo=False, isCombo=False,
comboList=(), profileBinSize=2.0, comboList=(), profileBinSize=2.0,
boxLen=1024, usePecVel=False, omegaM=0.27, boxLen=1024, usePecVel=False, omegaM=0.27,
@ -126,6 +127,7 @@ class Sample:
self.zRange = zRange self.zRange = zRange
self.minVoidRadius = minVoidRadius self.minVoidRadius = minVoidRadius
self.fakeDensity = fakeDensity self.fakeDensity = fakeDensity
self.hasWeightedVolumes = hasWeightedVolumes
self.volumeLimited = volumeLimited self.volumeLimited = volumeLimited
self.includeInHubble = includeInHubble self.includeInHubble = includeInHubble
self.partOfCombo = partOfCombo self.partOfCombo = partOfCombo

View file

@ -437,6 +437,7 @@ def launchZobov(sample, binPath, outputDir=None, logDir=None, continueRun=None,
for i in range(len(vols)): for i in range(len(vols)):
vols[i] *= selfunc(redshifts[i]) vols[i] *= selfunc(redshifts[i])
sample.hasWeightedVolumes = True
volFile = outputDir+"/vol_weighted_"+sampleName+".dat" volFile = outputDir+"/vol_weighted_"+sampleName+".dat"
with open(volFile, mode='wb') as File: with open(volFile, mode='wb') as File:
numPartTot.astype(np.int32).tofile(File) numPartTot.astype(np.int32).tofile(File)
@ -467,6 +468,7 @@ def launchZobov(sample, binPath, outputDir=None, logDir=None, continueRun=None,
numPartTot.astype(np.int32).tofile(File) numPartTot.astype(np.int32).tofile(File)
vols.astype(np.float32).tofile(File) vols.astype(np.float32).tofile(File)
sample.hasWeightedVolumes = True
volFileToUse = outputDir+"/vol_weighted_"+sampleName+".dat" volFileToUse = outputDir+"/vol_weighted_"+sampleName+".dat"
else: else:
volFileToUse = outputDir+"/vol_"+sampleName+".dat" volFileToUse = outputDir+"/vol_"+sampleName+".dat"
@ -524,6 +526,12 @@ def launchPrune(sample, binPath,
periodicLine = " --periodic='" + getPeriodic(sample) + "'" periodicLine = " --periodic='" + getPeriodic(sample) + "'"
if sample.hasWeightedVolumes:
volFileLine = " --partVol=" + outputDir+"/vol_weighted_"+\
str(sampleName)+".dat"
else:
volFileLine = " --partVol=" + outputDir+"/vol_"+str(sampleName)+".dat"
if useComoving: if useComoving:
useComovingFlag = " --useComoving" useComovingFlag = " --useComoving"
else: else:
@ -548,11 +556,9 @@ def launchPrune(sample, binPath,
cmd += " --voidDesc=" + outputDir+"/voidDesc_"+str(sampleName)+".out" cmd += " --voidDesc=" + outputDir+"/voidDesc_"+str(sampleName)+".out"
cmd += " --void2Zone="+outputDir+"/voidZone_"+str(sampleName)+".dat" cmd += " --void2Zone="+outputDir+"/voidZone_"+str(sampleName)+".dat"
cmd += " --zone2Part=" + outputDir+"/voidPart_"+str(sampleName)+".dat" cmd += " --zone2Part=" + outputDir+"/voidPart_"+str(sampleName)+".dat"
cmd += " --partVol=" + outputDir+"/vol_"+str(sampleName)+".dat"
cmd += " --partAdj=" + outputDir+"/adj_"+str(sampleName)+".dat" cmd += " --partAdj=" + outputDir+"/adj_"+str(sampleName)+".dat"
cmd += " --partEdge=" + outputDir+"galaxy_edge_flags.txt" cmd += " --partEdge=" + outputDir+"galaxy_edge_flags.txt"
cmd += " --extraInfo=" + outputDir+"/zobov_slice_"+str(sampleName)+\ cmd += " --extraInfo=" + outputDir+"/zobov_slice_"+str(sampleName)+".par"
".par"
cmd += " --tolerance=" + str(boundaryTolerance) cmd += " --tolerance=" + str(boundaryTolerance)
cmd += " --mockIndex=" + str(mockIndex) cmd += " --mockIndex=" + str(mockIndex)
cmd += " --maxCentralDen=" + str(maxDen) cmd += " --maxCentralDen=" + str(maxDen)
@ -562,6 +568,7 @@ def launchPrune(sample, binPath,
cmd += " --numVoids=" + str(numVoids) cmd += " --numVoids=" + str(numVoids)
cmd += observationLine cmd += observationLine
cmd += periodicLine cmd += periodicLine
cmd += volFileLine
cmd += useComovingFlag cmd += useComovingFlag
cmd += " --omegaM=" + str(sample.omegaM) cmd += " --omegaM=" + str(sample.omegaM)
cmd += " --outputDir=" + outputDir cmd += " --outputDir=" + outputDir