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

Rename counter to size in TBranch UI #481

Merged
merged 1 commit into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions tests/test_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -1867,7 +1867,7 @@ def test_jagged_i4(tmp_path):
[10, 11, 12]])

with uproot.recreate(filename, compression=None) as f:
f["t"] = uproot.newtree({"branch": uproot.newbranch(numpy.dtype(">i4"), counter="n")})
f["t"] = uproot.newtree({"branch": uproot.newbranch(numpy.dtype(">i4"), size="n")})
f["t"].extend({"branch": a, "n": [1, 2, 3]})

f = ROOT.TFile.Open(filename)
Expand All @@ -1883,7 +1883,7 @@ def test_jagged_uproot_i4(tmp_path):
[10, 11, 12]])

with uproot.recreate(filename, compression=None) as f:
f["t"] = uproot.newtree({"branch": uproot.newbranch(numpy.dtype(">i4"), counter="n")})
f["t"] = uproot.newtree({"branch": uproot.newbranch(numpy.dtype(">i4"), size="n")})
f["t"].extend({"branch": a, "n": [1, 2, 3]})

f = uproot.open(filename)
Expand All @@ -1901,7 +1901,7 @@ def test_jagged_i8(tmp_path):
[10, 11, 12]])

with uproot.recreate(filename, compression=None) as f:
f["t"] = uproot.newtree({"branch": uproot.newbranch(numpy.dtype(">i8"), counter="n")})
f["t"] = uproot.newtree({"branch": uproot.newbranch(numpy.dtype(">i8"), size="n")})
f["t"].extend({"branch": a, "n": [1, 2, 3]})

ROOT.gInterpreter.Declare("""
Expand Down Expand Up @@ -1936,7 +1936,7 @@ def test_jagged_uproot_i8(tmp_path):
[10, 11, 12]])

with uproot.recreate(filename, compression=None) as f:
f["t"] = uproot.newtree({"branch": uproot.newbranch(numpy.dtype(">i8"), counter="n")})
f["t"] = uproot.newtree({"branch": uproot.newbranch(numpy.dtype(">i8"), size="n")})
f["t"].extend({"branch": a, "n": [1, 2, 3]})

f = uproot.open(filename)
Expand All @@ -1953,7 +1953,7 @@ def test_jagged_f8(tmp_path):
[10, 11, 12]])

with uproot.recreate(filename, compression=None) as f:
f["t"] = uproot.newtree({"branch": uproot.newbranch(numpy.dtype(">f8"), counter="n")})
f["t"] = uproot.newtree({"branch": uproot.newbranch(numpy.dtype(">f8"), size="n")})
f["t"].extend({"branch": a, "n": [1, 2, 3]})

f = ROOT.TFile.Open(filename)
Expand All @@ -1969,7 +1969,7 @@ def test_jagged_uproot_f8(tmp_path):
[10, 11, 12]])

with uproot.recreate(filename, compression=None) as f:
f["t"] = uproot.newtree({"branch": uproot.newbranch(numpy.dtype(">f8"), counter="n")})
f["t"] = uproot.newtree({"branch": uproot.newbranch(numpy.dtype(">f8"), size="n")})
f["t"].extend({"branch": a, "n": [1, 2, 3]})

f = uproot.open(filename)
Expand All @@ -1986,7 +1986,7 @@ def test_jagged_f4(tmp_path):
[10, 11, 12]])

with uproot.recreate(filename, compression=None) as f:
f["t"] = uproot.newtree({"branch": uproot.newbranch(numpy.dtype(">f4"), counter="n")})
f["t"] = uproot.newtree({"branch": uproot.newbranch(numpy.dtype(">f4"), size="n")})
f["t"].extend({"branch": a, "n": [1, 2, 3]})

f = ROOT.TFile.Open(filename)
Expand All @@ -2002,7 +2002,7 @@ def test_jagged_uproot_f4(tmp_path):
[10, 11, 12]])

with uproot.recreate(filename, compression=None) as f:
f["t"] = uproot.newtree({"branch": uproot.newbranch(numpy.dtype(">f4"), counter="n")})
f["t"] = uproot.newtree({"branch": uproot.newbranch(numpy.dtype(">f4"), size="n")})
f["t"].extend({"branch": a, "n": [1, 2, 3]})

f = uproot.open(filename)
Expand All @@ -2019,7 +2019,7 @@ def test_jagged_i2(tmp_path):
[10, 11, 12]])

with uproot.recreate(filename, compression=None) as f:
f["t"] = uproot.newtree({"branch": uproot.newbranch(numpy.dtype(">i2"), counter="n")})
f["t"] = uproot.newtree({"branch": uproot.newbranch(numpy.dtype(">i2"), size="n")})
f["t"].extend({"branch": a, "n": [1, 2, 3]})

f = ROOT.TFile.Open(filename)
Expand All @@ -2035,7 +2035,7 @@ def test_jagged_uproot_i2(tmp_path):
[10, 11, 12]])

with uproot.recreate(filename, compression=None) as f:
f["t"] = uproot.newtree({"branch": uproot.newbranch(numpy.dtype(">i2"), counter="n")})
f["t"] = uproot.newtree({"branch": uproot.newbranch(numpy.dtype(">i2"), size="n")})
f["t"].extend({"branch": a, "n": [1, 2, 3]})

f = uproot.open(filename)
Expand All @@ -2054,8 +2054,8 @@ def test_jagged_i2_multiple_sametype(tmp_path):
[7, 12]])

with uproot.recreate(filename, compression=None) as f:
f["t"] = uproot.newtree({"branch1": uproot.newbranch(numpy.dtype(">i2"), counter="n"),
"branch2": uproot.newbranch(numpy.dtype(">i2"), counter="n")})
f["t"] = uproot.newtree({"branch1": uproot.newbranch(numpy.dtype(">i2"), size="n"),
"branch2": uproot.newbranch(numpy.dtype(">i2"), size="n")})
f["t"].extend({"branch1": a,
"branch2": b,
"n": [1, 2]})
Expand All @@ -2076,8 +2076,8 @@ def test_jagged_multiple_difftype(tmp_path):
[7, 12]])

with uproot.recreate(filename, compression=None) as f:
f["t"] = uproot.newtree({"branch1": uproot.newbranch(numpy.dtype(">i2"), counter="n"),
"branch2": uproot.newbranch(numpy.dtype(">i4"), counter="n")})
f["t"] = uproot.newtree({"branch1": uproot.newbranch(numpy.dtype(">i2"), size="n"),
"branch2": uproot.newbranch(numpy.dtype(">i4"), size="n")})
f["t"].extend({"branch1": a,
"branch2": b,
"n": [1, 2]})
Expand All @@ -2098,8 +2098,8 @@ def test_jagged_i2_multiple_difflen(tmp_path):
[10, 11, 12]])

with uproot.recreate(filename, compression=None) as f:
f["t"] = uproot.newtree({"branch1": uproot.newbranch(numpy.dtype(">i2"), counter="n1"),
"branch2": uproot.newbranch(numpy.dtype(">i2"), counter="n2")})
f["t"] = uproot.newtree({"branch1": uproot.newbranch(numpy.dtype(">i2"), size="n1"),
"branch2": uproot.newbranch(numpy.dtype(">i2"), size="n2")})
f["t"].extend({"branch1": a,
"n1": [1, 2],
"branch2": b,
Expand All @@ -2126,7 +2126,7 @@ def test_jagged_i4_manybasket(tmp_path):
[11, 12]])

with uproot.recreate(filename, compression=None) as f:
f["t"] = uproot.newtree({"branch": uproot.newbranch(numpy.dtype(">i4"), counter="n")})
f["t"] = uproot.newtree({"branch": uproot.newbranch(numpy.dtype(">i4"), size="n")})
f["t"].extend({"branch": a, "n": [1, 2, 3]})
f["t"].extend({"branch": b, "n": [1, 2]})

Expand Down
4 changes: 2 additions & 2 deletions uproot/write/objects/TTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@

class newbranch(object):

def __init__(self, type, title="", shape=(1,), counter=None, **options):
def __init__(self, type, title="", shape=(1,), size=None, **options):
self.name = ""
self.type = type
self.title = title
self.shape = shape
self.counter = counter
self.counter = size
self._iscounter = False
if "compression" in options:
self.compression = options["compression"]
Expand Down