root_numpy Reference

Release:4.7.3.dev0
Date:Aug 25, 2017

This reference manual details the functions included in root_numpy, describing what they are and what they do.

root_numpy

array(arr[, copy]) Convert a ROOT TArray into a NumPy array.
matrix(mat) Convert a ROOT TMatrix into a NumPy matrix.
root2array(filenames[, treename, branches, ...]) Convert trees in ROOT files into a numpy structured array.
root2rec(filenames[, treename, branches, ...]) View the result of root2array() as a record array.
tree2array(tree[, branches, selection, ...]) Convert a tree into a numpy structured array.
tree2rec(tree[, branches, selection, ...]) View the result of tree2array() as a record array.
array2tree(arr[, name, tree]) Convert a numpy structured array into a ROOT TTree.
array2root(arr, filename[, treename, mode]) Convert a numpy array into a ROOT TTree and save it in a ROOT TFile.
hist2array(hist[, include_overflow, copy, ...]) Convert a ROOT histogram into a NumPy array
array2hist(array, hist[, errors]) Convert a NumPy array into a ROOT histogram
fill_hist(hist, array[, weights, return_indices]) Fill a ROOT histogram with a NumPy array.
fill_profile(profile, array[, weights, ...]) Fill a ROOT profile with a NumPy array.
fill_graph(graph, array) Fill a ROOT graph with a NumPy array.
random_sample(obj, n_samples[, seed]) Create a random array by sampling a ROOT function or histogram.
evaluate(obj, array) Evaluate a ROOT histogram, function, graph, or spline over an array.
list_trees(filename) Get list of the tree names in a ROOT file.
list_branches(filename[, treename]) Get a list of the branch names of a tree in a ROOT file.
list_directories(filename) Get a list of the directories in a ROOT file.
list_structures(filename[, treename]) Get a dictionary mapping branch names to leaf structures.
rec2array(rec[, fields]) Convert a record/structured array into an ndarray with a homogeneous data type.
stack(recs[, fields]) Stack common fields in multiple record arrays (concatenate them).
stretch(arr[, fields, return_indices]) Stretch an array.
dup_idx(arr) Return the indices of all duplicated array elements.
blockwise_inner_join(data, left, ...[, ...]) Perform a blockwise inner join.
RootNumpyUnconvertibleWarning This warning is raised when root_numpy is unable to convert a branch into a column of a NumPy array because there is no converter for the type.

root_numpy.tmva

add_classification_events(obj, events, labels) Add classification events to a TMVA::Factory or TMVA::DataLoader from NumPy arrays.
add_regression_events(obj, events, targets) Add regression events to a TMVA::Factory or TMVA::DataLoader from NumPy arrays.
evaluate_reader(reader, name, events[, aux]) Evaluate a TMVA::Reader over a NumPy array.
evaluate_method(method, events[, aux]) Evaluate a TMVA::MethodBase over a NumPy array.