mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 15:21:11 +00:00
bug fixed related to different boundary handling procedure. no guarantee that it's correct (yet) but it runs
This commit is contained in:
parent
03c8f773b6
commit
dd181da42a
6 changed files with 40 additions and 36 deletions
|
@ -290,7 +290,7 @@ void generateSurfaceMask(prepObservation_info& args ,
|
||||||
volume *= Rmax*Rmax*Rmax/3/1e6;
|
volume *= Rmax*Rmax*Rmax/3/1e6;
|
||||||
numToInsert = (int)floor(volume*args.density_fake_arg);
|
numToInsert = (int)floor(volume*args.density_fake_arg);
|
||||||
// TEST NOT USING MOCK PARTICLES
|
// TEST NOT USING MOCK PARTICLES
|
||||||
numToIntsert = 0
|
numToInsert = 0;
|
||||||
// END TEST
|
// END TEST
|
||||||
cout << format("3d volume to fill: %g (Mpc/h)^3") % volume << endl;
|
cout << format("3d volume to fill: %g (Mpc/h)^3") % volume << endl;
|
||||||
|
|
||||||
|
|
|
@ -67,8 +67,9 @@ class Sample:
|
||||||
dataUnit = 1
|
dataUnit = 1
|
||||||
fullName = "lss.dr72dim.dat"
|
fullName = "lss.dr72dim.dat"
|
||||||
nickName = "dim"
|
nickName = "dim"
|
||||||
zobovDir = ""
|
outputDir = ""
|
||||||
maskFile = "rast_window_512.fits"
|
maskFile = "rast_window_512.fits"
|
||||||
|
nsideForMask = 128
|
||||||
selFunFile = "czselfunc.all.dr72dim.dat"
|
selFunFile = "czselfunc.all.dr72dim.dat"
|
||||||
zBoundary = (0.0, 0.1)
|
zBoundary = (0.0, 0.1)
|
||||||
zBoundaryMpc = (0., 300)
|
zBoundaryMpc = (0., 300)
|
||||||
|
@ -98,7 +99,7 @@ class Sample:
|
||||||
stacks = []
|
stacks = []
|
||||||
|
|
||||||
def __init__(self, dataFile="", fullName="", dataUnit=1,
|
def __init__(self, dataFile="", fullName="", dataUnit=1,
|
||||||
nickName="", maskFile="", selFunFile="",
|
nickName="", maskFile="", nsideForMask=128, selFunFile="",
|
||||||
zBoundary=(), zRange=(), zBoundaryMpc=(), shiftSimZ=False,
|
zBoundary=(), zRange=(), zBoundaryMpc=(), shiftSimZ=False,
|
||||||
minVoidRadius=-1, fakeDensity=0.01, volumeLimited=True,
|
minVoidRadius=-1, fakeDensity=0.01, volumeLimited=True,
|
||||||
numAPSlices=1,
|
numAPSlices=1,
|
||||||
|
@ -114,6 +115,7 @@ class Sample:
|
||||||
self.fullName = fullName
|
self.fullName = fullName
|
||||||
self.nickName = nickName
|
self.nickName = nickName
|
||||||
self.maskFile = maskFile
|
self.maskFile = maskFile
|
||||||
|
self.nsideForMask = nsideForMask
|
||||||
self.selFunFile = selFunFile
|
self.selFunFile = selFunFile
|
||||||
self.zBoundary = zBoundary
|
self.zBoundary = zBoundary
|
||||||
self.zBoundaryMpc = zBoundaryMpc
|
self.zBoundaryMpc = zBoundaryMpc
|
||||||
|
@ -127,7 +129,7 @@ class Sample:
|
||||||
self.isCombo = isCombo
|
self.isCombo = isCombo
|
||||||
self.comboList = comboList
|
self.comboList = comboList
|
||||||
self.numAPSlices = numAPSlices
|
self.numAPSlices = numAPSlices
|
||||||
self.zobovDir = None
|
self.outputDir = None
|
||||||
self.profileBinSize = profileBinSize
|
self.profileBinSize = profileBinSize
|
||||||
self.dataType = dataType
|
self.dataType = dataType
|
||||||
self.boxLen = boxLen
|
self.boxLen = boxLen
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import scipy.integrate as integrate
|
import scipy.integrate as integrate
|
||||||
import os
|
import os
|
||||||
from backend import *
|
#from backend import *
|
||||||
|
|
||||||
__all__=['expansion', 'comovingDistance', 'aveExpansion']
|
__all__=['expansion', 'comovingDistance', 'aveExpansion']
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ def launchPrep(sample, binPath, workDir=None, inputDataDir=None,
|
||||||
sampleName = sample.fullName
|
sampleName = sample.fullName
|
||||||
|
|
||||||
if regenerate:
|
if regenerate:
|
||||||
inputParameterFlag = "inputParameter " + outputDir +
|
inputParameterFlag = "inputParameter " + outputDir + \
|
||||||
"/zobov_slice_"+sampleName+".par"
|
"/zobov_slice_"+sampleName+".par"
|
||||||
outputFile = outputDir + "/regenerated_zobov_slice_" + sampleName
|
outputFile = outputDir + "/regenerated_zobov_slice_" + sampleName
|
||||||
else:
|
else:
|
||||||
|
@ -67,14 +67,12 @@ def launchPrep(sample, binPath, workDir=None, inputDataDir=None,
|
||||||
datafile = inputDataDir+"/"+sample.dataFile
|
datafile = inputDataDir+"/"+sample.dataFile
|
||||||
|
|
||||||
if sample.maskFile == "":
|
if sample.maskFile == "":
|
||||||
maskFile = outputDir + "/constructed_mask.fits"
|
sample.maskFile = outputDir + "/constructed_mask.fits"
|
||||||
figureOutMask(dataFile, sample.nsideForMask, maskFile)
|
figureOutMask(datafile, sample.nsideForMask, sample.maskFile)
|
||||||
else:
|
|
||||||
maskFile = sample.maskFile
|
|
||||||
|
|
||||||
edgeGalFile = outputDir + "/galaxy_edge_flags.txt"
|
edgeGalFile = outputDir + "/galaxy_edge_flags.txt"
|
||||||
edgeMaskFile = outputDir + "/mask_edge_map.fits"
|
edgeMaskFile = outputDir + "/mask_edge_map.fits"
|
||||||
findEdgeGalaxies(dataFile, maskFile, edgeGalFile, edgeMaskFile,
|
findEdgeGalaxies(datafile, sample.maskFile, edgeGalFile, edgeMaskFile,
|
||||||
sample.zBoundary[0], sample.zBoundary[1], sample.omegaM,
|
sample.zBoundary[0], sample.zBoundary[1], sample.omegaM,
|
||||||
useComoving)
|
useComoving)
|
||||||
|
|
||||||
|
@ -94,7 +92,7 @@ def launchPrep(sample, binPath, workDir=None, inputDataDir=None,
|
||||||
%s
|
%s
|
||||||
%s
|
%s
|
||||||
omegaM %g
|
omegaM %g
|
||||||
""" % (datafile, maskFile, outputFile,
|
""" % (datafile, sample.maskFile, outputFile,
|
||||||
outputDir+"/zobov_slice_"+sampleName+".par",
|
outputDir+"/zobov_slice_"+sampleName+".par",
|
||||||
sample.zBoundary[0], sample.zBoundary[1], sample.fakeDensity,
|
sample.zBoundary[0], sample.zBoundary[1], sample.fakeDensity,
|
||||||
useComovingFlag, inputParameterFlag, sample.omegaM)
|
useComovingFlag, inputParameterFlag, sample.omegaM)
|
||||||
|
|
|
@ -24,6 +24,7 @@ import numpy as np
|
||||||
import healpy as healpy
|
import healpy as healpy
|
||||||
import os
|
import os
|
||||||
from backend import *
|
from backend import *
|
||||||
|
from backend.cosmologyTools import *
|
||||||
|
|
||||||
__all__=['getSurveyProps', 'getNside', 'figureOutMask', 'findEdgeGalaxies']
|
__all__=['getSurveyProps', 'getNside', 'figureOutMask', 'findEdgeGalaxies']
|
||||||
|
|
||||||
|
@ -44,6 +45,8 @@ def getSurveyProps(maskFile, zmin, zmax, selFunMin, selFunMax, portion,
|
||||||
zmin = zmin * LIGHT_SPEED/100.
|
zmin = zmin * LIGHT_SPEED/100.
|
||||||
zmax = zmax * LIGHT_SPEED/100.
|
zmax = zmax * LIGHT_SPEED/100.
|
||||||
|
|
||||||
|
volume = area * (zmax**3 - zmin**3) / 3
|
||||||
|
|
||||||
if selectionFuncFile == None:
|
if selectionFuncFile == None:
|
||||||
nbar = 1.0
|
nbar = 1.0
|
||||||
|
|
||||||
|
@ -119,7 +122,7 @@ def figureOutMask(galFile, nside, outMaskFile):
|
||||||
pix = healpy.ang2pix(nside, theta, phi)
|
pix = healpy.ang2pix(nside, theta, phi)
|
||||||
mask[pix] = 1.
|
mask[pix] = 1.
|
||||||
|
|
||||||
healpy.write_map(outMaskFile, mask, overwrite=True)
|
healpy.write_map(outMaskFile, mask, overwrite=True, dtype=np.dtype('float64'))
|
||||||
|
|
||||||
return mask
|
return mask
|
||||||
|
|
||||||
|
@ -129,12 +132,12 @@ def figureOutMask(galFile, nside, outMaskFile):
|
||||||
def findEdgeGalaxies(galFile, maskFile, edgeGalFile, edgeMaskFile,
|
def findEdgeGalaxies(galFile, maskFile, edgeGalFile, edgeMaskFile,
|
||||||
zmin, zmax, omegaM, useComoving=False):
|
zmin, zmax, omegaM, useComoving=False):
|
||||||
|
|
||||||
if useComoving:
|
#if useComoving:
|
||||||
zmin = LIGHT_SPEED/100.*comovingDistance(zmin, Om=omegaM)
|
# zmin = LIGHT_SPEED/100.*comovingDistance(zmin, Om=omegaM)
|
||||||
zmax = LIGHT_SPEED/100.*comovingDistance(zmax, Om=omegaM)
|
# zmax = LIGHT_SPEED/100.*comovingDistance(zmax, Om=omegaM)
|
||||||
else:
|
#else:
|
||||||
zmin *= LIGHT_SPEED/100.
|
# zmin *= LIGHT_SPEED/100.
|
||||||
zmax *= LIGHT_SPEED/100.
|
# zmax *= LIGHT_SPEED/100.
|
||||||
|
|
||||||
|
|
||||||
mask = healpy.read_map(maskFile)
|
mask = healpy.read_map(maskFile)
|
||||||
|
@ -151,32 +154,33 @@ def findEdgeGalaxies(galFile, maskFile, edgeGalFile, edgeMaskFile,
|
||||||
z = float(line[5])
|
z = float(line[5])
|
||||||
|
|
||||||
if useComoving:
|
if useComoving:
|
||||||
z = LIGHT_SPEED/100.*comovingDistance(z, Om=omegaM)
|
z = comovingDistance(z/LIGHT_SPEED, Om=omegaM)
|
||||||
else:
|
else:
|
||||||
z *= LIGHT_SPEED/100.
|
z *= LIGHT_SPEED/100.
|
||||||
|
|
||||||
phi, theta = convertAngle(RA, Dec)
|
phi, theta = convertAngle(RA, Dec)
|
||||||
|
|
||||||
# check the mask edges
|
# check the mask edges
|
||||||
neighbors = healpy.get_all_neighbors(nside, theta, phi)
|
neighbors = healpy.get_all_neighbours(nside, theta, phi)
|
||||||
isOnMaskEdge = any(p == 0 for p in neighbors)
|
isOnMaskEdge = any(p == 0 for p in neighbors)
|
||||||
|
|
||||||
# check the redshift boundaries
|
# check the redshift boundaries
|
||||||
tol = 0.01 # TODO: made this user-adjustable
|
tol = 0.01 # TODO: made this user-adjustable
|
||||||
zBuffer = (zmax-zmin)*tol
|
zbuffer = (zmax-zmin)*tol
|
||||||
isOnHighZEdge = (z >= zmax-buffer)
|
isOnHighZEdge = (z >= zmax-zbuffer)
|
||||||
isOnLowZEdge = (z <= zmin+buffer)
|
isOnLowZEdge = (z <= zmin+zbuffer)
|
||||||
|
|
||||||
|
print("DOING %f %f %f %f\n" % (zbuffer, z, zmax, zmin) )
|
||||||
if isOnMaskEdge:
|
if isOnMaskEdge:
|
||||||
edgeFile.write("1")
|
edgeFile.write("1\n")
|
||||||
elif isOnHighZEdge:
|
elif isOnHighZEdge:
|
||||||
edgeFile.write("2")
|
edgeFile.write("2\n")
|
||||||
elif isOnLowZEdge:
|
elif isOnLowZEdge:
|
||||||
edgeFile.write("3")
|
edgeFile.write("3\n")
|
||||||
else:
|
else:
|
||||||
edgeFile.write("0")
|
edgeFile.write("0\n")
|
||||||
|
|
||||||
edgeFile.close()
|
edgeFile.close()
|
||||||
healpy.write_map(edgeMaskFile, edgeMask, overwrite=True)
|
healpy.write_map(edgeMaskFile, edgeMask, overwrite=True, dtype=np.dtype('float64'))
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
|
@ -75,11 +75,11 @@ for sample in dataSampleList:
|
||||||
sampleName = sample.fullName
|
sampleName = sample.fullName
|
||||||
|
|
||||||
print(" Working with data set", sampleName, "...")
|
print(" Working with data set", sampleName, "...")
|
||||||
zobovDir = workDir+"/sample_"+sampleName+"/"
|
outputDir = workDir+"/sample_"+sampleName+"/"
|
||||||
sample.zobovDir = zobovDir
|
sample.outputDir = outputDir
|
||||||
|
|
||||||
if not os.access(zobovDir, os.F_OK):
|
if not os.access(outputDir, os.F_OK):
|
||||||
os.makedirs(zobovDir)
|
os.makedirs(outputDir)
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
if (startCatalogStage <= 1) and (endCatalogStage >= 1) and not sample.isCombo:
|
if (startCatalogStage <= 1) and (endCatalogStage >= 1) and not sample.isCombo:
|
||||||
|
@ -94,7 +94,7 @@ for sample in dataSampleList:
|
||||||
GENERATE_PATH = CTOOLS_PATH+"/prepSimulation"
|
GENERATE_PATH = CTOOLS_PATH+"/prepSimulation"
|
||||||
|
|
||||||
launchPrep(sample, GENERATE_PATH, workDir=workDir,
|
launchPrep(sample, GENERATE_PATH, workDir=workDir,
|
||||||
inputDataDir=inputDataDir, zobovDir=zobovDir,
|
inputDataDir=inputDataDir, outputDir=outputDir,
|
||||||
figDir=figDir, logFile=logFile, useComoving=sample.useComoving,
|
figDir=figDir, logFile=logFile, useComoving=sample.useComoving,
|
||||||
continueRun=continueRun, regenerate=regenerateFlag)
|
continueRun=continueRun, regenerate=regenerateFlag)
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ for sample in dataSampleList:
|
||||||
print(" Extracting voids with ZOBOV...", end=' ')
|
print(" Extracting voids with ZOBOV...", end=' ')
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
launchZobov(sample, ZOBOV_PATH, zobovDir=zobovDir, logDir=logDir,
|
launchZobov(sample, ZOBOV_PATH, outputDir=outputDir, logDir=logDir,
|
||||||
continueRun=continueRun, numZobovDivisions=numZobovDivisions,
|
continueRun=continueRun, numZobovDivisions=numZobovDivisions,
|
||||||
numZobovThreads=numZobovThreads,
|
numZobovThreads=numZobovThreads,
|
||||||
mergingThreshold=mergingThreshold)
|
mergingThreshold=mergingThreshold)
|
||||||
|
@ -119,7 +119,7 @@ for sample in dataSampleList:
|
||||||
PRUNE_PATH = CTOOLS_PATH+"/pruneVoids"
|
PRUNE_PATH = CTOOLS_PATH+"/pruneVoids"
|
||||||
|
|
||||||
launchPrune(sample, PRUNE_PATH,
|
launchPrune(sample, PRUNE_PATH,
|
||||||
logFile=logFile, zobovDir=zobovDir,
|
logFile=logFile, outputDir=outputDir,
|
||||||
useComoving=sample.useComoving, continueRun=continueRun,
|
useComoving=sample.useComoving, continueRun=continueRun,
|
||||||
mergingThreshold=mergingThreshold,
|
mergingThreshold=mergingThreshold,
|
||||||
boundaryTolerance=boundaryTolerance)
|
boundaryTolerance=boundaryTolerance)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue