コード例 #1
0
def readListArray(filename,
                  treename,
                  branchname,
                  nevents,
                  list_size,
                  n_feat_per_element,
                  zeropad=False,
                  list_size_cut=False):

    from DeepJetCore.compiled import c_arrayReads

    n_cut = numpy.array([0], dtype='int')

    array = numpy.zeros((nevents, list_size, n_feat_per_element, 1),
                        dtype='float32')

    c_arrayReads.read2DArray(array, filename, treename, branchname, 1, 1,
                             zeropad, list_size_cut, n_cut)

    array = numpy.squeeze(array, axis=-1)

    if list_size_cut:
        return array, n_cut[0]

    return array
コード例 #2
0
def readListArray(filename, treename, branchname, nevents, list_size,
                  n_feat_per_element):

    from DeepJetCore.compiled import c_arrayReads

    array = numpy.zeros((nevents, list_size, n_feat_per_element, 1),
                        dtype='float32')

    c_arrayReads.read2DArray(array, filename, treename, branchname, 1, 1)

    array = numpy.squeeze(array, axis=-1)

    return array
コード例 #3
0
def read2DArray(filename,
                treename,
                branchname,
                nevents,
                xsize,
                ysize,
                rebinx=1,
                rebiny=1):

    if xsize % rebinx or ysize % rebiny:
        raise Exception("rebinning factors don't not match the bin counts")

    from DeepJetCore.compiled import c_arrayReads

    array = numpy.zeros((nevents, xsize, ysize, 1), dtype='float32')

    c_arrayReads.read2DArray(array, filename, treename, branchname, rebinx,
                             rebiny)

    return array
コード例 #4
0
def read2DArray(filename,
                treename,
                branchname,
                nevents: int,
                xsize: int,
                ysize: int,
                rebinx: int = 1,
                rebiny: int = 1,
                zeropad=False):

    if xsize % rebinx or ysize % rebiny:
        raise Exception("rebinning factors don't not match the bin counts")

    from DeepJetCore.compiled import c_arrayReads

    array = numpy.zeros((nevents, xsize // rebinx, ysize // rebiny, 1),
                        dtype='float32')
    ncut = numpy.array([0], dtype='float32')
    c_arrayReads.read2DArray(array, filename, treename, branchname, rebinx,
                             rebiny, zeropad, False, ncut)

    return array