From b4e05ab3f35fe4462559f3fff8e06590c706c87e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20A=2E=20Fidalgo-Rodr=C3=ADguez?= Date: Mon, 4 Dec 2023 15:33:23 -0400 Subject: [PATCH 1/2] Update 04-awkward.md added hint and solution block for awkward quizz --- _episodes/04-awkward.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/_episodes/04-awkward.md b/_episodes/04-awkward.md index 8794eba..f023f63 100644 --- a/_episodes/04-awkward.md +++ b/_episodes/04-awkward.md @@ -139,6 +139,19 @@ 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!) +> 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. From e6ec7ba07116f345ccdc0c2e0aca422b126582f5 Mon Sep 17 00:00:00 2001 From: Guillermo Fidalgo Date: Mon, 4 Dec 2023 15:45:04 -0400 Subject: [PATCH 2/2] fix solution formatting into python code --- _episodes/04-awkward.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/_episodes/04-awkward.md b/_episodes/04-awkward.md index f023f63..6eba9bb 100644 --- a/_episodes/04-awkward.md +++ b/_episodes/04-awkward.md @@ -143,12 +143,14 @@ 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}