mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 15:21:11 +00:00
Merge branch 'master' of https://bitbucket.org/cosmicvoids/void_identification
This commit is contained in:
commit
e92d30301b
98 changed files with 22013 additions and 47 deletions
|
@ -624,6 +624,9 @@ def launchStack(sample, stack, binPath, thisDataPortion=None, logDir=None,
|
|||
# periodicLine += "z"
|
||||
# periodicLine += "' "
|
||||
|
||||
launchDir = os.getcwd()
|
||||
os.chdir(voidDir)
|
||||
|
||||
conf="""
|
||||
desc %s
|
||||
partzone %s
|
||||
|
@ -690,6 +693,8 @@ def launchStack(sample, stack, binPath, thisDataPortion=None, logDir=None,
|
|||
fp.write("doExtraction\n")
|
||||
fp.close()
|
||||
|
||||
jobString = " "+runSuffix+":"
|
||||
|
||||
if not (continueRun and jobSuccessful(logFile, "Done!\n")):
|
||||
#cmd = "%s --configFile=%s &> %s" % \
|
||||
# (binPath, parmFile, logFile)
|
||||
|
@ -701,13 +706,13 @@ def launchStack(sample, stack, binPath, thisDataPortion=None, logDir=None,
|
|||
log.close()
|
||||
|
||||
if jobSuccessful(logFile, "Done!\n"):
|
||||
print "done"
|
||||
print jobString, "Stacking voids done"
|
||||
else:
|
||||
print "FAILED!"
|
||||
print jobString, "Stacking voids FAILED!"
|
||||
exit(-1)
|
||||
|
||||
else:
|
||||
print "already done!"
|
||||
print jobString, "Stacking voids already done!"
|
||||
if os.access(parmFile, os.F_OK): os.unlink(parmFile)
|
||||
return
|
||||
|
||||
|
@ -739,7 +744,7 @@ def launchStack(sample, stack, binPath, thisDataPortion=None, logDir=None,
|
|||
os.unlink(voidDir+"/NOVOID")
|
||||
|
||||
if (numVoids == "0"):
|
||||
print " No voids found; skipping!"
|
||||
print jobString, "No voids found; skipping!"
|
||||
fp = open(voidDir+"/NOVOID", "w")
|
||||
fp.write("no voids found\n")
|
||||
fp.close()
|
||||
|
@ -750,7 +755,7 @@ def launchStack(sample, stack, binPath, thisDataPortion=None, logDir=None,
|
|||
if "EMPTY STACK" in line:
|
||||
emptyStack = True
|
||||
if emptyStack:
|
||||
print " Stack is empty; skipping!"
|
||||
print jobString, "Stack is empty; skipping!"
|
||||
fp = open(voidDir+"/NOVOID", "w")
|
||||
fp.write("empty stack\n")
|
||||
fp.close()
|
||||
|
@ -817,30 +822,32 @@ def launchStack(sample, stack, binPath, thisDataPortion=None, logDir=None,
|
|||
fp.write(str(normalization)+"\n")
|
||||
fp.close()
|
||||
|
||||
os.system("mv %s %s" % ("tree.data", treeFile))
|
||||
os.system("mv %s %s" % ("void_indexes.txt", voidDir+"/"))
|
||||
os.system("mv %s %s" % ("posx.nc", voidDir+"/"))
|
||||
os.system("mv %s %s" % ("posy.nc", voidDir+"/"))
|
||||
os.system("mv %s %s" % ("posz.nc", voidDir+"/"))
|
||||
os.system("mv %s %s" % ("z_void_indexes.txt", voidDir+"/"))
|
||||
os.system("mv %s %s" % ("z_posx.nc", voidDir+"/"))
|
||||
os.system("mv %s %s" % ("z_posy.nc", voidDir+"/"))
|
||||
os.system("mv %s %s" % ("z_posz.nc", voidDir+"/"))
|
||||
os.system("mv %s %s" % ("redshifts.nc", voidDir+"/"))
|
||||
os.system("mv %s %s" % ("indexes.nc", voidDir+"/"))
|
||||
os.system("mv %s %s" % ("kdtree_stackvoids.dat", voidDir+"/"))
|
||||
os.system("mv %s %s" % ("centers.txt", voidDir+"/"))
|
||||
os.system("mv %s %s" % ("z_centers.txt", voidDir+"/"))
|
||||
os.system("mv %s %s" % ("sky_positions.txt", voidDir+"/"))
|
||||
os.system("mv %s %s" % ("check.txt", voidDir+"/"))
|
||||
os.system("mv %s %s" % ("tracer.txt", voidDir+"/"))
|
||||
os.system("mv %s %s" % ("normalizations.txt", voidDir+"/"))
|
||||
os.system("mv %s %s" % ("boundaryDistances.txt", voidDir+"/"))
|
||||
#os.system("mv %s %s" % ("tree.data", treeFile))
|
||||
#os.system("mv %s %s" % ("void_indexes.txt", voidDir+"/"))
|
||||
#os.system("mv %s %s" % ("posx.nc", voidDir+"/"))
|
||||
#os.system("mv %s %s" % ("posy.nc", voidDir+"/"))
|
||||
#os.system("mv %s %s" % ("posz.nc", voidDir+"/"))
|
||||
#os.system("mv %s %s" % ("z_void_indexes.txt", voidDir+"/"))
|
||||
#os.system("mv %s %s" % ("z_posx.nc", voidDir+"/"))
|
||||
#os.system("mv %s %s" % ("z_posy.nc", voidDir+"/"))
|
||||
#os.system("mv %s %s" % ("z_posz.nc", voidDir+"/"))
|
||||
#os.system("mv %s %s" % ("redshifts.nc", voidDir+"/"))
|
||||
#os.system("mv %s %s" % ("indexes.nc", voidDir+"/"))
|
||||
#os.system("mv %s %s" % ("kdtree_stackvoids.dat", voidDir+"/"))
|
||||
#os.system("mv %s %s" % ("centers.txt", voidDir+"/"))
|
||||
#os.system("mv %s %s" % ("z_centers.txt", voidDir+"/"))
|
||||
#os.system("mv %s %s" % ("sky_positions.txt", voidDir+"/"))
|
||||
#os.system("mv %s %s" % ("check.txt", voidDir+"/"))
|
||||
#os.system("mv %s %s" % ("tracer.txt", voidDir+"/"))
|
||||
#os.system("mv %s %s" % ("normalizations.txt", voidDir+"/"))
|
||||
#os.system("mv %s %s" % ("boundaryDistances.txt", voidDir+"/"))
|
||||
|
||||
if os.access(idListFile, os.F_OK): os.unlink(idListFile)
|
||||
|
||||
if os.access(parmFile, os.F_OK): os.unlink(parmFile)
|
||||
|
||||
os.chdir(launchDir)
|
||||
|
||||
return
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
@ -851,6 +858,7 @@ def launchCombine(sample, stack, voidDir=None, logFile=None,
|
|||
|
||||
runSuffix = getStackSuffix(stack.zMin, stack.zMax, stack.rMin,
|
||||
stack.rMax, thisDataPortion)
|
||||
jobString = " "+runSuffix+":"
|
||||
|
||||
sys.stdout = open(logFile, 'w')
|
||||
sys.stderr = open(logFile, 'a')
|
||||
|
@ -1076,21 +1084,26 @@ def launchCombine(sample, stack, voidDir=None, logFile=None,
|
|||
sys.stderr = sys.__stderr__
|
||||
|
||||
if jobSuccessful(logFile, "Done!\n"):
|
||||
print "done"
|
||||
print jobString, "Combining stacks done"
|
||||
else:
|
||||
print "FAILED!"
|
||||
print jobString, "Combining stacks FAILED!"
|
||||
exit(-1)
|
||||
|
||||
#else:
|
||||
# print "already done!"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
def launchProfile(sample, stack, voidDir=None, logFile=None, continueRun=None):
|
||||
def launchProfile(sample, stack, voidDir=None, logFile=None, continueRun=None,
|
||||
thisDataPortion=None):
|
||||
|
||||
sampleName = sample.fullName
|
||||
|
||||
runSuffix = getStackSuffix(stack.zMin, stack.zMax, stack.rMin,
|
||||
stack.rMax, thisDataPortion)
|
||||
jobString = " "+runSuffix+":"
|
||||
|
||||
if os.access(voidDir+"/NOVOID", os.F_OK):
|
||||
print "no stack here; skipping!"
|
||||
print jobString, "Profile no stack here; skipping!"
|
||||
return
|
||||
|
||||
numVoids = open(voidDir+"/num_voids.txt", "r").readline()
|
||||
|
@ -1129,13 +1142,13 @@ def launchProfile(sample, stack, voidDir=None, logFile=None, continueRun=None):
|
|||
sys.stderr = sys.__stderr__
|
||||
|
||||
if jobSuccessful(logFile, "Done!\n"):
|
||||
print "done", numVoids
|
||||
print jobString, "Profiling stacks done, (N_v=", numVoids,")"
|
||||
else:
|
||||
print "FAILED!"
|
||||
print jobString, "Profiling stacks FAILED!"
|
||||
exit(-1)
|
||||
|
||||
else:
|
||||
print "already done!"
|
||||
print jobString, "Profiling stacks already done!"
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
@ -1147,14 +1160,16 @@ def launchFit(sample, stack, logFile=None, voidDir=None, figDir=None,
|
|||
runSuffix = getStackSuffix(stack.zMin, stack.zMax, stack.rMin,
|
||||
stack.rMax, thisDataPortion)
|
||||
|
||||
jobString = " "+runSuffix+":"
|
||||
|
||||
if not (continueRun and jobSuccessful(logFile, "Done!\n")):
|
||||
if os.access(voidDir+"/NOVOID", os.F_OK):
|
||||
print "no voids here; skipping!"
|
||||
print jobString, "Fitting no voids here; skipping!"
|
||||
return
|
||||
|
||||
numVoids = int(open(voidDir+"/num_voids.txt", "r").readline())
|
||||
if numVoids < 10:
|
||||
print "not enough voids to fit; skipping!"
|
||||
print jobString, "Fitting not enough voids to fit; skipping!"
|
||||
fp = open(voidDir+"/NOFIT", "w")
|
||||
fp.write("not enough voids: %d \n" % numVoids)
|
||||
fp.close()
|
||||
|
@ -1165,18 +1180,18 @@ def launchFit(sample, stack, logFile=None, voidDir=None, figDir=None,
|
|||
# return
|
||||
|
||||
if sample.partOfCombo or not sample.includeInHubble:
|
||||
print "sample not needed for further analysis; skipping!"
|
||||
print jobString, "Fitting sample not needed for further analysis; skipping!"
|
||||
fp = open(voidDir+"/NOFIT", "w")
|
||||
fp.write("sample not needed for hubble\n")
|
||||
fp.close()
|
||||
return
|
||||
|
||||
if not stack.includeInHubble:
|
||||
print "radius not needed for further analysis; skipping!"
|
||||
print jobString, "Fitting radius not needed for further analysis; skipping!"
|
||||
return
|
||||
|
||||
if not stack.includeInHubble:
|
||||
print "redshift not needed for further analysis; skipping!"
|
||||
print jobString, "Fitting redshift not needed for further analysis; skipping!"
|
||||
return
|
||||
|
||||
if os.access(figDir+"/stackedVoid_"+sampleName+"_"+\
|
||||
|
@ -1241,9 +1256,9 @@ def launchFit(sample, stack, logFile=None, voidDir=None, figDir=None,
|
|||
sys.stdout = sys.__stdout__
|
||||
sys.stderr = sys.__stderr__
|
||||
if jobSuccessful(logFile, "Done!\n"):
|
||||
print "done (", ntries, " tries)"
|
||||
print jobString, "Fitting done (", ntries, " tries)"
|
||||
else:
|
||||
print "FAILED!"
|
||||
print jobString, "Fitting FAILED!"
|
||||
exit(-1)
|
||||
|
||||
# record the measured stretch
|
||||
|
@ -1255,14 +1270,14 @@ def launchFit(sample, stack, logFile=None, voidDir=None, figDir=None,
|
|||
if os.access(voidDir+"/NOFIT", os.F_OK):
|
||||
os.unlink(voidDir+"/NOFIT")
|
||||
if ntries > maxtries:
|
||||
print " No reliable fit found; skipping!"
|
||||
print jobString, " No reliable fit found; skipping!"
|
||||
fp = open(voidDir+"/NOFIT", "w")
|
||||
fp.write("bad ellipticity fit\n")
|
||||
fp.close()
|
||||
return
|
||||
|
||||
else:
|
||||
print "already done!"
|
||||
print jobString, "already done!"
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue