How to use the awkward1.forms.RecordForm function in awkward1

To help you get started, we’ve selected a few awkward1 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CoffeaTeam / coffea / coffea / nanoaod / nanoawkward1.py View on Github external
# list collection
                cname = "n" + name
                counts = arrays[cname]
                content = {
                    k[len(cname) :]: arrays[k]
                    for k in arrays
                    if k.startswith(name + "_")
                }
                recordparams = {
                    "__doc__": counts.parameters["__doc__"],
                    "__record__": mixin,
                    "events_key": self._keyprefix,
                }
                form = awkward1.forms.ListOffsetForm(
                    "i32",
                    awkward1.forms.RecordForm(
                        {k: v.form for k, v in content.items()}, parameters=recordparams
                    ),
                )
                generator = awkward1.layout.ArrayGenerator(
                    self._listarray,
                    (counts, content, recordparams),
                    {},
                    form=form,
                    length=len(self),
                )
                return awkward1.layout.VirtualArray(
                    generator,
                    self._cache,
                    cache_key="/".join([self._keyprefix, "file", name]),
                    parameters=recordparams,
                )
github CoffeaTeam / coffea / coffea / nanoevents / factory.py View on Github external
# list collection
                offsets = arrays["o" + name]
                content = {
                    k[len(name) + 1 :]: arrays[k]
                    for k in arrays
                    if k.startswith(name + "_")
                }
                recordparams = {
                    "__doc__": offsets.parameters["__doc__"],
                    "__record__": mixin,
                    "events_key": self._keyprefix,
                    "collection_name": name,
                }
                form = awkward1.forms.ListOffsetForm(
                    "i32",
                    awkward1.forms.RecordForm(
                        {k: v.form for k, v in content.items()}, parameters=recordparams
                    ),
                )
                generator = awkward1.layout.ArrayGenerator(
                    self._listarray,
                    (offsets, content, recordparams),
                    {},
                    form=form,
                    length=len(self),
                )
                source = "runtime"
                return awkward1.layout.VirtualArray(
                    generator,
                    self._cache,
                    cache_key="/".join([self._keyprefix, source, name]),
                    parameters=recordparams,