From ccc2d67cf1c9f896828b1ea121f371cb0b7e5e36 Mon Sep 17 00:00:00 2001 From: "Paul M. Sutter" Date: Tue, 22 Apr 2025 22:43:59 -0400 Subject: [PATCH] renamed start and end stage parameters; removed unused 'regenerate' flag --- c_source/pruning/pruneVoids.cpp | 5 --- c_source/pruning/pruneVoids.ggo | 7 ++-- .../example_observation.py | 6 ++-- .../example_simulation/example_simulation.py | 4 +-- python_source/backend/launchers.py | 20 +++--------- python_source/vide_pipeline/__main__.py | 32 ++++--------------- .../vide_pipeline/vide_prepare_simulation.py | 8 ++--- 7 files changed, 24 insertions(+), 58 deletions(-) diff --git a/c_source/pruning/pruneVoids.cpp b/c_source/pruning/pruneVoids.cpp index 51231fd..8b3f646 100644 --- a/c_source/pruning/pruneVoids.cpp +++ b/c_source/pruning/pruneVoids.cpp @@ -188,7 +188,6 @@ int main(int argc, char **argv) { int i, p, p2, numPartTot, numZonesTot, dummy, iVoid; int numVoids; - double tolerance; FILE *fp; PART *part, *voidPart, *flaggedPart; ZONE2PART *zones2Parts; @@ -212,7 +211,6 @@ int main(int argc, char **argv) { gsl_eigen_symmv_workspace *eigw = gsl_eigen_symmv_alloc(3); numVoids = args.numVoids_arg; - tolerance = args.tolerance_arg; clock1 = clock(); @@ -271,9 +269,6 @@ int main(int argc, char **argv) { // which is all particles (including mock boundary galaxies used in old // versions of VIDE) divided by the total volume of the bounding box volNorm = numPartTot/(boxLen[0]*boxLen[1]*boxLen[2]); - printf(" VOL NORM = %f\n", volNorm); - - printf(" MAX CENTRAL DEN = %e\n", args.maxCentralDen_arg); fread(&dummy, 1, 4, fp); fread(temp, numPartTot, 4, fp); diff --git a/c_source/pruning/pruneVoids.ggo b/c_source/pruning/pruneVoids.ggo index 4339073..69b84aa 100644 --- a/c_source/pruning/pruneVoids.ggo +++ b/c_source/pruning/pruneVoids.ggo @@ -4,9 +4,9 @@ version "alpha" option "configFile" - "Configuration filename" string optional -option "partFile" - "Particle file from generateFromCatalog" string required +option "partFile" - "Particle file from prepObservation" string required -option "extraInfo" - "Extra particle file from generateFromCatalog" string required +option "extraInfo" - "Extra particle file from prepObservation" string required option "voidDesc" - "Void list from ZOBOV" string required @@ -31,12 +31,11 @@ option "omegaM" - "Omega_M for redshift convertion" double optional default="0.2 option "rMin" - "Minimum allowable void radius" double optional default="0.0" option "outputDir" - "Directory to place outputs" string required + option "sampleName" - "unique string to assign to outputs" string required option "periodic" - "Set of edges which are periodic" string optional default="xy" -option "tolerance" - "Fraction of void width to consider edge" double optional default="1.0" - option "centralRadFrac" - "Fraction of void radii to consider central region" double optional default="4" option "maxCentralDen" - "Maximum central density to accept as a void" double optional default="0.2" diff --git a/examples/example_observation/example_observation.py b/examples/example_observation/example_observation.py index 3e8522f..310c894 100644 --- a/examples/example_observation/example_observation.py +++ b/examples/example_observation/example_observation.py @@ -30,8 +30,8 @@ continueRun = False # 1 : extract redshift slices from data # 2 : void extraction using zobov # 3 : removal of small voids and voids near the edge -startCatalogStage = 1 -endCatalogStage = 3 +startStage = 1 +endStage = 3 basePath = os.path.dirname(os.path.abspath(__file__)) @@ -55,7 +55,7 @@ numZobovDivisions = 2 # Maximum density for merging voids # 0 (equivalent to infinitely large value) -> Merge everything (no threshold) -# 1e-9 (or smaller != 0) -> Do not merge anything +# 1e-9 (or smaller, but != 0) -> Do not merge anything mergingThreshold = 1e-9 # when trimming away voids near the bounaries, what multiple of the radius to diff --git a/examples/example_simulation/example_simulation.py b/examples/example_simulation/example_simulation.py index db9a84e..bcdecc5 100644 --- a/examples/example_simulation/example_simulation.py +++ b/examples/example_simulation/example_simulation.py @@ -32,8 +32,8 @@ continueRun = False # 1 : extract redshift slices from data # 2 : void extraction using zobov # 3 : removal of small voids and voids near the edge -startCatalogStage = 1 -endCatalogStage = 3 +startStage = 1 +endStage = 3 # directory for the input simulation files catalogDir = PWD diff --git a/python_source/backend/launchers.py b/python_source/backend/launchers.py index bc00c6d..fc0b6c2 100644 --- a/python_source/backend/launchers.py +++ b/python_source/backend/launchers.py @@ -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() diff --git a/python_source/vide_pipeline/__main__.py b/python_source/vide_pipeline/__main__.py index c833ca2..0e6ef0f 100644 --- a/python_source/vide_pipeline/__main__.py +++ b/python_source/vide_pipeline/__main__.py @@ -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!") diff --git a/python_source/vide_pipeline/vide_prepare_simulation.py b/python_source/vide_pipeline/vide_prepare_simulation.py index 8bb1f22..1652870 100644 --- a/python_source/vide_pipeline/vide_prepare_simulation.py +++ b/python_source/vide_pipeline/vide_prepare_simulation.py @@ -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, ))