def power_amplifier(s, thresh, pwr=2):
    """ Amplify elements of a positive-valued signal. Rescale the signal
        so that elements above thresh are equal to or greater than 1,
        and elements below thresh are less than one. Then take a power
        of the signal, which will supress values less than 1, and amplify
        values that are greater than one.
    """
    s /= s.max()
    s += 1.0 - thresh
    s = s ** pwr
    s -= (1.0 - thresh) ** pwr
    s /= s.max()
    return s
