How to use the awkward1.layout.RecordArray 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 / nanoevents / factory.py View on Github external
generator,
                    self._cache,
                    cache_key="/".join([self._keyprefix, source, name]),
                    parameters=params,
                )
            elif name in arrays:
                # singleton
                return arrays[name]
            else:
                # simple collection
                content = {
                    k[len(name) + 1 :]: arrays[k]
                    for k in arrays
                    if k.startswith(name + "_")
                }
                return awkward1.layout.RecordArray(
                    content,
                    parameters={
                        "__record__": mixin,
                        "events_key": self._keyprefix,
                        "collection_name": name,
                    },
github CoffeaTeam / coffea / coffea / nanoaod / nanoawkward1.py View on Github external
{},
                    form=form,
                    length=len(self),
                )
                return awkward1.layout.VirtualArray(
                    generator,
                    self._cache,
                    cache_key="/".join([self._keyprefix, "file", name]),
                    parameters=recordparams,
                )
            elif name in arrays:
                # singleton
                return arrays[name]
            else:
                # simple collection
                return awkward1.layout.RecordArray(
                    {
                        k[len(name) + 1 :]: arrays[k]
                        for k in arrays
                        if k.startswith(name + "_")
                    },
                    parameters={
                        "__record__": mixin,
                        "events_key": self._keyprefix,
                    },
github CoffeaTeam / coffea / coffea / nanoaod / nanoawkward1.py View on Github external
return arrays[name]
            else:
                # simple collection
                return awkward1.layout.RecordArray(
                    {
                        k[len(name) + 1 :]: arrays[k]
                        for k in arrays
                        if k.startswith(name + "_")
                    },
                    parameters={
                        "__record__": mixin,
                        "events_key": self._keyprefix,
                    },
                )

        events = awkward1.layout.RecordArray(
            {name: collectionfactory(name) for name in collections},
            parameters={"metadata": self._metadata},
        )

        self._events = awkward1.Array(events)
        return self._events
github CoffeaTeam / coffea / coffea / nanoaod / nanoawkward1.py View on Github external
def _listarray(self, counts, content, recordparams):
        offsets = awkward1.layout.Index32(
            numpy.concatenate([[0], numpy.cumsum(counts)])
        )
        length = offsets[-1]
        return awkward1.layout.ListOffsetArray32(
            offsets,
            awkward1.layout.RecordArray(
                {k: _with_length(v, length) for k, v in content.items()},
                parameters=recordparams,
            ),
github CoffeaTeam / coffea / coffea / nanoevents / factory.py View on Github external
def _listarray(self, offsets, content, params):
        offsets = awkward1.layout.Index32(offsets)
        length = offsets[-1]
        if isinstance(content, dict):
            content = awkward1.layout.RecordArray(
                {k: _with_length(v, length) for k, v in content.items()},
                parameters=params,
            )
            return awkward1.layout.ListOffsetArray32(offsets, content)
        return awkward1.layout.ListOffsetArray32(offsets, content, parameters=params)