skip to navigation
skip to content

Not Logged In

rootpy 0.7.1

A pythonic layer on top of the ROOT framework's PyROOT bindings.

https://travis-ci.org/rootpy/rootpy.png https://pypip.in/v/rootpy/badge.png https://pypip.in/d/rootpy/badge.png

Python has become the language of choice for high-level applications where fast prototyping and efficient development are important, while glueing together low-level libraries for performance-critical tasks. The PyROOT bindings introduced ROOT into the Python arena, however, interacting with ROOT in Python should not "feel" like you are writing C++. Python also offers a multitude of powerful packages such as SciPy, NumPy, IPython, matplotlib, and PyTables, but a suitable interface between them and ROOT has been lacking.

The rootpy project is a community-driven initiative aiming to provide a more pythonic interface with ROOT on top of the existing PyROOT bindings. Several key features include:

  • Improvements to help you create and manipulate trees, histograms, cuts and vectors.
  • Colours and other style attributes can be referred to by descriptive strings.
  • Get and Set methods on ROOT objects are also properties.
  • Provides a way of mapping ROOT trees onto python objects and collections.
  • Easy navigation through ROOT files. You can now access objects with my_file.some_directory.tree_name, for example.
  • Dictionaries for STL types are compiled for you automatically.
  • Redirect ROOT's messages through Python's logging system.
  • Optionally turn ROOT errors into Python exceptions.
  • Plot your ROOT histograms or graphs with matplotlib.
  • Conversion of ROOT trees into NumPy ndarrays and recarrays through the related root_numpy package. Now take advantage of the many statistical and numerical packages that Python offers (NumPy, SciPy, StatsModels, and scikit-learn).
  • Conversion of ROOT files containing trees into HDF5 format with PyTables.
  • roosh, a Bash-like shell environment for the ROOT file
  • rootpy, a command for common tasks such as summing histograms or drawing tree expressions over multiple files, listing the contents of a file, or inspecting tree branches and their sizes and types.

Documentation

View the documentation at rootpy.org or (a possibly more up-to-date version) at rootpy.github.com/rootpy.

Also see an introductory presentation here: rootpy.org/intro.pdf

Requirements

  • Python 2.6 or 2.7 (Python 3 is currently not supported, but see this issue for progress)
  • ROOT 5.28+ with PyROOT enabled

The following dependencies are optional:

rootpy is developed and tested on Linux and Mac.

Getting the Latest Source

Clone the repository with git:

git clone git://github.com/rootpy/rootpy.git

or checkout with svn:

svn checkout http://svn.github.com/rootpy/rootpy

Note

svn does not checkout git submodules so you will end up with an incomplete rootpy.

Manual Installation

If you have obtained a copy of rootpy yourself use the setup.py script to install.

To install in your home directory:

python setup.py install --user

To install system-wide (requires root privileges):

sudo python setup.py install

To install optional requirements (matplotlib, NumPy, etc.):

pip install -U -r requirements/[roosh|array|...].txt

Automatic Installation

To install a released version of rootpy use pip.

Note

This will install the latest version of rootpy on PyPI which may be lacking many new unreleased features.

To install in your home directory:

pip install --user rootpy

To install system-wide (requires root privileges):

sudo pip install rootpy

To install optional requirements (matplotlib, NumPy, etc.):

pip install --user rootpy[array,matplotlib,...]

This requires pip version 1.1 or later.

Try rootpy on CERN's LXPLUS

First, set up ROOT:

source /afs/cern.ch/sw/lcg/contrib/gcc/4.3/x86_64-slc5/setup.sh &&\
cd /afs/cern.ch/sw/lcg/app/releases/ROOT/5.34.00/x86_64-slc5-gcc43-opt/root &&\
source bin/thisroot.sh &&\
cd -

Then, create and activate a virtualenv (change my_env at your will):

virtualenv my_env # necessary only the first time
source my_env/bin/activate

Get the latest source:

git clone https://github.com/rootpy/rootpy.git

and install it:

~/my_env/bin/python rootpy/setup.py install

Note that neither sudo nor --user is used, because we are in a virtualenv.

rootpy should now be ready to use:

python
>>> import rootpy

Post-Installation

If you installed rootpy into your home directory with the --user option above, add ${HOME}/.local/bin to your ${PATH} if it is not there already (put this in your .bashrc):

export PATH=${HOME}/.local/bin${PATH:+:$PATH}

Running the Tests

Testing requires the nose package. Once rootpy is installed, it may be tested (from outside the source directory) by running:

nosetests --exe -v -a '!slow' rootpy

rootpy can also be tested before installing by running this from inside the source directory:

make test

Development

Please post on the rootpy-dev@googlegroups.com list if you have ideas or contributions. Feel free to fork rootpy on GitHub and later submit a pull request.

IRC Channel

See #rootpy on freenode.

IRC is banned at CERN since it reveals your hostname to people in the chatroom, making you interesting to attackers. But you can safely access it through this web link:

http://webchat.freenode.net/?randomnick=1&channels=rootpy&prompt=1

Have Questions or Found a Bug?

Post your questions on stackoverflow.com and use the tag rootpy (this tag does not exist yet, but if you have a reputation of at least 1500 then please create it).

Think you found a bug? Open a new issue here: github.com/rootpy/rootpy/issues.

Also feel free to post questions or follow discussion on the rootpy-users or rootpy-dev Google groups.

 
File Type Py Version Uploaded on Size
rootpy-0.7.1.tar.gz (md5) Source 2013-03-11 298KB
  • Downloads (All Versions):
  • 2 downloads in the last day
  • 75 downloads in the last week
  • 401 downloads in the last month