[SciPy-user] treshold function ?

Stef Mientki S.Mientki at ru.nl
Mon May 7 09:06:01 EDT 2007



Stef Mientki wrote:
> hello,
>
> is there a simple treshold function,
> that makes all elements of an array zero if the element is smaller than 
> a given treshold ?
>
> I couldn't find it in Numpy, Signal,
> but maybe I overlooked it.
>
> Of  course it can be done by a simple formula
>     array_data = array_data * ( array_data > treshold )
> but it's more convenient to use a function.
>
>   
I just fund this in "stats" ;-)

    threshold(a, threshmin=None, threshmax=None, newval=0)
        Like numpy.clip() except that values <threshmid or >threshmax 
are replaced
        by newval instead of by threshmin/threshmax (respectively).
        Returns: a, with values <threshmin or >threshmax replaced with 
newval



Kamer van Koophandel - handelsregister 41055629  / Netherlands Chamber of Commerce - trade register 41055629





More information about the SciPy-User mailing list