prepared for magnitude-limited samples

This commit is contained in:
P.M. Sutter 2014-05-21 19:07:57 -05:00
parent 24e62450a8
commit 56b837899b
5 changed files with 18 additions and 15 deletions

View file

@ -25,19 +25,23 @@ import void_python_tools as ct
__all__=['getSurveyProps']
# returns the volume and galaxy density for a given redshit slice
def getSurveyProps(maskFile, zmin, zmax, selFunMin, selFunMax, portion, selectionFuncFile=None, useLCDM=False):
def getSurveyProps(maskFile, zmin, zmax, selFunMin, selFunMax, portion, selectionFuncFile=None, useComoving=False):
LIGHT_SPEED = 299792.458
mask = healpy.read_map(maskFile)
area = (1.*np.size(np.where(mask > 0)) / np.size(mask)) * 4.*np.pi
if useLCDM:
if useComoving:
zmin = LIGHT_SPEED/100.*ct.angularDiameter(zmin, Om=0.27)
zmax = LIGHT_SPEED/100.*ct.angularDiameter(zmax, Om=0.27)
selFunMin = LIGHT_SPEED/100.*ct.angularDiameter(selFunMin, Om=0.27)
selFunMax = LIGHT_SPEED/100.*ct.angularDiameter(selFunMax, Om=0.27)
else:
zmin = zmin * 3000
zmax = zmax * 3000
selFunMin *= 3000
selFunMax *= 3000
volume = area * (zmax**3 - zmin**3) / 3
if selectionFuncFile != None:
@ -51,9 +55,6 @@ def getSurveyProps(maskFile, zmin, zmax, selFunMin, selFunMax, portion, selectio
selfuncDx = selfunc[1,0] - selfunc[0,0]
selfuncN = np.size(selfunc[:,0])
selFunMin *= 3000
selFunMax *= 3000
selFunMin = max(selFunMin, selfuncMin)
selFunMax = min(selFunMax, selfuncMax)
@ -67,7 +68,6 @@ def getSurveyProps(maskFile, zmin, zmax, selFunMin, selFunMax, portion, selectio
nbar = nbar[0]
ntotal = scipy.integrate.quad(fTotal, 0.0, max(selfuncUnity[:,0]))
#ntotal = scipy.integrate.quad(f, 0.0, max(selfunc[:,0]))
ntotal = ntotal[0]
nbar = ntotal / area / nbar

View file

@ -68,7 +68,6 @@ class Sample:
zobovDir = ""
maskFile = "rast_window_512.fits"
selFunFile = "czselfunc.all.dr72dim.dat"
skyFraction = 0.19
zBoundary = (0.0, 0.1)
zBoundaryMpc = (0., 300)
zRange = (0.0, 0.1)
@ -101,7 +100,7 @@ class Sample:
minVoidRadius=-1, fakeDensity=0.01, volumeLimited=True,
numAPSlices=1,
includeInHubble=True, partOfCombo=False, isCombo=False,
comboList=(), profileBinSize=2.0, skyFraction=0.19,
comboList=(), profileBinSize=2.0,
boxLen=1024, usePecVel=False, omegaM=0.27,
numSubvolumes=1, mySubvolume=1, dataFormat="sdss",
useComoving=True,
@ -126,7 +125,6 @@ class Sample:
self.numAPSlices = numAPSlices
self.zobovDir = None
self.profileBinSize = profileBinSize
self.skyFraction = skyFraction
self.dataType = dataType
self.boxLen = boxLen
self.usePecVel = usePecVel

View file

@ -269,7 +269,7 @@ def launchGenerate(sample, binPath, workDir=None, inputDataDir=None,
numTracers = int(open(zobovDir+"/mask_index.txt", "r").read())
numTotal = int(open(zobovDir+"/total_particles.txt", "r").read())
meanSep = (1.*numTracers/boxVol)**(-1/3.)
meanSep = (1.*numTracers/boxVol/nbar)**(-1/3.)
# save this sample's information
with open(zobovDir+"/sample_info.dat", 'w') as output:

View file

@ -106,7 +106,8 @@ def loadPart(sampleDir):
sample.zBoundary[1],
sample.zBoundary[0],
sample.zBoundary[1], "all",
useLCDM=sample.useComoving)
selectionFuncFile=sample.selFunFile,
useComoving=sample.useComoving)
boxVol = props[0]
volNorm = maskIndex/boxVol
else:
@ -156,7 +157,8 @@ def getVolNorm(sampleDir):
sample.zBoundary[1],
sample.zBoundary[0],
sample.zBoundary[1], "all",
useLCDM=sample.useComoving)
selectionFuncFile=sample.selFunFile,
useComoving=sample.useComoving)
boxVol = props[0]
volNorm = maskIndex/boxVol
else: