Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
Python interface

Python-specific functionalities offered by ROOT.

This page lists the so-called "pythonizations", that is those functionalities offered by ROOT for classes and functions which are specific to Python usage of the package and provide a more pythonic experience.

Classes

class  ROOT::RDataFrame
 ROOT's RDataFrame offers a modern, high-level interface for analysis of data stored in TTree , CSV and other data formats, in C++ or Python. More...
 
class  ROOT::VecOps::RVec< T >
 A "std::vector"-like collection of values implementing handy operation to analyse them. More...
 
class  TArray
 Abstract array base class. More...
 
class  TDirectory::TContext
 TDirectory::TContext keeps track and restore the current directory. More...
 
class  TDirectory
 Describe directory structure in memory. More...
 
class  TDirectoryFile
 A ROOT file is structured in Directories (like a file system). More...
 
class  TF1
 1-Dim function class More...
 
class  TFile
 A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-like logical structure, possibly including subdirectory hierarchies. More...
 
class  TGraph
 A TGraph is an object made of two arrays X and Y with npoints each. More...
 
class  TH1
 TH1 is the base class of all histogram classes in ROOT. More...
 
class  THistPainter
 The histogram painter class. More...
 
class  TScatter
 A TScatter is able to draw four variables scatter plot on a single plot. More...
 
class  TTree
 A TTree represents a columnar dataset. More...
 

Functions

 ROOT._pythonization.pythonization (class_name, ns='::', is_prefix=False)
 Decorator that allows to pythonize C++ classes.
 

Function Documentation

◆ pythonization()

ROOT._pythonization.pythonization (   class_name,
  ns = '::',
  is_prefix = False 
)

Decorator that allows to pythonize C++ classes.

To pythonize means to add some extra behaviour to a C++ class that is used from Python via PyROOT, so that such a class can be used in an easier / more "pythonic" way. When a pythonization is registered with this decorator, the injection of the new behaviour in the C++ class is done immediately, if the class has already been used from the application, or lazily, i.e. only when the class is first accessed from the application.

Args: class_name (string/iterable[string]): specifies either a single string or multiple strings, where each string can be either (i) the name of a C++ class to be pythonized, or (ii) a prefix to match all classes whose name starts with that prefix. ns (string): namespace of the classes to be pythonized. Default is the global namespace (::). is_prefix (boolean): if True, class_name contains one or multiple prefixes, each prefix potentially matching multiple classes. Default is False. These are examples of prefixes and namespace and what they match:

  • class_name="", ns="::" : all classes in the global namespace.
  • class_name="C", ns="::" : all classes in the global namespace whose name starts with "C"
  • class_name="", ns="NS1::NS2" : all classes in namespace "NS1::NS2"
  • class_name="C", ns="NS1::NS2" : all classes in namespace "NS1::NS2" whose name starts with "C"

Returns: function: function that receives the user-defined function and decorates it.

Definition at line 26 of file __init__.py.