Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
PyROOT Namespace Reference

Classes

class  RPyROOTApplication
 Interactive application for Python. More...
 
class  TMemoryRegulator
 

Typedefs

typedef std::unordered_map< Cppyy::TCppObject_t, Cppyy::TCppType_tObjectMap_t
 

Functions

PyObjectAddBranchAttrSyntax (PyObject *self, PyObject *args)
 Allow branches to be accessed as attributes of a tree.
 
PyObjectAddCPPInstancePickling (PyObject *self, PyObject *args)
 Set reduce attribute for CPPInstance objects.
 
PyObjectAddPrettyPrintingPyz (PyObject *self, PyObject *args)
 Add pretty printing pythonization.
 
PyObjectAddTClassDynamicCastPyz (PyObject *self, PyObject *args)
 Add pythonization for TClass::DynamicCast.
 
PyObjectAddTObjectEqNePyz (PyObject *self, PyObject *args)
 Add pythonization for equality and inequality operators in TObject.
 
PyObjectBranchPyz (PyObject *self, PyObject *args)
 Add pythonization for TTree::Branch.
 
PyObjectClearProxiedObjects (PyObject *self, PyObject *args)
 
PyObjectCPPInstanceExpand (PyObject *self, PyObject *args)
 Deserialize pickled objects.
 
void Init ()
 
PyObjectSetBranchAddressPyz (PyObject *self, PyObject *args)
 Add pythonization for TTree::SetBranchAddress.
 

Variables

PyObjectgRootModule = 0
 

Typedef Documentation

◆ ObjectMap_t

Definition at line 49 of file TMemoryRegulator.h.

Function Documentation

◆ AddBranchAttrSyntax()

PyObject * PyROOT::AddBranchAttrSyntax ( PyObject self,
PyObject args 
)

Allow branches to be accessed as attributes of a tree.

Parameters
[in]selfAlways null, since this is a module function.
[in]argsPointer to a Python tuple object containing the arguments received from Python.

Allow access to branches/leaves as if they were Python data attributes of the tree (e.g. mytree.branch)

Definition at line 197 of file TTreePyz.cxx.

◆ AddCPPInstancePickling()

PyObject * PyROOT::AddCPPInstancePickling ( PyObject self,
PyObject args 
)

Set reduce attribute for CPPInstance objects.

Parameters
[in]selfAlways null, since this is a module function.
[in]argsPointer to a Python tuple object containing the arguments received from Python.

The C++ function op_reduce defined above is wrapped in a Python method so that it can be injected in CPPInstance

Definition at line 124 of file CPPInstancePyz.cxx.

◆ AddPrettyPrintingPyz()

PyObject * PyROOT::AddPrettyPrintingPyz ( PyObject self,
PyObject args 
)

Add pretty printing pythonization.

Parameters
[in]selfAlways null, since this is a module function.
[in]argsPointer to a Python tuple object containing the arguments received from Python.

This function adds the following pythonizations to print the object more user-friendly than cppyy by using the output of cling::printValue as the return value of the special method str.

Definition at line 119 of file GenericPyz.cxx.

◆ AddTClassDynamicCastPyz()

PyObject * PyROOT::AddTClassDynamicCastPyz ( PyObject self,
PyObject args 
)

Add pythonization for TClass::DynamicCast.

Parameters
[in]selfAlways null, since this is a module function.
[in]argsPointer to a Python tuple object containing the arguments received from Python.

TClass::DynamicCast returns a void* that the user still has to cast (it will have the proper offset, though). Fix this by providing the requested binding if the cast succeeded.

Definition at line 71 of file TClassPyz.cxx.

◆ AddTObjectEqNePyz()

PyObject * PyROOT::AddTObjectEqNePyz ( PyObject self,
PyObject args 
)

Add pythonization for equality and inequality operators in TObject.

Parameters
[in]selfAlways null, since this is a module function.
[in]argsPointer to a Python tuple object containing the arguments received from Python.

The equality and inequality operators are better implemented in C++, since we need to need to rely on Cppyy's rich comparison if the object we are comparing ourselves with is not a Python proxy or if it contains a null pointer. For example, we need to support the comparison to None.

The rest of comparison operators (i.e. those that define order) can be implemented in Python, throwing a NotImplemented exception if we are not comparing two proxies to TObject or derivate.

Definition at line 81 of file TObjectPyz.cxx.

◆ BranchPyz()

PyObject * PyROOT::BranchPyz ( PyObject self,
PyObject args 
)

Add pythonization for TTree::Branch.

Parameters
[in]selfAlways null, since this is a module function.
[in]argsPointer to a Python tuple object containing the arguments received from Python.

Modify the behaviour of Branch so that proxy references can be passed as arguments from the Python side, more precisely in cases where the C++ implementation of the method expects the address of a pointer.

For example:

v = ROOT.std.vector('int')()
t.Branch('my_vector_branch', v)

The following signatures are treated in this pythonization:

  • ( const char*, void*, const char*, Int_t = 32000 )
  • ( const char*, const char*, T**, Int_t = 32000, Int_t = 99 )
  • ( const char*, T**, Int_t = 32000, Int_t = 99 )

Definition at line 410 of file TTreePyz.cxx.

◆ ClearProxiedObjects()

PyObject * PyROOT::ClearProxiedObjects ( PyObject self,
PyObject args 
)

Definition at line 65 of file PyROOTWrapper.cxx.

◆ CPPInstanceExpand()

PyObject * PyROOT::CPPInstanceExpand ( PyObject self,
PyObject args 
)

Deserialize pickled objects.

Parameters
[in]selfAlways null, since this is a module function.
[in]argsPointer to a Python tuple object containing the arguments received from Python.

Helper function that deserializes pickled objects. It needs to be included in the extension module API because otherwise it is not callable from Python. This is important because it will be Python itself calling it when trying to expand a serialized object.

Definition at line 38 of file CPPInstancePyz.cxx.

◆ Init()

void PyROOT::Init ( )

Definition at line 49 of file PyROOTWrapper.cxx.

◆ SetBranchAddressPyz()

PyObject * PyROOT::SetBranchAddressPyz ( PyObject self,
PyObject args 
)

Add pythonization for TTree::SetBranchAddress.

Parameters
[in]selfAlways null, since this is a module function.
[in]argsPointer to a Python tuple object containing the arguments received from Python.

Modify the behaviour of SetBranchAddress so that proxy references can be passed as arguments from the Python side, more precisely in cases where the C++ implementation of the method expects the address of a pointer.

For example:

v = ROOT.std.vector('int')()
t.SetBranchAddress("my_vector_branch", v)

Definition at line 219 of file TTreePyz.cxx.

Variable Documentation

◆ gRootModule

R__EXTERN PyObject * PyROOT::gRootModule = 0

Definition at line 36 of file PyROOTModule.cxx.