Skip to content
This repository was archived by the owner on Jun 21, 2022. It is now read-only.

Commit ac6c62e

Browse files
authored
Depend on uproot3-methods, rather than uproot-methods. (#529)
* Depend on uproot3-methods, rather than uproot-methods. * Version number gets a little closer to pi.
1 parent 8635299 commit ac6c62e

File tree

8 files changed

+53
-56
lines changed

8 files changed

+53
-56
lines changed

README.rst

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Strict dependencies:
6060

6161
- `numpy <https://scipy.org/install.html>`__ (1.13.1+)
6262
- `Awkward Array 0.x <https://github.com/scikit-hep/awkward-0.x>`__
63-
- `uproot-methods <https://github.com/scikit-hep/uproot-methods>`__ (0.9.1+)
63+
- `uproot3-methods <https://github.com/scikit-hep/uproot3-methods>`__
6464
- `cachetools <https://pypi.org/project/cachetools>`__
6565

6666
Optional dependencies:
@@ -178,7 +178,7 @@ In short, you should never see a segmentation fault.
178178
Uproot is strictly concerned with file I/O only—all other functionality
179179
is handled by other libraries:
180180

181-
- `uproot-methods <https://github.com/scikit-hep/uproot-methods>`__:
181+
- `uproot3-methods <https://github.com/scikit-hep/uproot3-methods>`__:
182182
physics methods for types read from ROOT files, such as histograms
183183
and Lorentz vectors. It is intended to be largely user-contributed
184184
(and is).
@@ -3157,10 +3157,10 @@ Special physics objects: Lorentz vectors
31573157
Although any C++ type can in principle be read (see below), some are
31583158
important enough to be given convenience methods for analysis. These are
31593159
not defined in Uproot (which is strictly concerned with I/O), but in
3160-
`uproot-methods <https://github.com/scikit-hep/uproot-methods>`__. If
3160+
`uproot3-methods <https://github.com/scikit-hep/uproot3-methods>`__. If
31613161
you need certain classes to have user-friendly methods in Python, you’re
31623162
encouraged to contribute them to
3163-
`uproot-methods <https://github.com/scikit-hep/uproot-methods>`__.
3163+
`uproot3-methods <https://github.com/scikit-hep/uproot3-methods>`__.
31643164

31653165
One of these classes is ``TLorentzVectorArray``, which defines an
31663166
*array* of Lorentz vectors.
@@ -3190,7 +3190,7 @@ at individuals.
31903190
31913191
muon = muons[0, 0]
31923192
type(muon), muon
3193-
# (uproot_methods.classes.TLorentzVector.TLorentzVector,
3193+
# (uproot3_methods.classes.TLorentzVector.TLorentzVector,
31943194
# TLorentzVector(-52.899, -11.655, -8.1608, 54.779))
31953195
31963196
This object has all the usual kinematics methods,
@@ -3211,10 +3211,7 @@ method on each).
32113211

32123212
.. code-block:: python3
32133213
3214-
muons.mass # some mass**2 are slightly negative, hence the Numpy warning about negative square roots
3215-
# /home/pivarski/miniconda3/lib/python3.7/site-packages/uproot_methods-0.6.1-py3.7.egg/uproot_methods/
3216-
# classes/TLorentzVector.py:189: RuntimeWarning: invalid value encountered in sqrt
3217-
# return self._trymemo("mass", lambda self: self.awkward0.numpy.sqrt(self.mag2))
3214+
muons.mass
32183215
# <JaggedArray [[0.10559298741436905 0.10545247041042287] [0.105499240400313]
32193216
# [0.10696309110601164 0.10513788128369116] ... [0.1054382466674704] [0.0975059956172863]
32203217
# [0.10447224169767522]] at 0x7f36246f8080>
@@ -3249,9 +3246,9 @@ need to use a special constructor to build the object from its branches.
32493246
32503247
.. code-block:: python3
32513248
3252-
import uproot_methods
3249+
import uproot3_methods
32533250
3254-
array = uproot_methods.TLorentzVectorArray.from_cartesian(px, py, pz, E)
3251+
array = uproot3_methods.TLorentzVectorArray.from_cartesian(px, py, pz, E)
32553252
array
32563253
# <JaggedArrayMethods [[TLorentzVector(-52.899, -11.655, -8.1608, 54.779)
32573254
# TLorentzVector(37.738, 0.69347, -11.308, 39.402)]
@@ -3268,7 +3265,7 @@ converts to other systems on demand.
32683265

32693266
.. code-block:: python3
32703267
3271-
[x for x in dir(uproot_methods.TLorentzVectorArray) if x.startswith("from_")]
3268+
[x for x in dir(uproot3_methods.TLorentzVectorArray) if x.startswith("from_")]
32723269
# ['from_cartesian',
32733270
# 'from_cylindrical',
32743271
# 'from_p3',
@@ -3569,7 +3566,7 @@ between ``uproot3.asobj``
35693566
35703567
# TLorentzVectors all have the same number of fixed width components, so they can be read vectorially.
35713568
events3["muonp4"].interpretation
3572-
# asjagged(asobj(<uproot_methods.classes.TLorentzVector.Methods>), 10)
3569+
# asjagged(asobj(<uproot3_methods.classes.TLorentzVector.Methods>), 10)
35733570
35743571
.. code-block:: python3
35753572
@@ -3860,7 +3857,7 @@ Python. Here’s a way to find out which ones have been defined so far:
38603857
38613858
import pkgutil
38623859
3863-
[modname for importer, modname, ispkg in pkgutil.walk_packages(uproot_methods.classes.__path__)]
3860+
[modname for importer, modname, ispkg in pkgutil.walk_packages(uproot3_methods.classes.__path__)]
38643861
# ['TGraph',
38653862
# 'TGraphAsymmErrors',
38663863
# 'TGraphErrors',
@@ -4199,9 +4196,9 @@ or it may be created entirely in Python.
41994196
.. code-block:: python3
42004197
42014198
import types
4202-
import uproot_methods.classes.TH1
4199+
import uproot3_methods.classes.TH1
42034200
4204-
class MyTH1(uproot_methods.classes.TH1.Methods, list):
4201+
class MyTH1(uproot3_methods.classes.TH1.Methods, list):
42054202
def __init__(self, low, high, values, title=""):
42064203
self._fXaxis = types.SimpleNamespace()
42074204
self._fXaxis._fNbins = len(values)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
numpy>=1.13.1
22
awkward0
3-
uproot-methods>=0.9.1
3+
uproot3-methods
44
cachetools
55
backports.lzma;python_version<"3.3"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def get_description():
113113
license = "BSD 3-clause",
114114
test_suite = "tests",
115115
python_requires = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
116-
install_requires = ["numpy>=1.13.1", "awkward0", "uproot-methods>=0.9.1", "cachetools"],
116+
install_requires = ["numpy>=1.13.1", "awkward0", "uproot3-methods", "cachetools"],
117117
setup_requires = ["pytest-runner"],
118118
extras_require = {
119119
"testing": ["pytest>=3.9", "pkgconfig", "lz4", "zstandard", 'backports.lzma;python_version<"3.3"', "xxhash", "mock", "requests"],

tests/test_issues.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
import uproot3
1111
import awkward0
1212

13-
import uproot_methods.classes.TVector3
14-
import uproot_methods.classes.TLorentzVector
13+
import uproot3_methods.classes.TVector3
14+
import uproot3_methods.classes.TLorentzVector
1515

1616

1717
class Test(object):
@@ -123,15 +123,15 @@ def test_issue57(self):
123123
for x in tree["sel_lep"].array():
124124
for y in x:
125125
assert isinstance(
126-
y, uproot_methods.classes.TLorentzVector.
126+
y, uproot3_methods.classes.TLorentzVector.
127127
Methods) and isinstance(
128-
y._fP, uproot_methods.classes.TVector3.Methods)
128+
y._fP, uproot3_methods.classes.TVector3.Methods)
129129
for x in tree["selJet"].array():
130130
for y in x:
131131
assert isinstance(
132-
y, uproot_methods.classes.TLorentzVector.
132+
y, uproot3_methods.classes.TLorentzVector.
133133
Methods) and isinstance(
134-
y._fP, uproot_methods.classes.TVector3.Methods)
134+
y._fP, uproot3_methods.classes.TVector3.Methods)
135135

136136
def test_issue60(self):
137137
t = uproot3.open("tests/samples/issue60.root")["nllscan"]
@@ -200,10 +200,10 @@ def test_issue70(self):
200200
def test_issue74(self):
201201
t = uproot3.open("tests/samples/issue74.root")["Events"]
202202
assert all(
203-
isinstance(x[0], uproot_methods.classes.TVector3.Methods)
203+
isinstance(x[0], uproot3_methods.classes.TVector3.Methods)
204204
for x in t.array("bees.xyzPosition"))
205205
assert t.array("bees.xyzPosition"
206-
)[0][0] == uproot_methods.classes.TVector3.TVector3(
206+
)[0][0] == uproot3_methods.classes.TVector3.TVector3(
207207
1.0, 2.0, -1.0)
208208

209209
def test_issue76(self):
@@ -222,7 +222,7 @@ def test_issue79(self):
222222
def test_issue96(self):
223223
t = uproot3.open("tests/samples/issue96.root")["tree"]
224224
assert all(
225-
isinstance(x, uproot_methods.classes.TLorentzVector.Methods)
225+
isinstance(x, uproot3_methods.classes.TLorentzVector.Methods)
226226
for x in t.array("jet1P4"))
227227

228228
def test_geant4(self):

uproot3/rootio.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from uproot3.source.cursor import Cursor
2626
from uproot3._util import _tobytes
2727

28-
import uproot_methods.classes
28+
import uproot3_methods.classes
2929

3030
################################################################ high-level interface
3131

@@ -937,7 +937,7 @@ def _defineclasses(streamerinfos, classes):
937937
code.insert(0, " _fields = [{0}]".format(", ".join(repr(str(x)) for x in fields)))
938938
code.insert(0, " @classmethod\n def _recarray(cls):\n out = []\n out.append((' cnt', 'u4'))\n out.append((' vers', 'u2'))\n for base in cls._bases:\n out.extend(base._recarray())\n {0}\n return out".format("\n ".join(recarray)))
939939
code.insert(0, " _bases = [{0}]".format(", ".join(bases)))
940-
code.insert(0, " _methods = {0}".format("uproot_methods.classes.{0}.Methods".format(pyclassname) if uproot_methods.classes.hasmethods(pyclassname) else "None"))
940+
code.insert(0, " _methods = {0}".format("uproot3_methods.classes.{0}.Methods".format(pyclassname) if uproot3_methods.classes.hasmethods(pyclassname) else "None"))
941941

942942
if len(bases) == 0:
943943
bases.append("ROOTStreamedObject")
@@ -946,8 +946,8 @@ def _defineclasses(streamerinfos, classes):
946946
bases.insert(0, "uproot3.tree.TTreeMethods")
947947
if pyclassname == "TBranch":
948948
bases.insert(0, "uproot3.tree.TBranchMethods")
949-
if uproot_methods.classes.hasmethods(pyclassname):
950-
bases.insert(0, "uproot_methods.classes.{0}.Methods".format(pyclassname))
949+
if uproot3_methods.classes.hasmethods(pyclassname):
950+
bases.insert(0, "uproot3_methods.classes.{0}.Methods".format(pyclassname))
951951

952952
code.insert(0, "class {0}({1}):".format(pyclassname, ", ".join(bases)))
953953

@@ -1701,24 +1701,24 @@ def __repr__(self):
17011701
else:
17021702
return "<{0} at 0x{1:012x}>".format(self.__class__.__name__, id(self))
17031703

1704-
builtin_classes = {"uproot_methods": uproot_methods,
1705-
"TObject": TObject,
1706-
"TString": TString,
1707-
"TNamed": TNamed,
1708-
"TObjArray": TObjArray,
1709-
"TObjString": TObjString,
1710-
"TList": TList,
1711-
"THashList": THashList,
1712-
"TRef": TRef,
1713-
"TArray": TArray,
1714-
"TArrayC": TArrayC,
1715-
"TArrayS": TArrayS,
1716-
"TArrayI": TArrayI,
1717-
"TArrayL": TArrayL,
1718-
"TArrayL64": TArrayL64,
1719-
"TArrayF": TArrayF,
1720-
"TArrayD": TArrayD,
1721-
"TRefArray": TRefArray,
1704+
builtin_classes = {"uproot3_methods": uproot3_methods,
1705+
"TObject": TObject,
1706+
"TString": TString,
1707+
"TNamed": TNamed,
1708+
"TObjArray": TObjArray,
1709+
"TObjString": TObjString,
1710+
"TList": TList,
1711+
"THashList": THashList,
1712+
"TRef": TRef,
1713+
"TArray": TArray,
1714+
"TArrayC": TArrayC,
1715+
"TArrayS": TArrayS,
1716+
"TArrayI": TArrayI,
1717+
"TArrayL": TArrayL,
1718+
"TArrayL64": TArrayL64,
1719+
"TArrayF": TArrayF,
1720+
"TArrayD": TArrayD,
1721+
"TRefArray": TRefArray,
17221722
"ROOT_3a3a_TIOFeatures": ROOT_3a3a_TIOFeatures,
17231723
"ROOT_3a3a_Experimental_3a3a_RNTuple": ROOT_3a3a_Experimental_3a3a_RNTuple}
17241724

uproot3/tree.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import cachetools
2929

3030
import awkward0
31-
import uproot_methods.profiles
31+
import uproot3_methods.profiles
3232

3333
import uproot3.rootio
3434
from uproot3.rootio import _bytesid
@@ -643,7 +643,7 @@ def lazyarrays(self, branches=None, namedecode="utf-8", entrysteps=None, entryst
643643
out[name].__doc__ = branch.title.decode('ascii')
644644

645645
if profile is not None:
646-
out = uproot_methods.profiles.transformer(profile)(out)
646+
out = uproot3_methods.profiles.transformer(profile)(out)
647647
return out
648648

649649
def _normalize_entrysteps(self, entrysteps, branches, entrystart, entrystop, keycache):
@@ -2059,7 +2059,7 @@ def lazyarrays(path, treepath, branches=None, namedecode="utf-8", entrysteps=flo
20592059
out[name] = awkward0.ChunkedArray(chunks, counts)
20602060

20612061
if profile is not None:
2062-
out = uproot_methods.profiles.transformer(profile)(out)
2062+
out = uproot3_methods.profiles.transformer(profile)(out)
20632063
return out
20642064

20652065
def daskarray(path, treepath, branchname, interpretation=None, namedecode="utf-8", entrysteps=float("inf"), flatten=False, awkwardlib=None, cache=None, basketcache=None, keycache=None, executor=None, localsource=MemmapSource.defaults, xrootdsource=XRootDSource.defaults, httpsource=HTTPSource.defaults, **options):

uproot3/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import re
88

9-
__version__ = "3.14.0"
9+
__version__ = "3.14.1"
1010
version = __version__
1111
version_info = tuple(re.split(r"[-\.]", __version__))
1212

uproot3/write/TFile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from collections import Mapping
1616

1717

18-
import uproot_methods.convert
18+
import uproot3_methods.convert
1919

2020
import uproot3.const
2121
import uproot3.source.file
@@ -85,7 +85,7 @@ def __setitem__(self, where, what):
8585
self.util = Util()
8686
where, cycle = self._normalizewhere(where)
8787
if what.__class__.__name__ != "TTree" and what.__class__.__name__ != "newtree":
88-
what = uproot_methods.convert.towriteable(what)
88+
what = uproot3_methods.convert.towriteable(what)
8989
elif what.__class__.__name__ == "newtree":
9090
what = TTree(where, what, self)
9191
cursor = uproot3.write.sink.cursor.Cursor(self._fSeekFree)
@@ -124,7 +124,7 @@ def update(self, *args, **kwargs):
124124
isTTree = what.__class__.__name__ in ("newtree", "TTree")
125125
assert not isTTree # prevent TTree writing, otherwise migth invoke nasty magic
126126
if not isTTree:
127-
what = uproot_methods.convert.towriteable(what)
127+
what = uproot3_methods.convert.towriteable(what)
128128
elif what.__class__.__name__ == "newtree":
129129
what = TTree(where, what, self)
130130

0 commit comments

Comments
 (0)