diff --git a/external/external_build.cmake b/external/external_build.cmake index df13071..0abb8f7 100644 --- a/external/external_build.cmake +++ b/external/external_build.cmake @@ -40,7 +40,7 @@ IF(INTERNAL_NETCDF) ENDIF(INTERNAL_NETCDF) 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) ELSE(INTERNAL_BOOST) find_package(Boost 1.74.0 COMPONENTS format spirit phoenix python FATAL_ERROR) diff --git a/python_source/backend/classes.py b/python_source/backend/classes.py index 732c720..b42bccf 100644 --- a/python_source/backend/classes.py +++ b/python_source/backend/classes.py @@ -88,6 +88,8 @@ class Sample: includeInHubble = True partOfCombo = False isCombo = False + volNormZobov = 0 + volNormObs = 0 comboList = [] diff --git a/python_source/backend/launchers.py b/python_source/backend/launchers.py index fd40b97..380a65c 100644 --- a/python_source/backend/launchers.py +++ b/python_source/backend/launchers.py @@ -608,6 +608,8 @@ def launchPrune(sample, binPath, else: minRadius = sample.minVoidRadius + volNormZobov, volNormObs = getVolNorm(sample) + if not (continueRun and (jobSuccessful(logFile, "NetCDF: Not a valid ID\n") \ or jobSuccessful(logFile, "Done!\n"))): cmd = binPath @@ -626,6 +628,8 @@ def launchPrune(sample, binPath, cmd += volFileLine cmd += useComovingFlag cmd += " --omegaM=" + str(sample.omegaM) + cmd += " --volNormZobov=" + str(volNormZobov) + cmd += " --volNormObs=" + str(volNormObs) cmd += " --outputDir=" + outputDir cmd += " --sampleName=" + str(sampleName) log = open(logFile, 'w') diff --git a/python_source/backend/surveyTools.py b/python_source/backend/surveyTools.py index 22fe628..45cee42 100644 --- a/python_source/backend/surveyTools.py +++ b/python_source/backend/surveyTools.py @@ -27,7 +27,11 @@ import os from backend 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 @@ -93,6 +97,60 @@ def getSurveyProps(sample): 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 def getNside(maskFile): diff --git a/python_source/voidUtil/catalogUtil.py b/python_source/voidUtil/catalogUtil.py index 2dd5f5a..46dd523 100644 --- a/python_source/voidUtil/catalogUtil.py +++ b/python_source/voidUtil/catalogUtil.py @@ -126,58 +126,6 @@ def loadPart(sampleDir): 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): #print " Loading particle velocities..." @@ -356,7 +304,7 @@ def loadVoidCatalog(sampleDir, catalog.ranges = ranges File.close() - volNormZobov, volNormObs = getVolNorm(sampleDir) + volNormZobov, volNormObs = getVolNorm(sample) catalog.volNormZobov = volNormZobov catalog.volNormObs = volNormObs