Skip to content

Commit

Permalink
Fixes lost cuts in iterate. (#195)
Browse files Browse the repository at this point in the history
* Fixes lost cuts in iterate.

* Black and Flake8.
  • Loading branch information
jpivarski authored Nov 19, 2020
1 parent c94fc03 commit b45bc50
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 17 additions & 0 deletions tests/test_0194-fix-lost-cuts-in-iterate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot4/blob/master/LICENSE

from __future__ import absolute_import

import numpy
import pytest
import skhep_testdata

import uproot4


def test():
with uproot4.open(skhep_testdata.data_path("uproot-Zmumu.root")) as f:
for arrays in f["events"].iterate(
"px1", step_size=1000, cut="px1 > 0", library="np"
):
assert numpy.all(arrays["px1"] > 0)
4 changes: 2 additions & 2 deletions uproot4/behaviors/TBranch.py
Original file line number Diff line number Diff line change
Expand Up @@ -1375,13 +1375,13 @@ def iterate(
self.object_path,
)

expression_context = [
minimized_expression_context = [
(e, c)
for e, c in expression_context
if c["is_primary"] and not c["is_cut"]
]

arrays = library.group(output, expression_context, how)
arrays = library.group(output, minimized_expression_context, how)

next_baskets = {}
for branch, basket_num, basket in ranges_or_baskets:
Expand Down

0 comments on commit b45bc50

Please sign in to comment.