def remez(numtaps, bands, desired, weight=None, Hz=1, type='bandpass', maxiter=25, grid_density=16):
 try:
  tnum = {'bandpass': 1, 'differentiator': 2, 'hilbert': 3}[type]
 except KeyError:
  raise ValueError("Type must be 'bandpass', 'differentiator', or 'hilbert'")
 if (weight is None):
  weight = ([1] * len(desired))
 bands = np.asarray(bands).copy()
 return sigtools._remez(numtaps, bands, desired, weight, tnum, Hz, maxiter, grid_density)

def remez ( numtaps , bands , desired , weight = None , Hz = 1 , type = 'bandpass' , maxiter = 25 , grid_density = 16 ) : try : tnum = { 'bandpass' : 1 , 'differentiator' : 2 , 'hilbert' : 3 } [ type ] except KeyError : raise ValueError ( "Type must be 'bandpass', 'differentiator', or 'hilbert'" ) if ( weight is None ) : weight = ( [ 1 ] * len ( desired ) ) bands = np . asarray ( bands ) . copy ( ) return sigtools . _remez ( numtaps , bands , desired , weight , tnum , Hz , maxiter , grid_density )
calculate the minimax optimal filter using the remez exchange algorithm .