示例#1
0
def high_pass_max(numpy_arr, maxscale):
    """Remove everything below 1/2 of the median
    value."""
    # remove noise
    max = numpy.max(numpy_arr)
    def hp(x, m):
        return 0 if x < m else x
    return numpy.vectorize(hp)(numpy_arr, max * maxscale)
示例#2
0
def get_average_line_height(top_bottoms):
    """Tricksy - get height of median line?
    """
    lheights = [b - t for t, b in top_bottoms]
    lhm = numpy.max(lheights)
    def weight(val):
        return 0 if val < (lhm / 2) else 1
    weights = numpy.vectorize(weight)(lheights)
    return numpy.average(numpy.array(lheights), weights=weights)
示例#3
0
def high_pass_max(numpy_arr, maxscale):
    """Remove everything below 1/2 of the median
    value."""
    # remove noise
    max = numpy.max(numpy_arr)

    def hp(x, m):
        return 0 if x < m else x

    return numpy.vectorize(hp)(numpy_arr, max * maxscale)
示例#4
0
def get_average_line_height(top_bottoms):
    """Tricksy - get height of median line?
    """
    lheights = [b - t for t, b in top_bottoms]
    lhm = numpy.max(lheights)

    def weight(val):
        return 0 if val < (lhm / 2) else 1

    weights = numpy.vectorize(weight)(lheights)
    return numpy.average(numpy.array(lheights), weights=weights)