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

Update 04-awkward.md #62

Merged
merged 2 commits into from
Dec 6, 2023
Merged
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
15 changes: 15 additions & 0 deletions _episodes/04-awkward.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,21 @@ cleaned = muon_pt[particle_cut]

intermediary and you can't use the variable `event_cut`, as-is.


Hint: the final result should be a jagged array, just like muon_pt, but with fewer lists and fewer items in those lists.

> ## Solution (no peeking!)
> ```python
> cleaned = muon_pt[particle_cut]
> final_result = cleaned[event_cut]
> final_result.tolist()
> [[32.911224365234375, 23.72175407409668],
> [57.6067008972168, 53.04507827758789],
> [23.906352996826172]]
> ```
{: .solution}


# Combinatorics in Awkward Array

Variable-length lists present more problems than just slicing and computing formulas array-at-a-time. Often, we want to combine particles in all possible pairs (within each event) to look for decay chains.
Expand Down