Skip to content
This repository has been archived by the owner on Jan 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #189 from ndawe/tmva
Browse files Browse the repository at this point in the history
[MRG] Add TMVA support
  • Loading branch information
ndawe committed May 3, 2015
2 parents 4372a22 + 16140c0 commit 096187c
Show file tree
Hide file tree
Showing 36 changed files with 15,743 additions and 159 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/root_numpy/src/_librootnumpy.cpp binary
/root_numpy/tmva/src/_libtmvanumpy.cpp binary
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ python:
- "2.7"
- "3.4"
env:
- ROOT=v5-34-18
- ROOT=v5-34-18 NOTMVA=1
- ROOT=master
install: source ci/install.sh
script: bash ci/test.sh
after_success:
- time coveralls
cache: apt
notifications:
email: false
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
recursive-include examples *.py
recursive-include root_numpy *.root *.h *.cpp *.pyx *.pxi
include *.py
include README.rst
Expand Down
22 changes: 10 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ PYTHON := $(shell which python)
CYTHON := $(shell which cython)
NOSETESTS := $(shell which nosetests)

CYTHON_PYX := root_numpy/src/_librootnumpy.pyx
CYTHON_CPP := root_numpy/src/_librootnumpy.cpp
CYTHON_SRC := $(filter-out $(CYTHON_PYX),$(filter-out $(CYTHON_CPP),$(wildcard root_numpy/src/*)))
CYTHON_PYX_SRC := $(filter-out $(CYTHON_PYX),$(wildcard root_numpy/src/*.pyx))
CYTHON_CORE_PYX := root_numpy/src/_librootnumpy.pyx
CYTHON_TMVA_PYX := root_numpy/tmva/src/_libtmvanumpy.pyx
CYTHON_CORE_CPP := $(CYTHON_CORE_PYX:.pyx=.cpp)
CYTHON_TMVA_CPP := $(CYTHON_TMVA_PYX:.pyx=.cpp)
CYTHON_PYX_SRC := $(filter-out $(CYTHON_CORE_PYX),$(wildcard root_numpy/src/*.pyx))

INTERACTIVE := $(shell ([ -t 0 ] && echo 1) || echo 0)

Expand All @@ -18,7 +19,7 @@ else
OPEN := xdg-open
endif

all: $(CYTHON_CPP) clean inplace test
all: clean cython inplace test

clean-pyc:
@find . -name "*.pyc" -exec rm {} \;
Expand All @@ -34,15 +35,12 @@ clean-html:

clean: clean-build clean-pyc clean-so

$(CYTHON_PYX): $(CYTHON_SRC)

$(CYTHON_CPP): $(CYTHON_PYX)
.SECONDEXPANSION:
%.cpp: %.pyx $$(filter-out $$@,$$(wildcard $$(@D)/*))
@echo "compiling $< ..."
@$(CYTHON) --cplus --fast-fail --line-directives $<
$(CYTHON) --cplus --fast-fail --line-directives $<

cython:
@echo "compiling $(CYTHON_PYX) ..."
$(CYTHON) --cplus --fast-fail --line-directives $(CYTHON_PYX)
cython: $(CYTHON_CORE_CPP) $(CYTHON_TMVA_CPP)

show-cython: clean-html
@tmp=`mktemp -d`; \
Expand Down
13 changes: 10 additions & 3 deletions ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,23 @@

set -e

# Install gcc 4.8
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get -qq update
sudo apt-get -qq install g++-4.8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 90
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90

sudo apt-get -qq install python-nose python-pip
pip install coverage coveralls

# Install the ROOT binary
time wget --no-check-certificate https://copy.com/rtIyUdxgjt7h/ci/root_builds/root${ROOT}_python${TRAVIS_PYTHON_VERSION}_gcc4.8_x86_64.tar.gz
time tar zxf root${ROOT}_python${TRAVIS_PYTHON_VERSION}_gcc4.8_x86_64.tar.gz
mv root${ROOT}_python${TRAVIS_PYTHON_VERSION}_gcc4.8_x86_64 root
build=root${ROOT}_python${TRAVIS_PYTHON_VERSION}_gcc4.8_x86_64
if [ ! -z ${NOTMVA+x} ]; then
# Use a build without TMVA
build+=_notmva
fi
time wget --no-check-certificate https://copy.com/rtIyUdxgjt7h/ci/root_builds/${build}.tar.gz
time tar zxf ${build}.tar.gz
mv ${build} root
source root/bin/thisroot.sh
9 changes: 7 additions & 2 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ set -e

gcc -dumpversion
g++ -dumpversion
ldd --version
python --version
python -c "import numpy; print('numpy %s' % numpy.__version__)"

# Check if ROOT and PyROOT work
#root -l -q
python -c "import ROOT; ROOT.TBrowser()"
python -c "from __future__ import print_function; import ROOT; print(ROOT.gROOT.GetVersion())"

Expand All @@ -20,5 +21,9 @@ export PYTHONPATH=/home/travis/.local/lib/python${TRAVIS_PYTHON_VERSION}/site-pa
# Install into the user site-packages directory and run tests on that
time make install-user
time make test-installed

# Run tests in the local directory with coverage
time make test-coverage </dev/null
if [ -z ${NOTMVA+x} ]; then
# TMVA is included in this build, so run the coverage
time make test-coverage </dev/null
fi
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
_build
reference/generated
auto_examples
1 change: 1 addition & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ show:
clean:
rm -rf $(BUILDDIR)/*
rm -rf reference/generated/*
rm -rf auto_examples/

html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
Expand Down
5 changes: 5 additions & 0 deletions docs/_static/root_numpy.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
list-style: none;
}

#examples ul {
list-style-type: none;
list-style: none;
}

h2.main {
margin: 0;
font-style: italic;
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
'sphinx.ext.viewcode',
'sphinx.ext.autosummary',
'numpydoc',
'gen_rst',
]

# Add any paths that contain templates here, relative to this directory.
Expand Down
Binary file added docs/images/blank_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,11 @@ Documentation
start
reference/index

Examples
--------

.. toctree::
:maxdepth: 2

auto_examples/index

24 changes: 18 additions & 6 deletions docs/reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ root_numpy Reference
:Release: |version|
:Date: |today|

.. module:: root_numpy

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

root_numpy
----------

.. module:: root_numpy

.. autosummary::
:toctree: generated

Expand Down Expand Up @@ -39,6 +42,19 @@ what they are and what they do.
dup_idx
blockwise_inner_join

root_numpy.tmva
---------------

.. module:: root_numpy.tmva

.. autosummary::
:toctree: generated

add_classification_events
add_regression_events
evaluate_reader
evaluate_method

.. _conversion_table:

Type Conversion Table
Expand Down Expand Up @@ -70,7 +86,3 @@ vector<vector<t> > np.object
Variable length arrays (such as ``particletype[nparticle]``) and vectors
(such as ``vector<int>``) are converted to NumPy arrays of the corresponding
types. Fixed length arrays are converted to fixed length NumPy array fields.

.. note::
Tab completion for numpy.recarray column names (yourdata.<TAB>)
is also available with this `numpy extension <https://github.com/piti118/inumpy>`_.
Loading

0 comments on commit 096187c

Please sign in to comment.