def freqd(b, a=1, worN=None, whole=False, plot=None):
 (b, a) = map(atleast_1d, (b, a))
 if whole:
  lastpoint = (2 * pi)
 else:
  lastpoint = pi
 if (worN is None):
  N = 512
  w = numpy.linspace(0, lastpoint, N, endpoint=False)
 elif isinstance(worN, int):
  N = worN
  w = numpy.linspace(0, lastpoint, N, endpoint=False)
 else:
  w = worN
 w = atleast_1d(w)
 zm1 = exp(((-1j) * w))
 h = (polyval(b[::(-1)], zm1) / polyval(a[::(-1)], zm1))
 if (plot is not None):
  plot(w, h)
 return (w, h)

def freqd ( b , a = 1 , worN = None , whole = False , plot = None ) : ( b , a ) = map ( atleast_1d , ( b , a ) ) if whole : lastpoint = ( 2 * pi ) else : lastpoint = pi if ( worN is None ) : N = 512 w = numpy . linspace ( 0 , lastpoint , N , endpoint = False ) elif isinstance ( worN , int ) : N = worN w = numpy . linspace ( 0 , lastpoint , N , endpoint = False ) else : w = worN w = atleast_1d ( w ) zm1 = exp ( ( ( - 1j ) * w ) ) h = ( polyval ( b [ : : ( - 1 ) ] , zm1 ) / polyval ( a [ : : ( - 1 ) ] , zm1 ) ) if ( plot is not None ) : plot ( w , h ) return ( w , h )
compute the frequency response of a digital filter .