def test_effvol_uniform_complete():
# Test that the effective volume == A x volume when the completeness == A
comp= 0.33
tsf= gaia_tools.select.tgasSelectUniform(comp=comp)
tesf= gaia_tools.select.tgasEffectiveSelect(tsf)
dxy, dz, zmin= 0.2, 0.1, 0.15
v= tesf.volume(\
lambda x,y,z: cyl_vol_func(x,y,z,xymax=dxy,zmin=zmin,zmax=zmin+dz),
xyz=True)
v_exp= numpy.pi*dxy**2.*dz*comp
assert(numpy.fabs(v/v_exp-1.) < 10.**-3.), 'Effective volume for unit completeness is not equal to the volume'
# Another one
dxy, dz, zmin= 0.2, 0.2, -0.15
v= tesf.volume(\
lambda x,y,z: cyl_vol_func(x,y,z,xymax=dxy,zmin=zmin,zmax=zmin+dz),
xyz=True,ndists=251)
v_exp= numpy.pi*dxy**2.*dz*comp
assert(numpy.fabs(v/v_exp-1.) < 10.**-2.), 'Effective volume for unit completeness is not equal to the volume'
return None
评论列表
文章目录