more informative pipeline defaults.py file to describe how to handle particle files; option to do relative or absolute subsampling

This commit is contained in:
P.M. Sutter 2013-04-11 09:50:04 -05:00
parent c51d324bc0
commit 765b39ac63
2 changed files with 61 additions and 12 deletions

View file

@ -32,6 +32,9 @@ endAPStage = 5
continueRun = True
dataPortions = ["central"]
# auto for AP analysis, "fixed" for catalog comparison
stackMode = "fixed"
# directory for the input simulation/observational particle files
catalogDir = os.getenv("HOME")+"/workspace/Voids/catalog/"
@ -60,11 +63,16 @@ useLightCone = False
doPecVel = False
# common filename of particle files
# use a placeholder (such as NNNNN as shown below) to select the different
# filenames. For example, if we have partFile01, partFile02, etc.,
# then particleFileBase = 'partFileNN'
# particleFileDummy = 'NN'
# fileNums = ["01", "02"]
particleFileBase = "mf_4s_1G_512_NNNNN"
particleFileDummy = 'NNNNN'
# list of file numbers for the particle files
# to get particle file name, we take particleFileBase+fileNum
# to get particle file name, we replace particleFileDummy with fileNum
fileNums = ["0.667", "0.500"]
# redshift of each file in the above list
@ -80,9 +88,15 @@ numSubvolumes = 1
# prefix to give all outputs
prefix = "mt_"
# list of desired subsamples - these are in unts of h Mpc^-3!
# list of desired subsamples - see subSamplingMode parameter
subSamples = [1.0]
doSubSampling = True # do the subsampling in preparation script?
# if False, generateMock will do the subsampling
# if 'absolute', subSamples are given in particles per cubic Mpc/h
# if 'relative', subSamples are given as a fraction of input particles
subSampleMode = "absolute"
# common filename of halo files, leave blank to ignore halos
haloFileBase = "mf_4s_1G_512_bgc2_NNNNN.sdf"

View file

@ -87,13 +87,22 @@ def getNickName(sampleName):
if "ss" in splitName[1]:
nickName = "Subsample = " + splitName[1].replace("ss","")
nickName += ", z = " + splitName[2].replace("z","")
if "pv" in splitName[2]:
nickName += ", z = " + splitName[3].replace("z","") + ", Pev.Vel."
else:
nickName += ", z = " + splitName[2].replace("z","")
elif "hod" in splitName[1]:
nickName = "HOD = " + splitName[2]
nickName += ", z = " + splitName[3].replace("z","")
if "pv" in splitName[3]:
nickName += ", z = " + splitName[4].replace("z","") + ", Pec.Vel."
else:
nickName += ", z = " + splitName[3].replace("z","")
elif "halos" in splitName[1]:
nickName = "Halos, min mass = " + splitName[2].replace("min","")
nickName += ", z = " + splitName[3].replace("z","")
if "pv" in splitName[3]:
nickName += ", z = " + splitName[4].replace("z","") + ", Pec.Vel."
else:
nickName += ", z = " + splitName[3].replace("z","")
else:
nickName = sampleName
@ -185,6 +194,12 @@ newSample = Sample(dataFile = "{dataFile}",
useLightCone = {useLightCone},
subsample = "{subsample}")
dataSampleList.append(newSample)
"""
if stackMode == "fixed":
stackInfo = """
# {zMin}, {zMax}, {minRadius}
newSample.addStack(0.0, 5.0, 5 , 10, False, False)
newSample.addStack(0.0, 5.0, 10, 15, False, False)
newSample.addStack(0.0, 5.0, 15, 20, False, False)
newSample.addStack(0.0, 5.0, 20, 25, False, False)
@ -195,13 +210,22 @@ newSample.addStack(0.0, 5.0, 60, 65, False, False)
newSample.addStack(0.0, 5.0, 70, 75, False, False)
newSample.addStack(0.0, 5.0, 80, 85, False, False)
newSample.addStack(0.0, 5.0, 90, 95, False, False)
#newSample.addStack({zMin}, {zMax}, 2*{minRadius} , 2*{minRadius}+2, True, False)
#newSample.addStack({zMin}, {zMax}, 2*{minRadius} , 2*{minRadius}+4, True, False)
#newSample.addStack({zMin}, {zMax}, 2*{minRadius}+2, 2*{minRadius}+6, True, False)
#newSample.addStack({zMin}, {zMax}, 2*{minRadius}+6, 2*{minRadius}+10, True, False)
#newSample.addStack({zMin}, {zMax}, 2*{minRadius}+10, 2*{minRadius}+18, True, False)
#newSample.addStack({zMin}, {zMax}, 2*{minRadius}+18, 2*{minRadius}+24, True, False)
"""
elif stackMode == "auto":
stackInfo = """
newSample.addStack({zMin}, {zMax}, 2*{minRadius} , 2*{minRadius}+2, True, False)
newSample.addStack({zMin}, {zMax}, 2*{minRadius} , 2*{minRadius}+4, True, False)
newSample.addStack({zMin}, {zMax}, 2*{minRadius}+2, 2*{minRadius}+6, True, False)
newSample.addStack({zMin}, {zMax}, 2*{minRadius}+6, 2*{minRadius}+10, True, False)
newSample.addStack({zMin}, {zMax}, 2*{minRadius}+10, 2*{minRadius}+18, True, False)
newSample.addStack({zMin}, {zMax}, 2*{minRadius}+18, 2*{minRadius}+24, True, False)
"""
else:
stackInfo = """
# {zMin}, {zMax}, {minRadius}
"""
for (iFile, redshift) in enumerate(redshifts):
fileNum = fileNums[iFile]
@ -271,6 +295,11 @@ newSample.addStack(0.0, 5.0, 90, 95, False, False)
useLightCone=useLightCone,
subsample=str(subsample).strip('[]')))
scriptFile.write(stackInfo.format(zMin=sliceMin,
zMax=sliceMax,
minRadius=minRadius))
scriptFile.close()
return
@ -293,7 +322,13 @@ for iSubSample in xrange(len(subSamples)):
keepFractionList = []
for subSample in subSampleList:
keepFractionList.append(float(subSample) / baseResolution)
if subSampleMode == 'absolute':
keepFractionList.append(float(subSample) / baseResolution)
elif subSampleMode == 'relative':
keepFractionList.append(float(subSample))
else:
print "Unrecognized subSampleMode = ", subSampleMode
exit(-1)
thisSubSample = subSamples[iSubSample]
maxKeep = keepFractionList[-1] * numPart
minRadius = int(np.ceil(lbox/maxKeep**(1./3)))