code: def soft_threshold(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
  
file_path: mahotas/mahotas/thresholding.py
imports: from __future__ import division
  import numpy
  from .histogram import fullhistogram
  from .None import _histogram
  from .internal import _verify_is_integer_type
label_desc: Use image node_id 3 for calling a global function with example usage: soft_threshold(f, tval) and returns: f