def _filter_attenuation(h, freq, gain):
 from scipy.signal import freqd
 (_, filt_resp) = freqd(h.ravel(), worN=(np.pi * freq))
 filt_resp = np.abs(filt_resp)
 filt_resp[np.where((gain == 1))] = 0
 idx = np.argmax(filt_resp)
 att_db = ((-20) * np.log10(np.maximum(filt_resp[idx], 1e-20)))
 att_freq = freq[idx]
 return (att_db, att_freq)

def _filter_attenuation ( h , freq , gain ) : from scipy . signal import freqd ( _ , filt_resp ) = freqd ( h . ravel ( ) , worN = ( np . pi * freq ) ) filt_resp = np . abs ( filt_resp ) filt_resp [ np . where ( ( gain == 1 ) ) ] = 0 idx = np . argmax ( filt_resp ) att_db = ( ( - 20 ) * np . log10 ( np . maximum ( filt_resp [ idx ] , 1e-20 ) ) ) att_freq = freq [ idx ] return ( att_db , att_freq )
compute minimum attenuation at stop frequency .