Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First needs to work with nested loops #226

Merged
merged 5 commits into from
Jul 1, 2024
Merged

First needs to work with nested loops #226

merged 5 commits into from
Jul 1, 2024

Conversation

gordonwatts
Copy link
Member

@gordonwatts gordonwatts commented Jun 28, 2024

Fixes loops that occur after a .First() predicate. The below code now works.

We also normalized how we fetch the scope when accessing and filling the ntuple. This could introduce a bug, as it isn't clear how this should work in all contexts yet. Need a test to fail!

Fixes #225

pv_query = (
    ds
    .Select(lambda e: e.Vertices("PrimaryVertices"))
    .Select(lambda vtx: vtx.First())
)

track_query = (
    pv_query
    .Select(lambda v: v.trackParticleLinks().Where(lambda t: t.pt() > 500.0))
    .Select(lambda tracks: {
        "pt": tracks.Select(lambda t: t.pt()),
        "eta": tracks.Select(lambda t: t.eta()),
        "phi": tracks.Select(lambda t: t.phi()),
    })
)

tracks= track_query.AsAwkwardArray().value()

Copy link

codecov bot commented Jul 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.05%. Comparing base (7a7f9e4) to head (bd496c8).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #226      +/-   ##
==========================================
- Coverage   95.05%   95.05%   -0.01%     
==========================================
  Files          35       35              
  Lines        2003     2002       -1     
  Branches      265      265              
==========================================
- Hits         1904     1903       -1     
  Misses         64       64              
  Partials       35       35              
Flag Coverage Δ
unittests 95.05% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gordonwatts gordonwatts self-assigned this Jul 1, 2024
@gordonwatts gordonwatts added the bug Something isn't working label Jul 1, 2024
@gordonwatts gordonwatts changed the title First needs to work nested First needs to work with nested loops Jul 1, 2024
@gordonwatts gordonwatts merged commit b352b78 into master Jul 1, 2024
39 of 40 checks passed
@gordonwatts gordonwatts deleted the bug/first branch July 1, 2024 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

First scoping does not work with multiple later actions
1 participant