test_tgasSelect.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:gaia_tools 作者: jobovy 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号