renamed start and end stage parameters; removed unused 'regenerate' flag

This commit is contained in:
Paul M. Sutter 2025-04-22 22:43:59 -04:00
parent 4c48221699
commit ccc2d67cf1
7 changed files with 24 additions and 58 deletions

View file

@ -52,20 +52,15 @@ class Bunch:
# -----------------------------------------------------------------------------
def launchPrep(sample, binPath, workDir=None, inputDataDir=None,
outputDir=None, figDir=None, logFile=None, useComoving=False,
continueRun=None, regenerate=False):
continueRun=None):
startTime = time.time()
if sample.dataType == "observation":
sampleName = sample.fullName
if regenerate:
inputParameterFlag = "inputParameter " + outputDir + \
"/zobov_slice_"+sampleName+".par"
outputFile = outputDir + "/regenerated_zobov_slice_" + sampleName
else:
inputParameterFlag = ""
outputFile = outputDir + "/zobov_slice_" + sampleName
inputParameterFlag = ""
outputFile = outputDir + "/zobov_slice_" + sampleName
if sample.dataFile == "":
datafile = inputDataDir+"/"+sampleName
@ -103,7 +98,7 @@ def launchPrep(sample, binPath, workDir=None, inputDataDir=None,
parmFile = os.getcwd()+"/prep_"+sample.fullName+".par"
if regenerate or not (continueRun and jobSuccessful(logFile, "Done!\n")):
if not (continueRun and jobSuccessful(logFile, "Done!\n")):
with open(parmFile, mode="wt") as f:
f.write(conf)
@ -453,8 +448,6 @@ def launchZobov(sample, binPath, outputDir=None, logDir=None, continueRun=None,
kind='cubic', bounds_error=False,
fill_value=1.0)
# re-weight and write
## TEST
#redshifts /= 10000.
for i in range(len(vols)):
vols[i] *= selfunc(redshifts[i])
@ -573,8 +566,7 @@ def launchZobov(sample, binPath, outputDir=None, logDir=None, continueRun=None,
# -----------------------------------------------------------------------------
def launchPrune(sample, binPath,
summaryFile=None, logFile=None, outputDir=None,
continueRun=None, useComoving=False, mergingThreshold=0.2,
boundaryTolerance=1.0):
continueRun=None, useComoving=False, mergingThreshold=0.2):
startTime = time.time()
@ -626,7 +618,6 @@ def launchPrune(sample, binPath,
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)
cmd += " --maxCentralDen=" + str(maxDen)
cmd += " --rMin=" + str(minRadius)
cmd += " --numVoids=" + str(numVoids)
@ -638,7 +629,6 @@ def launchPrune(sample, binPath,
cmd += " --outputDir=" + outputDir
cmd += " --sampleName=" + str(sampleName)
log = open(logFile, 'w')
#log.write(f"Command is {cmd}\n")
subprocess.call(cmd, stdout=log, stderr=log, shell=True)
log.close()

View file

@ -43,12 +43,10 @@ if (len(sys.argv) > 1):
print(" Cannot find parameter file %s!" % filename)
exit(-1)
parms = imp.load_source("name", filename)
regenerateFlag = False
globals().update(vars(parms))
void_path = os.path.split(voidUtil.__file__)[0]
ZOBOV_PATH=f'{void_path}/../vide/bin/' # this needs to be cleaned up
CTOOLS_PATH=ZOBOV_PATH
#print(f"ZOBOV_PATH is {ZOBOV_PATH}")
else:
print(" Using default parameters")
@ -64,11 +62,11 @@ if not os.access(figDir, os.F_OK):
if not continueRun:
print(" Cleaning out log files...")
if startCatalogStage <= 1 and glob.glob(logDir+"/prepare*") != []:
if startStage <= 1 and glob.glob(logDir+"/prepare*") != []:
os.system("rm %s/prepare*" % logDir)
if startCatalogStage <= 2 and glob.glob(logDir+"/zobov*") != []:
if startStage <= 2 and glob.glob(logDir+"/zobov*") != []:
os.system("rm %s/zobov*" % logDir)
if startCatalogStage <= 3 and glob.glob(logDir+"/prune*") != []:
if startStage <= 3 and glob.glob(logDir+"/prune*") != []:
os.system("rm %s/prune*" % logDir)
for sample in dataSampleList:
@ -83,7 +81,7 @@ for sample in dataSampleList:
os.makedirs(outputDir)
# ---------------------------------------------------------------------------
if (startCatalogStage <= 1) and (endCatalogStage >= 1) and not sample.isCombo:
if (startStage <= 1) and (endStage >= 1) and not sample.isCombo:
print(" Preparing tracers from catalog...", end='')
sys.stdout.flush()
@ -97,10 +95,10 @@ for sample in dataSampleList:
launchPrep(sample, PREPARE_PATH, workDir=workDir,
inputDataDir=inputDataDir, outputDir=outputDir,
figDir=figDir, logFile=logFile, useComoving=sample.useComoving,
continueRun=continueRun, regenerate=regenerateFlag)
continueRun=continueRun)
# --------------------------------------------------------------------------
if (startCatalogStage <= 2) and (endCatalogStage >= 2) and not sample.isCombo:
if (startStage <= 2) and (endStage >= 2) and not sample.isCombo:
print(" Finding voids...", end='')
sys.stdout.flush()
@ -110,7 +108,7 @@ for sample in dataSampleList:
mergingThreshold=mergingThreshold)
# -------------------------------------------------------------------------
if (startCatalogStage <= 3) and (endCatalogStage >= 3) and not sample.isCombo:
if (startStage <= 3) and (endStage >= 3) and not sample.isCombo:
print(" Pruning void catalogs...", end='')
sys.stdout.flush()
@ -124,20 +122,4 @@ for sample in dataSampleList:
useComoving=sample.useComoving, continueRun=continueRun,
mergingThreshold=mergingThreshold)
# -------------------------------------------------------------------------
if (startCatalogStage <= 4) and (endCatalogStage >= 4):
print(" Plotting...", end='')
sys.stdout.flush()
#for thisDataPortion in dataPortions:
#plotRedshiftDistribution(workDir, dataSampleList, figDir, showPlot=False,
# dataPortion=thisDataPortion, setName=setName)
#plotSizeDistribution(workDir, dataSampleList, figDir, showPlot=False,
# dataPortion=thisDataPortion, setName=setName)
#plotNumberDistribution(workDir, dataSampleList, figDir, showPlot=False,
# dataPortion=thisDataPortion, setName=setName)
#plotVoidDistribution(workDir, dataSampleList, figDir, showPlot=False,
# dataPortion=thisDataPortion, setName=setName)
print("\n VIDE finished!")

View file

@ -165,14 +165,14 @@ import os
from backend.classes import *
continueRun = {continueRun} # set to True to enable restarting aborted jobs
startCatalogStage = {startCatalogStage}
endCatalogStage = {endCatalogStage}
startStage = {startStage}
endStage = {endStage}
dataSampleList = []
"""
scriptFile.write(header.format(startCatalogStage=startCatalogStage,
endCatalogStage=endCatalogStage,
scriptFile.write(header.format(startStage=startStage,
endStage=endStage,
continueRun=continueRun,
))