def METHOD_NAME(f, tval):
    '''
    thresholded = soft_threshold(f, tval)
    Soft threshold function::
                             ^
                             |           /
                             |          /
                             |         /
                             |        /
                             |       /
         - - - - - - - - - - - - - - - - - ->
                      /      |
                     /       |
                    /        |
                   /         |
                  /          |
                 /           |
    Parameters
    ----------
    f : ndarray
    tval : scalar
    Returns
    -------
    thresholded : ndarray
    '''
    f = f * (np.abs(f) > tval)
    f -= tval * (f > tval)
    f += tval * (f < -tval)
    return f