ROOT branch to python (numpy) array

From: Yngve Inntjore Levinsen <yngve.inntjore.levinsen_at_cern.ch>
Date: Fri, 15 Apr 2011 18:24:13 +0200


Hi all,

I am trying to extract branches from a ROOT tree into numpy arrays. I think that with previous versions I could do something like this: mytree.GetEntry(0)
myarray=np.array([d for d in mytree.mybranch]) This however does not seem to work anymore (I took the example from an older script of mine that worked before). Now it seems the attribute mybranch of mytree only has the first entry (which to me makes sense considering the first command).

What is the recommended way to copy a branch into an array in python?

Cheers,
Yngve Received on Fri Apr 15 2011 - 18:24:19 CEST

This archive was generated by hypermail 2.2.0 : Fri Apr 15 2011 - 23:50:01 CEST