示例#1
0
def createDensity(
        Filename_in,
        #MeanNormTuple,
        inbranches,
        modes,
        nevents,
        dimension1,
        dimension2,
        counterbranch,
        offsets=None):

    from DeepJetCore.compiled import c_meanNormZeroPad

    layerbranch = ''
    maxlayers = 1
    layeroffset = 0

    norms = [1 for x in range(len(inbranches))]
    means = []
    if not offsets:
        means = [0 for x in range(len(inbranches))]
    else:
        means = offsets

    x_branch, x_center, x_bins, x_width = dimension1
    y_branch, y_center, y_bins, y_width = dimension2

    array = numpy.zeros((nevents, x_bins, y_bins, maxlayers, len(inbranches)),
                        dtype='float32')

    c_meanNormZeroPad.fillDensityLayers(
        array,
        norms,
        means,
        inbranches,
        modes,
        layerbranch,
        maxlayers,
        layeroffset,
        Filename_in,
        counterbranch,
        x_branch,
        x_center,
        x_bins,
        x_width,
        y_branch,
        y_center,
        y_bins,
        y_width,
    )

    array = numpy.reshape(array, (nevents, x_bins, y_bins, len(inbranches)))

    return array
示例#2
0
def createDensityLayers(Filename_in,
                        MeanNormTuple,
                        inbranches,
                        modes,
                        layerbranch,
                        maxlayers,
                        layeroffset,
                        nevents,
                        dimension1,
                        dimension2,
                        counterbranch,
                        scales=None):

    from DeepJetCore.compiled import c_meanNormZeroPad

    if not scales:
        norms = [1 for x in range(len(inbranches))]
    else:
        norms = scales
        if not len(scales) == len(inbranches):
            raise ValueError('Scales length must match number of branches')

    means = [0 for x in range(len(inbranches))]

    x_branch, x_center, x_bins, x_width = dimension1
    y_branch, y_center, y_bins, y_width = dimension2

    array = numpy.zeros((nevents, x_bins, y_bins, maxlayers, len(inbranches)),
                        dtype='float32')

    c_meanNormZeroPad.fillDensityLayers(
        array,
        norms,
        means,
        inbranches,
        modes,
        layerbranch,
        maxlayers,
        layeroffset,
        Filename_in,
        counterbranch,
        x_branch,
        x_center,
        x_bins,
        x_width,
        y_branch,
        y_center,
        y_bins,
        y_width,
    )

    return array
示例#3
0
def createDensityLayers(Filename_in, MeanNormTuple, inbranches, modes,
                        layerbranch, maxlayers, layeroffset, nevents,
                        dimension1, dimension2, counterbranch):

    from DeepJetCore.compiled import c_meanNormZeroPad

    norms = [1 for x in range(len(inbranches))]
    means = [0 for x in range(len(inbranches))]

    x_branch, x_center, x_bins, x_width = dimension1
    y_branch, y_center, y_bins, y_width = dimension2

    array = numpy.zeros((nevents, x_bins, y_bins, maxlayers, len(inbranches)),
                        dtype='float32')

    c_meanNormZeroPad.fillDensityLayers(
        array,
        norms,
        means,
        inbranches,
        modes,
        layerbranch,
        maxlayers,
        layeroffset,
        Filename_in,
        counterbranch,
        x_branch,
        x_center,
        x_bins,
        x_width,
        y_branch,
        y_center,
        y_bins,
        y_width,
    )

    return array