Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
)
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,
)
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),
)
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,)