

def make_test_file(prefix='/tmp'):
    f = tables.open_file(os.path.join(prefix, 'test_pttree.hdf5'), 'w')
    g1 = f.create_group('/', 'group1')
    g1a = f.create_group(g1, 'group1a')
    g1b = f.create_group(g1, 'group1b')
    filters = tables.Filters(complevel=5, complib='bzip2')
    for gg in (g1a, g1b):
        f.create_carray(gg, 'zeros128b', obj=np.zeros(32, dtype=np.float64), filters=filters)
        f.create_carray(gg, 'random128b', obj=np.random.rand(32), filters=filters)
    g2 = f.create_group('/', 'group2')
    softlink = f.create_soft_link(g2, 'softlink_g1_z128', '/group1/group1a/zeros128b')
    hardlink = f.create_hard_link(g2, 'hardlink_g1a_z128', '/group1/group1a/zeros128b')
    hlgroup = f.create_hard_link(g2, 'hardlink_g1a', '/group1/group1a')
    return f

dataset/ETHPy150Open PyTables/PyTables/tables/scripts/pttree.py make_test_file/original