From 389e70264044ee6729c819e9fdaedf74bee6cac7 Mon Sep 17 00:00:00 2001 From: Jim Pivarski Date: Mon, 30 Nov 2020 08:56:12 -0600 Subject: [PATCH] Rename to uproot3-methods, to ensure name-version consistency. --- README.rst | 14 ++--- setup.py | 10 ++-- tests/__init__.py | 2 +- tests/test_histogram.py | 4 +- tests/test_issues.py | 8 +-- tests/test_vector.py | 18 +++--- uproot3_methods/__init__.py | 10 ++++ {uproot_methods => uproot3_methods}/base.py | 2 +- .../classes/TGraph.py | 6 +- .../classes/TGraphAsymmErrors.py | 6 +- .../classes/TGraphErrors.py | 6 +- .../classes/TH1.py | 6 +- .../classes/TH2.py | 6 +- .../classes/TH3.py | 6 +- .../classes/THnSparse.py | 6 +- .../classes/TLorentzVector.py | 60 +++++++++---------- .../classes/TParameter.py | 4 +- .../classes/TVector2.py | 14 ++--- .../classes/TVector3.py | 14 ++--- .../classes/__init__.py | 2 +- .../common/TVector.py | 2 +- .../common}/__init__.py | 2 +- .../convert.py | 20 +++---- .../profiles/__init__.py | 4 +- .../profiles/cms}/__init__.py | 2 +- .../profiles/cms/nanoaod.py | 10 ++-- .../version.py | 4 +- uproot_methods/__init__.py | 10 ---- 28 files changed, 129 insertions(+), 129 deletions(-) create mode 100644 uproot3_methods/__init__.py rename {uproot_methods => uproot3_methods}/base.py (95%) rename {uproot_methods => uproot3_methods}/classes/TGraph.py (93%) rename {uproot_methods => uproot3_methods}/classes/TGraphAsymmErrors.py (90%) rename {uproot_methods => uproot3_methods}/classes/TGraphErrors.py (87%) rename {uproot_methods => uproot3_methods}/classes/TH1.py (99%) rename {uproot_methods => uproot3_methods}/classes/TH2.py (98%) rename {uproot_methods => uproot3_methods}/classes/TH3.py (98%) rename {uproot_methods => uproot3_methods}/classes/THnSparse.py (60%) rename {uproot_methods => uproot3_methods}/classes/TLorentzVector.py (91%) rename {uproot_methods => uproot3_methods}/classes/TParameter.py (88%) rename {uproot_methods => uproot3_methods}/classes/TVector2.py (93%) rename {uproot_methods => uproot3_methods}/classes/TVector3.py (95%) rename {uproot_methods => uproot3_methods}/classes/__init__.py (96%) rename {uproot_methods => uproot3_methods}/common/TVector.py (99%) rename {uproot_methods/profiles/cms => uproot3_methods/common}/__init__.py (74%) rename {uproot_methods => uproot3_methods}/convert.py (77%) rename {uproot_methods => uproot3_methods}/profiles/__init__.py (71%) rename {uproot_methods/common => uproot3_methods/profiles/cms}/__init__.py (74%) rename {uproot_methods => uproot3_methods}/profiles/cms/nanoaod.py (96%) rename {uproot_methods => uproot3_methods}/version.py (77%) delete mode 100644 uproot_methods/__init__.py diff --git a/README.rst b/README.rst index c7e8d17..2b48fff 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,5 @@ -uproot-methods -============== +uproot3-methods +=============== .. inclusion-marker-1-do-not-remove @@ -7,9 +7,9 @@ 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 `__, 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 `__, 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 `__. Since the versions of Awkward Array and Uproot that this is compatible with are deprecated, **this library is deprecated** as well. @@ -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: ------------- @@ -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 `__! +Thanks especially to the gracious help of `uproot3-methods contributors `__! diff --git a/setup.py b/setup.py index 61e1767..46fc841 100755 --- a/setup.py +++ b/setup.py @@ -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 @@ -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(): @@ -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 = [], @@ -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"], diff --git a/tests/__init__.py b/tests/__init__.py index 9831512..79cb8b0 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -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 diff --git a/tests/test_histogram.py b/tests/test_histogram.py index ab67a5a..64cd75e 100644 --- a/tests/test_histogram.py +++ b/tests/test_histogram.py @@ -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 @@ -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]) diff --git a/tests/test_issues.py b/tests/test_issues.py index 0b72bcb..1c380d4 100644 --- a/tests/test_issues.py +++ b/tests/test_issues.py @@ -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 @@ -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) diff --git a/tests/test_vector.py b/tests/test_vector.py index 9d85b39..b45c354 100644 --- a/tests/test_vector.py +++ b/tests/test_vector.py @@ -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): @@ -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)]] @@ -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)]] @@ -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)]] diff --git a/uproot3_methods/__init__.py b/uproot3_methods/__init__.py new file mode 100644 index 0000000..2c0ddde --- /dev/null +++ b/uproot3_methods/__init__.py @@ -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__ diff --git a/uproot_methods/base.py b/uproot3_methods/base.py similarity index 95% rename from uproot_methods/base.py rename to uproot3_methods/base.py index 972d7a3..ddfebc2 100644 --- a/uproot_methods/base.py +++ b/uproot3_methods/base.py @@ -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 diff --git a/uproot_methods/classes/TGraph.py b/uproot3_methods/classes/TGraph.py similarity index 93% rename from uproot_methods/classes/TGraph.py rename to uproot3_methods/classes/TGraph.py index ce4e559..a9eb4d9 100644 --- a/uproot_methods/classes/TGraph.py +++ b/uproot3_methods/classes/TGraph.py @@ -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)) diff --git a/uproot_methods/classes/TGraphAsymmErrors.py b/uproot3_methods/classes/TGraphAsymmErrors.py similarity index 90% rename from uproot_methods/classes/TGraphAsymmErrors.py rename to uproot3_methods/classes/TGraphAsymmErrors.py index abd2666..58b7ee6 100644 --- a/uproot_methods/classes/TGraphAsymmErrors.py +++ b/uproot3_methods/classes/TGraphAsymmErrors.py @@ -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): diff --git a/uproot_methods/classes/TGraphErrors.py b/uproot3_methods/classes/TGraphErrors.py similarity index 87% rename from uproot_methods/classes/TGraphErrors.py rename to uproot3_methods/classes/TGraphErrors.py index a1ca860..e8c84d6 100644 --- a/uproot_methods/classes/TGraphErrors.py +++ b/uproot3_methods/classes/TGraphErrors.py @@ -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): diff --git a/uproot_methods/classes/TH1.py b/uproot3_methods/classes/TH1.py similarity index 99% rename from uproot_methods/classes/TH1.py rename to uproot3_methods/classes/TH1.py index aabdaa0..2733e77 100644 --- a/uproot_methods/classes/TH1.py +++ b/uproot3_methods/classes/TH1.py @@ -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 numbers import math @@ -8,9 +8,9 @@ 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)) diff --git a/uproot_methods/classes/TH2.py b/uproot3_methods/classes/TH2.py similarity index 98% rename from uproot_methods/classes/TH2.py rename to uproot3_methods/classes/TH2.py index 3a5b328..0043adb 100644 --- a/uproot_methods/classes/TH2.py +++ b/uproot3_methods/classes/TH2.py @@ -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 diff --git a/uproot_methods/classes/TH3.py b/uproot3_methods/classes/TH3.py similarity index 98% rename from uproot_methods/classes/TH3.py rename to uproot3_methods/classes/TH3.py index 575a5a5..2d356f5 100644 --- a/uproot_methods/classes/TH3.py +++ b/uproot3_methods/classes/TH3.py @@ -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 diff --git a/uproot_methods/classes/THnSparse.py b/uproot3_methods/classes/THnSparse.py similarity index 60% rename from uproot_methods/classes/THnSparse.py rename to uproot3_methods/classes/THnSparse.py index 886cfe8..5419c5d 100644 --- a/uproot_methods/classes/THnSparse.py +++ b/uproot3_methods/classes/THnSparse.py @@ -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)) diff --git a/uproot_methods/classes/TLorentzVector.py b/uproot3_methods/classes/TLorentzVector.py similarity index 91% rename from uproot_methods/classes/TLorentzVector.py rename to uproot3_methods/classes/TLorentzVector.py index 1599490..fca23e9 100644 --- a/uproot_methods/classes/TLorentzVector.py +++ b/uproot3_methods/classes/TLorentzVector.py @@ -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 math import numbers @@ -11,9 +11,9 @@ import awkward0.array.objects import awkward0.util -import uproot_methods.base -import uproot_methods.common.TVector -import uproot_methods.classes.TVector3 +import uproot3_methods.base +import uproot3_methods.common.TVector +import uproot3_methods.classes.TVector3 class Common(object): @property @@ -86,7 +86,7 @@ def delta_r2(self, other): return (self.eta - other.eta)**2 + self.delta_phi(other)**2 def _rotate_axis(self, axis, angle): - if not isinstance(axis, uproot_methods.classes.TVector3.Common): + if not isinstance(axis, uproot3_methods.classes.TVector3.Common): raise TypeError("axis must be an (array of) TVector3") p3 = self.p3._rotate_axis(axis, angle) return p3, self.t @@ -95,13 +95,13 @@ def _rotate_euler(self, phi, theta, psi): return self.p3._rotate_euler(phi, theta, psi), self.t def rotatex(self, angle): - return self.rotate_axis(uproot_methods.classes.TVector3.TVector3(1.0, 0.0, 0.0), angle) + return self.rotate_axis(uproot3_methods.classes.TVector3.TVector3(1.0, 0.0, 0.0), angle) def rotatey(self, angle): - return self.rotate_axis(uproot_methods.classes.TVector3.TVector3(0.0, 1.0, 0.0), angle) + return self.rotate_axis(uproot3_methods.classes.TVector3.TVector3(0.0, 1.0, 0.0), angle) def rotatez(self, angle): - return self.rotate_axis(uproot_methods.classes.TVector3.TVector3(0.0, 0.0, 1.0), angle) + return self.rotate_axis(uproot3_methods.classes.TVector3.TVector3(0.0, 0.0, 1.0), angle) def isspacelike(self, tolerance=1e-10): return self.mag2 < -tolerance @@ -121,7 +121,7 @@ def __le__(self, other): def __ge__(self, other): raise TypeError("Lorentz vectors have no natural ordering") -class ArrayMethods(Common, uproot_methods.base.ROOTMethods): +class ArrayMethods(Common, uproot3_methods.base.ROOTMethods): def _initObjectArray(self, table): self.awkward0.ObjectArray.__init__(self, table, lambda row: TLorentzVector(row["fX"], row["fY"], row["fZ"], row["fE"])) @@ -129,7 +129,7 @@ def __awkward_serialize__(self, serializer): self._valid() x, y, z, t = self.x, self.y, self.z, self.t return serializer.encode_call( - ["uproot_methods.classes.TLorentzVector", "TLorentzVectorArray", "from_cartesian"], + ["uproot3_methods.classes.TLorentzVector", "TLorentzVectorArray", "from_cartesian"], serializer(x, "TLorentzVectorArray.x"), serializer(y, "TLorentzVectorArray.y"), serializer(z, "TLorentzVectorArray.z"), @@ -138,18 +138,18 @@ def __awkward_serialize__(self, serializer): @staticmethod def _wrapmethods(node, awkwardlib): if isinstance(node, awkward0.array.chunked.ChunkedArray): - node.__class__ = type("ChunkedArrayMethods", (awkwardlib.ChunkedArray, uproot_methods.classes.TVector3.ArrayMethods), {}) + node.__class__ = type("ChunkedArrayMethods", (awkwardlib.ChunkedArray, uproot3_methods.classes.TVector3.ArrayMethods), {}) for chunk in node.chunks: ArrayMethods._wrapmethods(chunk, awkwardlib) elif isinstance(node, awkward0.array.jagged.JaggedArray): - node.__class__ = type("JaggedArrayMethods", (awkwardlib.JaggedArray, uproot_methods.classes.TVector3.ArrayMethods), {}) + node.__class__ = type("JaggedArrayMethods", (awkwardlib.JaggedArray, uproot3_methods.classes.TVector3.ArrayMethods), {}) ArrayMethods._wrapmethods(node.content, awkwardlib) elif isinstance(node, awkward0.array.objects.ObjectArray): - node.__class__ = type("ObjectArrayMethods", (awkwardlib.ObjectArray, uproot_methods.classes.TVector3.ArrayMethods), {}) + node.__class__ = type("ObjectArrayMethods", (awkwardlib.ObjectArray, uproot3_methods.classes.TVector3.ArrayMethods), {}) @property def p3(self): - out = self.empty_like(generator=lambda row: uproot_methods.classes.TVector3.TVector3(row["fX"], row["fY"], row["fZ"])) + out = self.empty_like(generator=lambda row: uproot3_methods.classes.TVector3.TVector3(row["fX"], row["fY"], row["fZ"])) ArrayMethods._wrapmethods(out, self.awkward0) out["fX"] = self.x out["fY"] = self.y @@ -208,18 +208,18 @@ def unit(self): @property def boostp3(self): - out = self.empty_like(generator=lambda row: uproot_methods.classes.TVector3.TVector3(row["fX"], row["fY"], row["fZ"])) + out = self.empty_like(generator=lambda row: uproot3_methods.classes.TVector3.TVector3(row["fX"], row["fY"], row["fZ"])) if isinstance(self, self.awkward0.JaggedArray): - out.__class__ = type("JaggedArrayMethods", (self.awkward0.JaggedArray, uproot_methods.classes.TVector3.ArrayMethods), {}) + out.__class__ = type("JaggedArrayMethods", (self.awkward0.JaggedArray, uproot3_methods.classes.TVector3.ArrayMethods), {}) else: - out.__class__ = type("ObjectArrayMethods", (self.awkward0.ObjectArray, uproot_methods.classes.TVector3.ArrayMethods), {}) + out.__class__ = type("ObjectArrayMethods", (self.awkward0.ObjectArray, uproot3_methods.classes.TVector3.ArrayMethods), {}) out["fX"] = self.x / self.t out["fY"] = self.y / self.t out["fZ"] = self.z / self.t return out def boost(self, p3): - if not isinstance(p3, (uproot_methods.classes.TVector3.ArrayMethods, uproot_methods.classes.TVector3.Methods)): + if not isinstance(p3, (uproot3_methods.classes.TVector3.ArrayMethods, uproot3_methods.classes.TVector3.Methods)): raise TypeError("boost p3 must be an (array of) TVector3") b2 = p3.mag2 @@ -329,7 +329,7 @@ def __awkward_serialize__(self, serializer): self._valid() pt, eta, phi, mass = self.pt, self.eta, self.phi, self.mass return serializer.encode_call( - ["uproot_methods.classes.TLorentzVector", "TLorentzVectorArray", "from_ptetaphim"], + ["uproot3_methods.classes.TLorentzVector", "TLorentzVectorArray", "from_ptetaphim"], serializer(pt, "TLorentzVectorArray.pt"), serializer(eta, "TLorentzVectorArray.eta"), serializer(phi, "TLorentzVectorArray.phi"), @@ -442,7 +442,7 @@ def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): PtEtaPhiMassJaggedArrayMethods = PtEtaPhiMassArrayMethods.mixin(PtEtaPhiMassArrayMethods, awkward0.JaggedArray) -class Methods(Common, uproot_methods.base.ROOTMethods): +class Methods(Common, uproot3_methods.base.ROOTMethods): _arraymethods = ArrayMethods @property @@ -537,10 +537,10 @@ def unit(self): @property def boostp3(self): - return uproot_methods.classes.TVector3.TVector3(self.x/self.t, self.y/self.t, self.z/self.t) + return uproot3_methods.classes.TVector3.TVector3(self.x/self.t, self.y/self.t, self.z/self.t) def boost(self, p3): - if not isinstance(p3, uproot_methods.classes.TVector3.Methods): + if not isinstance(p3, uproot3_methods.classes.TVector3.Methods): raise TypeError("boost p3 must be a TVector3") b2 = p3.mag2 @@ -720,7 +720,7 @@ def mt2(self): @property def p3(self): - return uproot_methods.classes.TVector3.TVector3(self.x, self.y, self.z) + return uproot3_methods.classes.TVector3.TVector3(self.x, self.y, self.z) @property def x(self): @@ -745,7 +745,7 @@ def t(self): def __repr__(self): return "PtEtaPhiMassLorentzVector(pt={0:.5g}, eta={1:.5g}, phi={2:.5g}, mass={3:.5g})".format(self._fPt, self._fEta, self._fPhi, self._fMass) -class PtEtaPhiMassLorentzVectorArray(PtEtaPhiMassArrayMethods, uproot_methods.base.ROOTMethods.awkward0.ObjectArray): +class PtEtaPhiMassLorentzVectorArray(PtEtaPhiMassArrayMethods, uproot3_methods.base.ROOTMethods.awkward0.ObjectArray): def __init__(self, pt, eta, phi, mass): if isinstance(pt, awkward0.array.jagged.JaggedArray) or isinstance(eta, awkward0.array.jagged.JaggedArray) or isinstance(phi, awkward0.array.jagged.JaggedArray) or isinstance(mass, awkward0.array.jagged.JaggedArray): raise TypeError("PtEtaPhiMassLorentzVectorArray constructor arguments must not be jagged; use TLorentzVectorArray.from_ptetaphim for jaggedness-handling") @@ -787,7 +787,7 @@ def mass(self): def mass(self, value): self["fMass"] = value -class TLorentzVectorArray(ArrayMethods, uproot_methods.base.ROOTMethods.awkward0.ObjectArray): +class TLorentzVectorArray(ArrayMethods, uproot3_methods.base.ROOTMethods.awkward0.ObjectArray): def __init__(self, x, y, z, t): if isinstance(x, awkward0.array.jagged.JaggedArray) or isinstance(y, awkward0.array.jagged.JaggedArray) or isinstance(z, awkward0.array.jagged.JaggedArray) or isinstance(t, awkward0.array.jagged.JaggedArray): @@ -823,12 +823,12 @@ def from_cartesian(cls, x, y, z, t): @classmethod @awkward0.util.wrapjaggedmethod(JaggedArrayMethods) def from_spherical(cls, r, theta, phi, t): - return cls.from_p3(uproot_methods.classes.TVector3.TVector3Array.from_spherical(r, theta, phi), t) + return cls.from_p3(uproot3_methods.classes.TVector3.TVector3Array.from_spherical(r, theta, phi), t) @classmethod @awkward0.util.wrapjaggedmethod(JaggedArrayMethods) def from_cylindrical(cls, rho, phi, z, t): - return cls.from_p3(uproot_methods.classes.TVector3.TVector3Array.from_cylindrical(rho, phi, z), t) + return cls.from_p3(uproot3_methods.classes.TVector3.TVector3Array.from_cylindrical(rho, phi, z), t) @classmethod @awkward0.util.wrapjaggedmethod(JaggedArrayMethods) @@ -937,7 +937,7 @@ def mass(self, value): class TLorentzVector(Methods): def __init__(self, x, y, z, t): - self._fP = uproot_methods.classes.TVector3.TVector3(float(x), float(y), float(z)) + self._fP = uproot3_methods.classes.TVector3.TVector3(float(x), float(y), float(z)) self._fE = float(t) @classmethod @@ -953,11 +953,11 @@ def from_p3(cls, p3, t): @classmethod def from_spherical(cls, r, theta, phi, t): - return cls.from_p3(uproot_methods.classes.TVector3.Methods.from_spherical(r, theta, phi), t) + return cls.from_p3(uproot3_methods.classes.TVector3.Methods.from_spherical(r, theta, phi), t) @classmethod def from_cylindrical(cls, rho, phi, z, t): - return cls.from_p3(uproot_methods.classes.TVector3.Methods.from_cylindrical(rho, phi, z), t) + return cls.from_p3(uproot3_methods.classes.TVector3.Methods.from_cylindrical(rho, phi, z), t) @classmethod def from_xyzm(cls, x, y, z, m): diff --git a/uproot_methods/classes/TParameter.py b/uproot3_methods/classes/TParameter.py similarity index 88% rename from uproot_methods/classes/TParameter.py rename to uproot3_methods/classes/TParameter.py index 5ceb568..b7ebbbe 100644 --- a/uproot_methods/classes/TParameter.py +++ b/uproot3_methods/classes/TParameter.py @@ -1,4 +1,4 @@ -import uproot_methods.base +import uproot3_methods.base def _decode(seq): @@ -8,7 +8,7 @@ def _decode(seq): return seq -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(_decode(self._classname), id(self)) diff --git a/uproot_methods/classes/TVector2.py b/uproot3_methods/classes/TVector2.py similarity index 93% rename from uproot_methods/classes/TVector2.py rename to uproot3_methods/classes/TVector2.py index c824f76..b8964fa 100644 --- a/uproot_methods/classes/TVector2.py +++ b/uproot3_methods/classes/TVector2.py @@ -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 math import numbers @@ -8,8 +8,8 @@ import awkward0.array.jagged import awkward0.util -import uproot_methods.common.TVector -import uproot_methods.base +import uproot3_methods.common.TVector +import uproot3_methods.base class Common(object): def dot(self, other): @@ -24,7 +24,7 @@ def _rotate(self, angle): y = self.x*s + self.y*c return x, y -class ArrayMethods(Common, uproot_methods.common.TVector.ArrayMethods, uproot_methods.base.ROOTMethods): +class ArrayMethods(Common, uproot3_methods.common.TVector.ArrayMethods, uproot3_methods.base.ROOTMethods): def _initObjectArray(self, table): self.awkward0.ObjectArray.__init__(self, table, lambda row: TVector2(row["fX"], row["fY"])) @@ -32,7 +32,7 @@ def __awkward_serialize__(self, serializer): self._valid() x, y = self.x, self.y return serializer.encode_call( - ["uproot_methods.classes.TVector2", "TVector2Array", "from_cartesian"], + ["uproot3_methods.classes.TVector2", "TVector2Array", "from_cartesian"], serializer(x, "TVector3Array.x"), serializer(y, "TVector3Array.y")) @@ -93,7 +93,7 @@ def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): JaggedArrayMethods = ArrayMethods.mixin(ArrayMethods, awkward0.JaggedArray) -class Methods(Common, uproot_methods.common.TVector.Methods, uproot_methods.base.ROOTMethods): +class Methods(Common, uproot3_methods.common.TVector.Methods, uproot3_methods.base.ROOTMethods): _arraymethods = ArrayMethods @property @@ -136,7 +136,7 @@ def rotate(self, angle): x, y = self._rotate(angle) return TVector2(x, y) -class TVector2Array(ArrayMethods, uproot_methods.base.ROOTMethods.awkward0.ObjectArray): +class TVector2Array(ArrayMethods, uproot3_methods.base.ROOTMethods.awkward0.ObjectArray): def __init__(self, x, y): if isinstance(x, awkward0.array.jagged.JaggedArray) or isinstance(y, awkward0.array.jagged.JaggedArray): diff --git a/uproot_methods/classes/TVector3.py b/uproot3_methods/classes/TVector3.py similarity index 95% rename from uproot_methods/classes/TVector3.py rename to uproot3_methods/classes/TVector3.py index 8370bfd..7099698 100644 --- a/uproot_methods/classes/TVector3.py +++ b/uproot3_methods/classes/TVector3.py @@ -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 math import numbers @@ -8,8 +8,8 @@ import awkward0.array.jagged import awkward0.util -import uproot_methods.base -import uproot_methods.common.TVector +import uproot3_methods.base +import uproot3_methods.common.TVector class Common(object): def dot(self, other): @@ -79,7 +79,7 @@ def rotatey(self, angle): def rotatez(self, angle): return self.rotate_axis(TVector3(0.0, 0.0, 1.0), angle) -class ArrayMethods(Common, uproot_methods.common.TVector.ArrayMethods, uproot_methods.base.ROOTMethods): +class ArrayMethods(Common, uproot3_methods.common.TVector.ArrayMethods, uproot3_methods.base.ROOTMethods): def _initObjectArray(self, table): self.awkward0.ObjectArray.__init__(self, table, lambda row: TVector3(row["fX"], row["fY"], row["fZ"])) @@ -87,7 +87,7 @@ def __awkward_serialize__(self, serializer): self._valid() x, y, z = self.x, self.y, self.z return serializer.encode_call( - ["uproot_methods.classes.TVector3", "TVector3Array", "from_cartesian"], + ["uproot3_methods.classes.TVector3", "TVector3Array", "from_cartesian"], serializer(x, "TVector3Array.x"), serializer(y, "TVector3Array.y"), serializer(z, "TVector3Array.z")) @@ -175,7 +175,7 @@ def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): JaggedArrayMethods = ArrayMethods.mixin(ArrayMethods, awkward0.JaggedArray) -class Methods(Common, uproot_methods.common.TVector.Methods, uproot_methods.base.ROOTMethods): +class Methods(Common, uproot3_methods.common.TVector.Methods, uproot3_methods.base.ROOTMethods): _arraymethods = ArrayMethods @property @@ -245,7 +245,7 @@ def rotate_axis(self, axis, angle): def rotate_euler(self, phi=0, theta=0, psi=0): return TVector3(x, y, z) -class TVector3Array(ArrayMethods, uproot_methods.base.ROOTMethods.awkward0.ObjectArray): +class TVector3Array(ArrayMethods, uproot3_methods.base.ROOTMethods.awkward0.ObjectArray): def __init__(self, x, y, z): if isinstance(x, awkward0.array.jagged.JaggedArray) or isinstance(y, awkward0.array.jagged.JaggedArray) or isinstance(z, awkward0.array.jagged.JaggedArray): diff --git a/uproot_methods/classes/__init__.py b/uproot3_methods/classes/__init__.py similarity index 96% rename from uproot_methods/classes/__init__.py rename to uproot3_methods/classes/__init__.py index fcdbfb5..c4ddbf9 100644 --- a/uproot_methods/classes/__init__.py +++ b/uproot3_methods/classes/__init__.py @@ -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 def hasmethods(name): if name not in globals(): diff --git a/uproot_methods/common/TVector.py b/uproot3_methods/common/TVector.py similarity index 99% rename from uproot_methods/common/TVector.py rename to uproot3_methods/common/TVector.py index 2f89756..3bf7e2d 100644 --- a/uproot_methods/common/TVector.py +++ b/uproot3_methods/common/TVector.py @@ -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 math import numbers diff --git a/uproot_methods/profiles/cms/__init__.py b/uproot3_methods/common/__init__.py similarity index 74% rename from uproot_methods/profiles/cms/__init__.py rename to uproot3_methods/common/__init__.py index 9831512..79cb8b0 100644 --- a/uproot_methods/profiles/cms/__init__.py +++ b/uproot3_methods/common/__init__.py @@ -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 diff --git a/uproot_methods/convert.py b/uproot3_methods/convert.py similarity index 77% rename from uproot_methods/convert.py rename to uproot3_methods/convert.py index d2f71da..199f1ee 100644 --- a/uproot_methods/convert.py +++ b/uproot3_methods/convert.py @@ -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 importlib @@ -28,33 +28,33 @@ def types(cls, obj): # made with numpy.histogram elif isinstance(obj, tuple) and len(obj) == 2 and any(x[:2] == ("numpy", "ndarray") for x in types(obj[0].__class__, obj[0])) and any(x[:2] == ("numpy", "ndarray") for x in types(obj[1].__class__, obj[1])) and len(obj[0].shape) == 1 and len(obj[1].shape) == 1 and obj[0].shape[0] == obj[1].shape[0] - 1: - return ("uproot_methods.classes.TH1", "from_numpy", "uproot3.write.objects.TH", "TH") + return ("uproot3_methods.classes.TH1", "from_numpy", "uproot3.write.objects.TH", "TH") # made with numpy.histogram2d elif isinstance(obj, tuple) and len(obj) == 3 and any(x[:2] == ("numpy", "ndarray") for x in types(obj[0].__class__, obj[0])) and any(x[:2] == ("numpy", "ndarray") for x in types(obj[1].__class__, obj[1])) and any(x[:2] == ("numpy", "ndarray") for x in types(obj[2].__class__, obj[2])) and len(obj[0].shape) == 2 and len(obj[1].shape) == 1 and len(obj[2].shape) == 1 and obj[0].shape[0] == obj[1].shape[0] - 1 and obj[0].shape[1] == obj[2].shape[0] - 1: - return ("uproot_methods.classes.TH2", "from_numpy", "uproot3.write.objects.TH", "TH") + return ("uproot3_methods.classes.TH2", "from_numpy", "uproot3.write.objects.TH", "TH") # made with numpy.histogramdd (2-dimensional) elif isinstance(obj, tuple) and len(obj) == 2 and any(x[:2] == ("numpy", "ndarray") for x in types(obj[0].__class__, obj[0])) and isinstance(obj[1], list) and len(obj[1]) == 2 and any(x[:2] == ("numpy", "ndarray") for x in types(obj[1][0].__class__, obj[1][0])) and any(x[:2] == ("numpy", "ndarray") for x in types(obj[1][1].__class__, obj[1][1])) and len(obj[0].shape) == 2 and len(obj[1][0].shape) == 1 and len(obj[1][1].shape) == 1 and obj[0].shape[0] == obj[1][0].shape[0] - 1 and obj[0].shape[1] == obj[1][1].shape[0] - 1: - return ("uproot_methods.classes.TH2", "from_numpy", "uproot3.write.objects.TH", "TH") + return ("uproot3_methods.classes.TH2", "from_numpy", "uproot3.write.objects.TH", "TH") elif any(x[:3] == ("pandas.core.frame", "DataFrame", "IntervalIndex") and "count" in x[3] for x in types(obj.__class__, obj)): - return ("uproot_methods.classes.TH1", "from_pandas", "uproot3.write.objects.TH", "TH") + return ("uproot3_methods.classes.TH1", "from_pandas", "uproot3.write.objects.TH", "TH") elif any(x == ("physt.histogram1d", "Histogram1D") for x in types(obj.__class__, obj)): - return ("uproot_methods.classes.TH1", "from_physt", "uproot3.write.objects.TH", "TH") + return ("uproot3_methods.classes.TH1", "from_physt", "uproot3.write.objects.TH", "TH") - elif any(x == ("uproot_methods.classes.TH1", "Methods") or x == ("TH1", "Methods") for x in types(obj.__class__, obj)): + elif any(x == ("uproot3_methods.classes.TH1", "Methods") or x == ("TH1", "Methods") for x in types(obj.__class__, obj)): return (None, None, "uproot3.write.objects.TH", "TH") - elif any(x == ("uproot_methods.classes.TH2", "Methods") or x == ("TH2", "Methods") for x in types(obj.__class__, obj)): + elif any(x == ("uproot3_methods.classes.TH2", "Methods") or x == ("TH2", "Methods") for x in types(obj.__class__, obj)): return (None, None, "uproot3.write.objects.TH", "TH") - elif any(x == ("uproot_methods.classes.TH3", "Methods") or x == ("TH3", "Methods") for x in types(obj.__class__, obj)): + elif any(x == ("uproot3_methods.classes.TH3", "Methods") or x == ("TH3", "Methods") for x in types(obj.__class__, obj)): return (None, None, "uproot3.write.objects.TH", "TH") else: - raise TypeError("type {0} from module {1} is not writeable by uproot".format(obj.__class__.__name__, obj.__class__.__module__)) + raise TypeError("type {0} from module {1} is not writeable by uproot3".format(obj.__class__.__name__, obj.__class__.__module__)) convertmod, convertfcn, mod, cls = resolve(obj) diff --git a/uproot_methods/profiles/__init__.py b/uproot3_methods/profiles/__init__.py similarity index 71% rename from uproot_methods/profiles/__init__.py rename to uproot3_methods/profiles/__init__.py index 681e1eb..6abe456 100644 --- a/uproot_methods/profiles/__init__.py +++ b/uproot3_methods/profiles/__init__.py @@ -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 importlib import re @@ -9,4 +9,4 @@ def transformer(name): m = re.match(r"^([a-zA-Z_][a-zA-Z_0-9]*)(\.[a-zA-Z_][a-zA-Z_0-9]*)*$", name) if m is None: raise ValueError("profile name must match \"identifier(.identifier)*\"") - return getattr(importlib.import_module("uproot_methods.profiles." + m.string), "transform") + return getattr(importlib.import_module("uproot3_methods.profiles." + m.string), "transform") diff --git a/uproot_methods/common/__init__.py b/uproot3_methods/profiles/cms/__init__.py similarity index 74% rename from uproot_methods/common/__init__.py rename to uproot3_methods/profiles/cms/__init__.py index 9831512..79cb8b0 100644 --- a/uproot_methods/common/__init__.py +++ b/uproot3_methods/profiles/cms/__init__.py @@ -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 diff --git a/uproot_methods/profiles/cms/nanoaod.py b/uproot3_methods/profiles/cms/nanoaod.py similarity index 96% rename from uproot_methods/profiles/cms/nanoaod.py rename to uproot3_methods/profiles/cms/nanoaod.py index 52bfbb6..4b01432 100644 --- a/uproot_methods/profiles/cms/nanoaod.py +++ b/uproot3_methods/profiles/cms/nanoaod.py @@ -1,12 +1,12 @@ #!/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.type import awkward0.array.chunked import awkward0.array.objects -import uproot_methods.classes.TLorentzVector +import uproot3_methods.classes.TLorentzVector def getcontent(virtual): return virtual.array.content @@ -16,7 +16,7 @@ def jaggedtable(rowname, counts, fields): JaggedArray = counts.JaggedArray ChunkedArray = counts.ChunkedArray VirtualArray = counts.VirtualArray - VirtualTLorentzVectorArray = awkward0.array.objects.Methods.mixin(uproot_methods.classes.TLorentzVector.PtEtaPhiMassArrayMethods, VirtualArray) + VirtualTLorentzVectorArray = awkward0.array.objects.Methods.mixin(uproot3_methods.classes.TLorentzVector.PtEtaPhiMassArrayMethods, VirtualArray) countsarray = counts.array if isinstance(countsarray, awkward0.array.chunked.ChunkedArray): @@ -28,7 +28,7 @@ def jaggedtable(rowname, counts, fields): table[n] = VirtualArray(getcontent, x, type=awkward0.type.ArrayType(offsets[-1], x.type.to.to), cache=counts.cache, persistvirtual=counts.persistvirtual) columns = table.columns if "pt" in columns and "eta" in columns and "phi" in columns and "mass" in columns and "p4" not in columns: - table["p4"] = VirtualTLorentzVectorArray(uproot_methods.classes.TLorentzVector.TLorentzVectorArray.from_ptetaphim, (table["pt"], table["eta"], table["phi"], table["mass"]), type=awkward0.type.ArrayType(offsets[-1], uproot_methods.classes.TLorentzVector.PtEtaPhiMassLorentzVectorArray), cache=counts.cache, persistvirtual=counts.persistvirtual) + table["p4"] = VirtualTLorentzVectorArray(uproot3_methods.classes.TLorentzVector.TLorentzVectorArray.from_ptetaphim, (table["pt"], table["eta"], table["phi"], table["mass"]), type=awkward0.type.ArrayType(offsets[-1], uproot3_methods.classes.TLorentzVector.PtEtaPhiMassLorentzVectorArray), cache=counts.cache, persistvirtual=counts.persistvirtual) return JaggedArray.fromoffsets(offsets, table) def lazyjagged(countsarray, rowname, fields): @@ -45,7 +45,7 @@ def lazyjagged(countsarray, rowname, fields): tabletype[fieldname] = field.type.to.to columns = tabletype.columns if "pt" in columns and "eta" in columns and "phi" in columns and "mass" in columns and "p4" not in columns: - tabletype["p4"] = uproot_methods.classes.TLorentzVector.TLorentzVectorArray.from_ptetaphim + tabletype["p4"] = uproot3_methods.classes.TLorentzVector.TLorentzVectorArray.from_ptetaphim chunks.append(VirtualArray(jaggedtable, (rowname, countschunk, fieldschunks), type=awkward0.type.ArrayType(len(countschunk), float("inf"), tabletype), cache=countschunk.cache, persistvirtual=countschunk.persistvirtual)) return ChunkedArray(chunks, countsarray.chunksizes) diff --git a/uproot_methods/version.py b/uproot3_methods/version.py similarity index 77% rename from uproot_methods/version.py rename to uproot3_methods/version.py index 855b669..c3eb08c 100644 --- a/uproot_methods/version.py +++ b/uproot3_methods/version.py @@ -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 re -__version__ = "0.9.1" +__version__ = "0.10.0" version = __version__ version_info = tuple(re.split(r"[-\.]", __version__)) diff --git a/uproot_methods/__init__.py b/uproot_methods/__init__.py deleted file mode 100644 index d1f6270..0000000 --- a/uproot_methods/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python - -# BSD 3-Clause License; see https://github.com/scikit-hep/uproot-methods/blob/master/LICENSE - -from uproot_methods.classes.TVector2 import TVector2, TVector2Array -from uproot_methods.classes.TVector3 import TVector3, TVector3Array -from uproot_methods.classes.TLorentzVector import TLorentzVector, TLorentzVectorArray, PtEtaPhiMassLorentzVector - -# convenient access to the version number -from uproot_methods.version import __version__