test_outputs.py 文件源码

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

项目:yt 作者: yt-project 项目源码 文件源码
def test_subhalos():
    ds = data_dir_load(g298)
    total_sub = 0
    total_int = 0
    for hid in range(0, ds.index.particle_count["Group"]):
        my_h = ds.halo("Group", hid)
        h_ids = my_h["ID"]
        for sid in range(int(my_h["subhalo_number"][0])):
            my_s = ds.halo("Subhalo", (my_h.particle_identifier, sid))
            total_sub += my_s["ID"].size
            total_int += np.intersect1d(h_ids, my_s["ID"]).size

    # Test that all subhalo particles are contained within
    # their parent group.
    assert_equal(total_sub, total_int)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号