test_tgasSelect.py 文件源码

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

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


问题


面经


文章

微信
公众号

扫码关注公众号