band_stop_obj#
- scipy.signal.band_stop_obj(wp, ind, passb, stopb, gpass, gstop, type)[source]#
- Band Stop Objective Function for order minimization. - Returns the non-integer order for an analog band stop filter. - Parameters:
- wpscalar
- Edge of passband passb. 
- indint, {0, 1}
- Index specifying which passb edge to vary (0 or 1). 
- passbndarray
- Two element sequence of fixed passband edges. 
- stopbndarray
- Two element sequence of fixed stopband edges. 
- gstopfloat
- Amount of attenuation in stopband in dB. 
- gpassfloat
- Amount of ripple in the passband in dB. 
- type{‘butter’, ‘cheby’, ‘ellip’}
- Type of filter. 
 
- Returns:
- nscalar
- Filter order (possibly non-integer). 
 
 - Notes - Band-stop filters are used in applications where certain frequency components need to be blocked while others are allowed; for instance, removing noise at specific frequencies while allowing the desired signal to pass through. The order of a filter often determines its complexity and accuracy. Determining the right order can be a challenge. This function aims to provide an appropriate order for an analog band stop filter. - Examples - >>> import numpy as np >>> from scipy.signal import band_stop_obj >>> wp = 2 >>> ind = 1 >>> passb = np.array([1, 3]) >>> stopb = np.array([0.5, 4]) >>> gstop = 30 >>> gpass = 3 >>> filter_type = 'butter' >>> band_stop_obj(wp, ind, passb, stopb, gpass, gstop, filter_type) np.float64(-2.758504160760643)