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

Commit

Permalink
Rename to uproot3-methods, to ensure name-version consistency.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpivarski committed Nov 30, 2020
1 parent 02f9911 commit 389e702
Show file tree
Hide file tree
Showing 28 changed files with 129 additions and 129 deletions.
14 changes: 7 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
uproot-methods
==============
uproot3-methods
===============

.. inclusion-marker-1-do-not-remove
Pythonic mix-ins for ROOT classes.

.. inclusion-marker-1-5-do-not-remove
This package is typically used as a dependency for `uproot 3.x <https://github.com/scikit-hep/uproot3>`__, to define methods on the classes that are automatically generated from ROOT files. This includes histograms (TH*) and physics objects like TLorentzVectors. The reason it's a separate library is so that we can add physics-specific functionality on a shorter timescale than we can update uproot itself, which is purely an I/O package.
This package is typically used as a dependency for `uproot 3.x <https://github.com/scikit-hep/uproot3>`__, to define methods on the classes that are automatically generated from ROOT files. This includes histograms (TH*) and physics objects like TLorentzVectors. The reason it's a separate library is so that we can add physics-specific functionality on a shorter timescale than we can update Uproot 3 itself, which is purely an I/O package.

Occasionally, this library is used without uproot, as a way to make arrays of TLorentzVectors.
Occasionally, this library is used without Uproot 3, as a way to make arrays of TLorentzVectors.

**Note:** this package is incompatible with ``awkward>=1.0`` and ``uproot>=4.0``! For Lorentz vectors, use `vector <https://github.com/scikit-hep/vector>`__. Since the versions of Awkward Array and Uproot that this is compatible with are deprecated, **this library is deprecated** as well.

Expand All @@ -18,11 +18,11 @@ Occasionally, this library is used without uproot, as a way to make arrays of TL
Installation
============

Install uproot-methods like any other Python package:
Install uproot3-methods like any other Python package:

.. code-block:: bash
pip install uproot-methods # maybe with sudo or --user, or in virtualenv
pip install uproot3-methods # maybe with sudo or --user, or in virtualenv
Dependencies:
-------------
Expand All @@ -42,4 +42,4 @@ Acknowledgements

Support for this work was provided by NSF cooperative agreement OAC-1836650 (IRIS-HEP), grant OAC-1450377 (DIANA/HEP) and PHY-1520942 (US-CMS LHC Ops).

Thanks especially to the gracious help of `uproot-methods contributors <https://github.com/scikit-hep/uproot-methods/graphs/contributors>`__!
Thanks especially to the gracious help of `uproot3-methods contributors <https://github.com/scikit-hep/uproot3-methods/graphs/contributors>`__!
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

# BSD 3-Clause License; see https://github.com/scikit-hep/uproot-methods/blob/master/LICENSE
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot3-methods/blob/master/LICENSE

import os.path

Expand All @@ -9,7 +9,7 @@

def get_version():
g = {}
exec(open(os.path.join("uproot_methods", "version.py")).read(), g)
exec(open(os.path.join("uproot3_methods", "version.py")).read(), g)
return g["__version__"]

def get_description():
Expand All @@ -27,7 +27,7 @@ def get_description():

return description[start:stop].strip() # before + + after

setup(name = "uproot-methods",
setup(name = "uproot3-methods",
version = get_version(),
packages = find_packages(exclude = ["tests"]),
scripts = [],
Expand All @@ -37,8 +37,8 @@ def get_description():
author_email = "pivarski@princeton.edu",
maintainer = "Jim Pivarski (IRIS-HEP)",
maintainer_email = "pivarski@princeton.edu",
url = "https://github.com/scikit-hep/uproot-methods",
download_url = "https://github.com/scikit-hep/uproot-methods/releases",
url = "https://github.com/scikit-hep/uproot3-methods",
download_url = "https://github.com/scikit-hep/uproot3-methods/releases",
license = "BSD 3-clause",
test_suite = "tests",
install_requires = ["numpy>=1.13.1", "awkward0"],
Expand Down
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env python

# BSD 3-Clause License; see https://github.com/scikit-hep/uproot-methods/blob/master/LICENSE
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot3-methods/blob/master/LICENSE
4 changes: 2 additions & 2 deletions tests/test_histogram.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

# BSD 3-Clause License; see https://github.com/scikit-hep/uproot-methods/blob/master/LICENSE
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot3-methods/blob/master/LICENSE

import unittest
import numpy as np
Expand All @@ -10,7 +10,7 @@ def runTest(self):
pass

def test_th1(self):
from uproot_methods.classes.TH1 import Methods, _histtype, from_numpy
from uproot3_methods.classes.TH1 import Methods, _histtype, from_numpy

edges = np.array((0., 1., 2.))
values = np.array([2, 3])
Expand Down
8 changes: 4 additions & 4 deletions tests/test_issues.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env python

# BSD 3-Clause License; see https://github.com/scikit-hep/uproot-methods/blob/master/LICENSE
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot3-methods/blob/master/LICENSE

import unittest

import numpy

import awkward0
import uproot_methods
from uproot_methods import *
import uproot3_methods
from uproot3_methods import *

import inspect

Expand Down Expand Up @@ -51,7 +51,7 @@ def test_issue39(self):
eta = eta[mask]
phi = phi[mask]

electrons = uproot_methods.TLorentzVectorArray.from_ptetaphim(pt, eta, phi, 0.000511)
electrons = uproot3_methods.TLorentzVectorArray.from_ptetaphim(pt, eta, phi, 0.000511)

def test_issue61(self):
assert TVector2(2, 0).rotate(numpy.pi/6).rotate(-numpy.pi/6) == TVector2(2, 0)
Expand Down
18 changes: 9 additions & 9 deletions tests/test_vector.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env python

# BSD 3-Clause License; see https://github.com/scikit-hep/uproot-methods/blob/master/LICENSE
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot3-methods/blob/master/LICENSE

import unittest

import numpy

import awkward0
import uproot_methods
from uproot_methods import *
import uproot3_methods
from uproot3_methods import *

class Test(unittest.TestCase):
def runTest(self):
Expand Down Expand Up @@ -47,9 +47,9 @@ def test_vector2_array(self):
assert (a**3).tolist() == [0.0, 1.0, 8.0, 27.0, 64.0, 125.0, 216.0, 343.0, 512.0, 729.0]

def test_vector2_jagged(self):
TVector2Jagged = type("TVector2Jagged", (awkward0.JaggedArray, uproot_methods.classes.TVector2.ArrayMethods), {})
TVector2Jagged = type("TVector2Jagged", (awkward0.JaggedArray, uproot3_methods.classes.TVector2.ArrayMethods), {})
a = TVector2Jagged.fromoffsets([0, 3, 3, 5, 10], TVector2Array(numpy.zeros(10), numpy.arange(10)))
a._generator = uproot_methods.classes.TVector2.TVector2
a._generator = uproot3_methods.classes.TVector2.TVector2
a._args = ()
a._kwargs = {}
assert a.tolist() == [[TVector2(0, 0), TVector2(0, 1), TVector2(0, 2)], [], [TVector2(0, 3), TVector2(0, 4)], [TVector2(0, 5), TVector2(0, 6), TVector2(0, 7), TVector2(0, 8), TVector2(0, 9)]]
Expand Down Expand Up @@ -113,9 +113,9 @@ def test_vector3_array(self):
numpy.testing.assert_almost_equal(a[1:].angle(-2 * a[1:]), numpy.ones_like(a[1:]) * numpy.pi)

def test_vector3_jagged(self):
TVector3Jagged = type("TVector3Jagged", (awkward0.JaggedArray, uproot_methods.classes.TVector3.ArrayMethods), {})
TVector3Jagged = type("TVector3Jagged", (awkward0.JaggedArray, uproot3_methods.classes.TVector3.ArrayMethods), {})
a = TVector3Jagged.fromoffsets([0, 3, 3, 5, 10], TVector3Array(numpy.zeros(10), numpy.arange(10), numpy.zeros(10)))
a._generator = uproot_methods.classes.TVector3.TVector3
a._generator = uproot3_methods.classes.TVector3.TVector3
a._args = ()
a._kwargs = {}
assert a.tolist() == [[TVector3(0, 0, 0), TVector3(0, 1, 0), TVector3(0, 2, 0)], [], [TVector3(0, 3, 0), TVector3(0, 4, 0)], [TVector3(0, 5, 0), TVector3(0, 6, 0), TVector3(0, 7, 0), TVector3(0, 8, 0), TVector3(0, 9, 0)]]
Expand Down Expand Up @@ -189,9 +189,9 @@ def test_ptetaphim_array(self):
assert a.sum().mass == numpy.hypot(20 * numpy.cosh(a.eta), a.mass).sum()

def test_lorentzvector_jagged(self):
TLorentzVectorJagged = type("TLorentzVectorJagged", (awkward0.JaggedArray, uproot_methods.classes.TLorentzVector.ArrayMethods), {})
TLorentzVectorJagged = type("TLorentzVectorJagged", (awkward0.JaggedArray, uproot3_methods.classes.TLorentzVector.ArrayMethods), {})
a = TLorentzVectorJagged.fromoffsets([0, 3, 3, 5, 10], TLorentzVectorArray(numpy.zeros(10), numpy.arange(10), numpy.zeros(10), numpy.zeros(10)))
a._generator = uproot_methods.classes.TLorentzVector.TLorentzVector
a._generator = uproot3_methods.classes.TLorentzVector.TLorentzVector
a._args = ()
a._kwargs = {}
assert a.tolist() == [[TLorentzVector(0, 0, 0, 0), TLorentzVector(0, 1, 0, 0), TLorentzVector(0, 2, 0, 0)], [], [TLorentzVector(0, 3, 0, 0), TLorentzVector(0, 4, 0, 0)], [TLorentzVector(0, 5, 0, 0), TLorentzVector(0, 6, 0, 0), TLorentzVector(0, 7, 0, 0), TLorentzVector(0, 8, 0, 0), TLorentzVector(0, 9, 0, 0)]]
Expand Down
10 changes: 10 additions & 0 deletions uproot3_methods/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python

# BSD 3-Clause License; see https://github.com/scikit-hep/uproot3-methods/blob/master/LICENSE

from uproot3_methods.classes.TVector2 import TVector2, TVector2Array
from uproot3_methods.classes.TVector3 import TVector3, TVector3Array
from uproot3_methods.classes.TLorentzVector import TLorentzVector, TLorentzVectorArray, PtEtaPhiMassLorentzVector

# convenient access to the version number
from uproot3_methods.version import __version__
2 changes: 1 addition & 1 deletion uproot_methods/base.py → uproot3_methods/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

# BSD 3-Clause License; see https://github.com/scikit-hep/uproot-methods/blob/master/LICENSE
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot3-methods/blob/master/LICENSE

import awkward0
import awkward0.util
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python

# BSD 3-Clause License; see https://github.com/scikit-hep/uproot-methods/blob/master/LICENSE
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot3-methods/blob/master/LICENSE

import uproot_methods.base
import uproot3_methods.base

class Methods(uproot_methods.base.ROOTMethods):
class Methods(uproot3_methods.base.ROOTMethods):
def __repr__(self):
if self._fName is None:
return "<{0} at 0x{1:012x}>".format(self._classname, id(self))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python

# BSD 3-Clause License; see https://github.com/scikit-hep/uproot-methods/blob/master/LICENSE
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot3-methods/blob/master/LICENSE

import uproot_methods.base
import uproot3_methods.base

class Methods(uproot_methods.base.ROOTMethods):
class Methods(uproot3_methods.base.ROOTMethods):

@property
def xerrorshigh(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python

# BSD 3-Clause License; see https://github.com/scikit-hep/uproot-methods/blob/master/LICENSE
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot3-methods/blob/master/LICENSE

import uproot_methods.base
import uproot3_methods.base

class Methods(uproot_methods.base.ROOTMethods):
class Methods(uproot3_methods.base.ROOTMethods):

@property
def xerrors(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#!/usr/bin/env python

# BSD 3-Clause License; see https://github.com/scikit-hep/uproot-methods/blob/master/LICENSE
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot3-methods/blob/master/LICENSE

import numbers
import math
import sys

import numpy

import uproot_methods.base
import uproot3_methods.base

class Methods(uproot_methods.base.ROOTMethods):
class Methods(uproot3_methods.base.ROOTMethods):
def __repr__(self):
if self.name is None:
return "<{0} at 0x{1:012x}>".format(self._classname, id(self))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env python

# BSD 3-Clause License; see https://github.com/scikit-hep/uproot-methods/blob/master/LICENSE
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot3-methods/blob/master/LICENSE

import numpy

import uproot_methods.base
import uproot3_methods.base


class Methods(uproot_methods.base.ROOTMethods):
class Methods(uproot3_methods.base.ROOTMethods):
@property
def numbins(self):
return self.xnumbins * self.ynumbins
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env python

# BSD 3-Clause License; see https://github.com/scikit-hep/uproot-methods/blob/master/LICENSE
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot3-methods/blob/master/LICENSE

import numpy

import uproot_methods.base
import uproot3_methods.base


class Methods(uproot_methods.base.ROOTMethods):
class Methods(uproot3_methods.base.ROOTMethods):
@property
def numbins(self):
return self.xnumbins * self.ynumbins * self.znumbins
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env python

# BSD 3-Clause License; see https://github.com/scikit-hep/uproot-methods/blob/master/LICENSE
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot3-methods/blob/master/LICENSE

import numpy

import uproot_methods.base
import uproot3_methods.base

class Methods(uproot_methods.base.ROOTMethods):
class Methods(uproot3_methods.base.ROOTMethods):
def hello(self):
return "world", len(dir(self))
Loading

0 comments on commit 389e702

Please sign in to comment.