How to use the awkward1.layout.NumpyArray 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
def reader(self, branch_name):
        self._branches_read.add(branch_name)
        return awkward1.layout.NumpyArray(
            self._tree[branch_name].array(
                entrystart=self._entrystart, entrystop=self._entrystop, flatten=True
            )
github CoffeaTeam / coffea / coffea / nanoevents / factory.py View on Github external
def reader(self, branch_name, parameters):
        """Read a branch from the ROOT file as an awkward1 array"""
        self._branches_read.add(branch_name)
        return awkward1.layout.NumpyArray(
            self._tree[branch_name].array(
                entrystart=self._entrystart, entrystop=self._entrystop, flatten=True
            ),
            parameters=parameters,
        )
github CoffeaTeam / coffea / coffea / nanoevents / factory.py View on Github external
def nestedindex():
            # idx = awkward1.concatenate([idx[:, None] for idx in indexers], axis=1)
            n = len(indexers)
            out = numpy.empty(n * len(indexers[0]), dtype="int64")
            for i, idx in enumerate(indexers):
                out[i::n] = idx
            offsets = numpy.arange(0, len(out) + 1, n, dtype=numpy.int64)
            return awkward1.layout.ListOffsetArray64(
                awkward1.layout.Index64(offsets), awkward1.layout.NumpyArray(out),
            )
github CoffeaTeam / coffea / coffea / nanoevents / factory.py View on Github external
def _getoffsets(self, counts_name, parameters):
        counts = self.reader(counts_name, parameters)
        offsets = numpy.empty(len(counts) + 1, numpy.uint32)
        offsets[0] = 0
        numpy.cumsum(counts, out=offsets[1:])
        return awkward1.layout.NumpyArray(offsets, parameters=parameters,)