How to understand events, objects, and numbers in an awkward array? #1463
-
Hi, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
When you're posting on GitHub (which uses GitHub Flavoured Markdown), you can use triple backticks ``` to embed entire blocks of code! The error that your seeing when executing array = ak.zip(
{
"muon_pt": [[1, 2, 3], [4, 5], [6]],
"muon_eta": [[1, 2, 3], [4, 5], [6]],
"muon_phi": [[1, 2, 3], [4, 5], [6]],
"muon_E": [[1, 2, 3], [4, 5], [6]],
"electron_pt": [[1, 2], [3], [4]],
"electron_eta": [[1, 2], [3], [4]],
"electron_phi": [[1, 2], [3], [4]],
"electron_E": [[1, 2], [3], [4]],
}
) occurs when Awkward tries to form a record of array = ak.zip(
{
"muon_pt": [[1, 2, 3], [4, 5], [6]],
"muon_eta": [[1, 2, 3], [4, 5], [6]],
"muon_phi": [[1, 2, 3], [4, 5], [6]],
"muon_E": [[1, 2, 3], [4, 5], [6]],
"electron_pt": [[1, 2], [3], [4]],
"electron_eta": [[1, 2], [3], [4]],
"electron_phi": [[1, 2], [3], [4]],
"electron_E": [[1, 2], [3], [4]],
},
depth_limit=1
) This gives you 3 * {
"muon_pt": var * int64,
"muon_eta": var * int64,
"muon_phi": var * int64,
"muon_E": var * int64,
"electron_pt": var * int64,
"electron_eta": var * int64,
"electron_phi": var * int64,
"electron_E": var * int64,
} I.e. each event has a list of Some additional notes: Awkward Array has support for four vectors using the To be able to use these behaviours, you need to have properly named fields, i.e. only muon = ak.zip(
{
"pt": [[1, 2, 3], [4, 5], [6]],
"eta": [[1, 2, 3], [4, 5], [6]],
"phi": [[1, 2, 3], [4, 5], [6]],
"E": [[1, 2, 3], [4, 5], [6]],
},
depth_limit=1,
with_name="Momentum4D"
)
electron = ak.zip(
{
"pt": [[1, 2], [3], [4]],
"eta": [[1, 2], [3], [4]],
"phi": [[1, 2], [3], [4]],
"E": [[1, 2], [3], [4]],
},
depth_limit=1,
with_name="Momentum4D"
)
array = ak.zip(
{
"muon": muon,
"electron": electron
},
depth_limit=1
) In the above code sample, we create two arrays See these talks for some examples: However, when you place arrays into fields ( |
Beta Was this translation helpful? Give feedback.
When you're posting on GitHub (which uses GitHub Flavoured Markdown), you can use triple backticks ``` to embed entire blocks of code!
The error that your seeing when executing
occurs when Awkward tries to form a record of
"muon_pt", "muon_eta", ..., "electron_E"
at the deepest level of nesting. This is the defa…