Skip to content
This repository was archived by the owner on Jan 7, 2023. It is now read-only.

Commit 44c2cd8

Browse files
authored
Merge pull request #342 from ndawe/master
Remove use of rootpy in FAQ
2 parents 26dbdcc + 3f56d2a commit 44c2cd8

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

docs/faq.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,19 @@ memory.
3434
Instead, just use ROOT directly. Deactivate the branches before calling
3535
the tree's ``CloneTree()`` method. Only the activated branches are copied::
3636

37-
from root_numpy import testdata
38-
from rootpy import asrootpy
39-
from rootpy.io import root_open
40-
41-
rfile = root_open(testdata.get_filepath('single1.root'))
42-
tree = rfile['tree']
43-
print tree.branchnames # prints ['n_int', 'f_float', 'd_double']
44-
45-
# remove the branch named 'd_double'
46-
tree.SetBranchStatus('d_double', 0)
47-
48-
# copy the tree into a new file
49-
with root_open('output.root', 'w'):
50-
newtree = asrootpy(tree.CloneTree())
51-
newtree.Write()
52-
print newtree.branchnames # prints ['n_int', 'f_float']
37+
from root_numpy import testdata
38+
import ROOT
39+
40+
rfile = ROOT.TFile.Open(testdata.get_filepath('single1.root'))
41+
tree = rfile.Get('tree')
42+
print([b.GetName() for b in tree.GetListOfBranches()]) # prints ['n_int', 'f_float', 'd_double']
43+
44+
# remove the branch named 'd_double'
45+
tree.SetBranchStatus('d_double', 0)
46+
47+
# copy the tree into a new file
48+
rfile_out = ROOT.TFile.Open('output.root', 'recreate')
49+
newtree = tree.CloneTree()
50+
newtree.Write()
51+
print([b.GetName() for b in newtree.GetListOfBranches()]) # prints ['n_int', 'f_float']
52+

examples/core/plot_bootstrap.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
============================
66
77
This example demonstrates how to sample entries in a TTree with replacement
8-
with the help of NumPy and root_numpy.
8+
with the help of NumPy and root_numpy. This example depends on
9+
`rootpy <http://www.rootpy.org/>`_ which can be installed with pip::
10+
11+
pip install --user rootpy
12+
913
"""
1014
from rootpy.extern.six.moves import range
1115
from rootpy.tree import Tree, TreeModel, FloatCol

0 commit comments

Comments
 (0)