@np.deprecate(message='mstats.threshold is deprecated in scipy 0.17.0')
def threshold(a, threshmin=None, threshmax=None, newval=0):
 a = ma.array(a, copy=True)
 mask = np.zeros(a.shape, dtype=bool)
 if (threshmin is not None):
  mask |= (a < threshmin).filled(False)
 if (threshmax is not None):
  mask |= (a > threshmax).filled(False)
 a[mask] = newval
 return a

@ np . deprecate ( message = 'mstats.threshold is deprecated in scipy 0.17.0' ) def threshold ( a , threshmin = None , threshmax = None , newval = 0 ) : a = ma . array ( a , copy = True ) mask = np . zeros ( a . shape , dtype = bool ) if ( threshmin is not None ) : mask |= ( a < threshmin ) . filled ( False ) if ( threshmax is not None ) : mask |= ( a > threshmax ) . filled ( False ) a [ mask ] = newval return a
local threshold of an image .