mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 15:21:11 +00:00
central density calculation now uses correct normalization from survey volume
This commit is contained in:
parent
96a3ee422f
commit
5bff8c0da3
5 changed files with 67 additions and 55 deletions
2
external/external_build.cmake
vendored
2
external/external_build.cmake
vendored
|
@ -40,7 +40,7 @@ IF(INTERNAL_NETCDF)
|
||||||
ENDIF(INTERNAL_NETCDF)
|
ENDIF(INTERNAL_NETCDF)
|
||||||
|
|
||||||
IF(INTERNAL_BOOST)
|
IF(INTERNAL_BOOST)
|
||||||
SET(BOOST_URL "https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz" CACHE STRING "URL to download Boost from")
|
SET(BOOST_URL "https://archives.boost.io/release/1.76.0/source/boost_1_76_0.tar.gz" CACHE STRING "URL to download Boost from")
|
||||||
mark_as_advanced(BOOST_URL)
|
mark_as_advanced(BOOST_URL)
|
||||||
ELSE(INTERNAL_BOOST)
|
ELSE(INTERNAL_BOOST)
|
||||||
find_package(Boost 1.74.0 COMPONENTS format spirit phoenix python FATAL_ERROR)
|
find_package(Boost 1.74.0 COMPONENTS format spirit phoenix python FATAL_ERROR)
|
||||||
|
|
|
@ -88,6 +88,8 @@ class Sample:
|
||||||
includeInHubble = True
|
includeInHubble = True
|
||||||
partOfCombo = False
|
partOfCombo = False
|
||||||
isCombo = False
|
isCombo = False
|
||||||
|
volNormZobov = 0
|
||||||
|
volNormObs = 0
|
||||||
|
|
||||||
comboList = []
|
comboList = []
|
||||||
|
|
||||||
|
|
|
@ -608,6 +608,8 @@ def launchPrune(sample, binPath,
|
||||||
else:
|
else:
|
||||||
minRadius = sample.minVoidRadius
|
minRadius = sample.minVoidRadius
|
||||||
|
|
||||||
|
volNormZobov, volNormObs = getVolNorm(sample)
|
||||||
|
|
||||||
if not (continueRun and (jobSuccessful(logFile, "NetCDF: Not a valid ID\n") \
|
if not (continueRun and (jobSuccessful(logFile, "NetCDF: Not a valid ID\n") \
|
||||||
or jobSuccessful(logFile, "Done!\n"))):
|
or jobSuccessful(logFile, "Done!\n"))):
|
||||||
cmd = binPath
|
cmd = binPath
|
||||||
|
@ -626,6 +628,8 @@ def launchPrune(sample, binPath,
|
||||||
cmd += volFileLine
|
cmd += volFileLine
|
||||||
cmd += useComovingFlag
|
cmd += useComovingFlag
|
||||||
cmd += " --omegaM=" + str(sample.omegaM)
|
cmd += " --omegaM=" + str(sample.omegaM)
|
||||||
|
cmd += " --volNormZobov=" + str(volNormZobov)
|
||||||
|
cmd += " --volNormObs=" + str(volNormObs)
|
||||||
cmd += " --outputDir=" + outputDir
|
cmd += " --outputDir=" + outputDir
|
||||||
cmd += " --sampleName=" + str(sampleName)
|
cmd += " --sampleName=" + str(sampleName)
|
||||||
log = open(logFile, 'w')
|
log = open(logFile, 'w')
|
||||||
|
|
|
@ -27,7 +27,11 @@ import os
|
||||||
from backend import *
|
from backend import *
|
||||||
from backend.cosmologyTools import *
|
from backend.cosmologyTools import *
|
||||||
|
|
||||||
__all__=['getSurveyProps', 'getNside', 'figureOutMask', 'findEdgeGalaxies']
|
from netCDF4 import Dataset
|
||||||
|
NetCDFFile = Dataset
|
||||||
|
ncFloat = 'f8'
|
||||||
|
|
||||||
|
__all__=['getSurveyProps', 'getVolNorm', 'getNside', 'figureOutMask', 'findEdgeGalaxies']
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# returns the survey volume and scaled galaxy density for a given redshit slice
|
# returns the survey volume and scaled galaxy density for a given redshit slice
|
||||||
|
@ -93,6 +97,60 @@ def getSurveyProps(sample):
|
||||||
return (volume, nbar)
|
return (volume, nbar)
|
||||||
|
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# returns the volume normalization factors:
|
||||||
|
# normalization used by zobov (assumes cubmic volume)
|
||||||
|
# normalization used in galaxy survey volume for observations
|
||||||
|
def getVolNorm(sample):
|
||||||
|
|
||||||
|
sampleDir = sample.outputDir
|
||||||
|
|
||||||
|
infoFile = sampleDir+"/zobov_slice_"+sample.fullName+".par"
|
||||||
|
File = NetCDFFile(infoFile, 'r')
|
||||||
|
ranges = np.zeros((3,2))
|
||||||
|
ranges[0][0] = getattr(File, 'range_x_min')
|
||||||
|
ranges[0][1] = getattr(File, 'range_x_max')
|
||||||
|
ranges[1][0] = getattr(File, 'range_y_min')
|
||||||
|
ranges[1][1] = getattr(File, 'range_y_max')
|
||||||
|
ranges[2][0] = getattr(File, 'range_z_min')
|
||||||
|
ranges[2][1] = getattr(File, 'range_z_max')
|
||||||
|
isObservation = getattr(File, 'is_observation')
|
||||||
|
File.close()
|
||||||
|
mul = np.zeros((3))
|
||||||
|
mul[:] = ranges[:,1] - ranges[:,0]
|
||||||
|
|
||||||
|
# getting the total number of tracers is an adventure depending
|
||||||
|
# on which verison of VIDE we're pulling up
|
||||||
|
maskIndexFile = sampleDir+"/mask_index.txt"
|
||||||
|
totalPartFile = sampleDir+"/total_particles.txt"
|
||||||
|
|
||||||
|
if os.path.exists(maskIndexFile):
|
||||||
|
nTot = float(open(totalPartFile, "r").read())
|
||||||
|
nGal = float(open(maskIndexFile, "r").read())
|
||||||
|
else:
|
||||||
|
nTot = float(open(totalPartFile, "r").read())
|
||||||
|
nGal = nTot
|
||||||
|
|
||||||
|
boxLen = mul
|
||||||
|
|
||||||
|
boxVol = np.prod(boxLen)
|
||||||
|
volNormZobov = nTot/boxVol
|
||||||
|
volNormObs = volNormZobov
|
||||||
|
|
||||||
|
if isObservation == 1:
|
||||||
|
if os.access(sample.maskFile, os.F_OK):
|
||||||
|
maskFile = sample.maskFile
|
||||||
|
else:
|
||||||
|
maskFile = sampleDir+"/"+os.path.basename(sample.maskFile)
|
||||||
|
print("Using maskfile found in: " + maskFile)
|
||||||
|
|
||||||
|
props = getSurveyProps(sample)
|
||||||
|
surveyVol = props[0]
|
||||||
|
volNormObs = nGal/surveyVol
|
||||||
|
|
||||||
|
return volNormZobov, volNormObs
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# returns the nside resolution from the given maskfile
|
# returns the nside resolution from the given maskfile
|
||||||
def getNside(maskFile):
|
def getNside(maskFile):
|
||||||
|
|
|
@ -126,58 +126,6 @@ def loadPart(sampleDir):
|
||||||
|
|
||||||
return partData, boxLen, volNorm, isObservationData, ranges, extraData
|
return partData, boxLen, volNorm, isObservationData, ranges, extraData
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
def getVolNorm(sampleDir):
|
|
||||||
with open(sampleDir+"/sample_info.dat", 'rb') as input:
|
|
||||||
sample = pickle.load(input)
|
|
||||||
|
|
||||||
infoFile = sampleDir+"/zobov_slice_"+sample.fullName+".par"
|
|
||||||
File = NetCDFFile(infoFile, 'r')
|
|
||||||
ranges = np.zeros((3,2))
|
|
||||||
ranges[0][0] = getattr(File, 'range_x_min')
|
|
||||||
ranges[0][1] = getattr(File, 'range_x_max')
|
|
||||||
ranges[1][0] = getattr(File, 'range_y_min')
|
|
||||||
ranges[1][1] = getattr(File, 'range_y_max')
|
|
||||||
ranges[2][0] = getattr(File, 'range_z_min')
|
|
||||||
ranges[2][1] = getattr(File, 'range_z_max')
|
|
||||||
isObservation = getattr(File, 'is_observation')
|
|
||||||
File.close()
|
|
||||||
mul = np.zeros((3))
|
|
||||||
mul[:] = ranges[:,1] - ranges[:,0]
|
|
||||||
|
|
||||||
# getting the total number of tracers is an adventure depending
|
|
||||||
# on which verison of VIDE we're pulling up
|
|
||||||
maskIndexFile = sampleDir+"/mask_index.txt"
|
|
||||||
totalPartFile = sampleDir+"/total_particles.txt"
|
|
||||||
|
|
||||||
if os.path.exists(maskIndexFile):
|
|
||||||
nTot = float(open(totalPartFile, "r").read())
|
|
||||||
nGal = float(open(maskIndexFile, "r").read())
|
|
||||||
else:
|
|
||||||
nTot = float(open(totalPartFile, "r").read())
|
|
||||||
nGal = nTot
|
|
||||||
|
|
||||||
boxLen = mul
|
|
||||||
|
|
||||||
boxVol = np.prod(boxLen)
|
|
||||||
volNormZobov = nTot/boxVol
|
|
||||||
volNormObs = volNormZobov
|
|
||||||
|
|
||||||
if isObservation == 1:
|
|
||||||
if os.access(sample.maskFile, os.F_OK):
|
|
||||||
maskFile = sample.maskFile
|
|
||||||
else:
|
|
||||||
maskFile = sampleDir+"/"+os.path.basename(sample.maskFile)
|
|
||||||
print("Using maskfile found in: " + maskFile)
|
|
||||||
|
|
||||||
|
|
||||||
props = getSurveyProps(sample)
|
|
||||||
surveyVol = props[0]
|
|
||||||
volNormObs = nGal/surveyVol
|
|
||||||
|
|
||||||
return volNormZobov, volNormObs
|
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
def loadPartVel(sampleDir):
|
def loadPartVel(sampleDir):
|
||||||
#print " Loading particle velocities..."
|
#print " Loading particle velocities..."
|
||||||
|
@ -356,7 +304,7 @@ def loadVoidCatalog(sampleDir,
|
||||||
catalog.ranges = ranges
|
catalog.ranges = ranges
|
||||||
File.close()
|
File.close()
|
||||||
|
|
||||||
volNormZobov, volNormObs = getVolNorm(sampleDir)
|
volNormZobov, volNormObs = getVolNorm(sample)
|
||||||
catalog.volNormZobov = volNormZobov
|
catalog.volNormZobov = volNormZobov
|
||||||
catalog.volNormObs = volNormObs
|
catalog.volNormObs = volNormObs
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue