mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 23:31:12 +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
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue