def test_single_branch(): f = get_file('single1.root') tree = f.Get('tree') arr1_1d = rnp.tree2array(tree, branches='n_int') arr2_1d = rnp.root2array(load('single1.root'), branches='n_int') assert_equal(arr1_1d.dtype, np.dtype('<i4')) assert_equal(arr2_1d.dtype, np.dtype('<i4'))
def test_tree2array(): chain = TChain('tree') chain.Add(load('single1.root')) check_single(rnp.tree2array(chain)) f = get_file('single1.root') tree = f.Get('tree') check_single(rnp.tree2array(tree)) assert_raises(ValueError, get_file, 'file_does_not_exist.root')
def test_single(): f = load('single1.root') a = rnp.root2array(f) check_single(a) # specify tree name a = rnp.root2array(f, treename='tree') check_single(a) # tree2array f = get_file('single1.root') tree = f.Get('tree') check_single(rnp.tree2array(tree))