def test_effvol_uniform_complete_partialsky():
# Test that the effective volume == A x volume x sky-fraction when the completeness == A over a fraction of the sky for a spherical volume
comp= 0.33
ramin, ramax= 30., 120.
tsf= gaia_tools.select.tgasSelectUniform(comp=comp,ramin=ramin,ramax=ramax)
tesf= gaia_tools.select.tgasEffectiveSelect(tsf)
dr, rmin= 0.1, 0.
v= tesf.volume(\
lambda x,y,z: spher_vol_func(x,y,z,rmin=rmin,rmax=rmin+dr),
xyz=True,ndists=251)
v_exp= 4.*numpy.pi*dr**3./3.*comp*(ramax-ramin)/360.
assert(numpy.fabs(v/v_exp-1.) < 10.**-2.), 'Effective volume for unit completeness is not equal to the volume'
# Another one
dr, rmin= 0.2, 0.
v= tesf.volume(\
lambda x,y,z: spher_vol_func(x,y,z,rmin=rmin,rmax=rmin+dr),
xyz=True,ndists=501)
v_exp= 4.*numpy.pi*dr**3./3.*comp*(ramax-ramin)/360.
assert(numpy.fabs(v/v_exp-1.) < 10.**-1.9), 'Effective volume for unit completeness is not equal to the volume'
return None
评论列表
文章目录