mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-04 15:21:11 +00:00
big fixes in handling of mag-limited surveys
This commit is contained in:
parent
3be45cffb4
commit
4cf73f3c9a
1 changed files with 12 additions and 8 deletions
|
@ -37,7 +37,7 @@ from netCDF4 import Dataset
|
||||||
from void_python_tools.backend.classes import *
|
from void_python_tools.backend.classes import *
|
||||||
import pickle
|
import pickle
|
||||||
import void_python_tools.apTools as vp
|
import void_python_tools.apTools as vp
|
||||||
import scipy.interpolate
|
import scipy.interpolate as interpolate
|
||||||
|
|
||||||
NetCDFFile = Dataset
|
NetCDFFile = Dataset
|
||||||
ncFloat = 'f8' # Double precision
|
ncFloat = 'f8' # Double precision
|
||||||
|
@ -374,7 +374,7 @@ def launchZobov(sample, binPath, zobovDir=None, logDir=None, continueRun=None,
|
||||||
File.close()
|
File.close()
|
||||||
|
|
||||||
# load redshifts
|
# load redshifts
|
||||||
partFile = sampleDir+"/zobov_slice_"+sample.fullName
|
partFile = zobovDir+"/zobov_slice_"+sample.fullName
|
||||||
File = file(partFile)
|
File = file(partFile)
|
||||||
chk = np.fromfile(File, dtype=np.int32,count=1)
|
chk = np.fromfile(File, dtype=np.int32,count=1)
|
||||||
Np = np.fromfile(File, dtype=np.int32,count=1)
|
Np = np.fromfile(File, dtype=np.int32,count=1)
|
||||||
|
@ -414,16 +414,20 @@ def launchZobov(sample, binPath, zobovDir=None, logDir=None, continueRun=None,
|
||||||
# build selection function interpolation
|
# build selection function interpolation
|
||||||
selfuncData = np.genfromtxt(sample.selFunFile)
|
selfuncData = np.genfromtxt(sample.selFunFile)
|
||||||
selfunc = interpolate.interp1d(selfuncData[:,0], selfuncData[:,1],
|
selfunc = interpolate.interp1d(selfuncData[:,0], selfuncData[:,1],
|
||||||
kind='cubic')
|
kind='cubic', bounds_error=False,
|
||||||
|
fill_value=1.0)
|
||||||
# re-weight and write
|
# re-weight and write
|
||||||
vols *= selfunc(redshifts)
|
## TEST
|
||||||
|
#redshifts /= 10000.
|
||||||
|
for i in xrange(len(vols)):
|
||||||
|
vols[i] *= selfunc(redshifts[i])
|
||||||
|
|
||||||
volFile = zobovDir+"/vol_"+sampleName+".dat"
|
volFile = zobovDir+"/vol_weighted_"+sampleName+".dat"
|
||||||
File = file(volFile, 'w')
|
File = file(volFile, 'w')
|
||||||
chk.astype('np.int32').tofile(File)
|
numPartTot.astype(np.int32).tofile(File)
|
||||||
vols.astype('np.float32').tofile(File)
|
vols.astype(np.float32).tofile(File)
|
||||||
|
|
||||||
volFileToUse = zobovDir+"/vol_weighted"+sampleName+".dat"
|
volFileToUse = zobovDir+"/vol_weighted_"+sampleName+".dat"
|
||||||
else:
|
else:
|
||||||
volFileToUse = zobovDir+"/vol_"+sampleName+".dat"
|
volFileToUse = zobovDir+"/vol_"+sampleName+".dat"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue