root_numpy.array

root_numpy.array(arr, copy=True)

Convert a ROOT TArray into a NumPy array.

Parameters:

arr : ROOT TArray

A ROOT TArrayD, TArrayF, TArrayL, TArrayI or TArrayS

copy : bool, optional (default=True)

If True (the default) then copy the underlying array, otherwise the NumPy array will view (and not own) the same memory as the ROOT array.

Returns:

arr : NumPy array

A NumPy array

Examples

>>> from root_numpy import array
>>> from ROOT import TArrayD
>>> a = TArrayD(5)
>>> a[3] = 3.141
>>> array(a)
array([ 0.   ,  0.   ,  0.   ,  3.141,  0.   ])