def freqd_zpk(z, p, k, worN=None, whole=False):
 (z, p) = map(atleast_1d, (z, p))
 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 = ((k * polyvalfromroots(zm1, z)) / polyvalfromroots(zm1, p))
 return (w, h)

def freqd_zpk ( z , p , k , worN = None , whole = False ) : ( z , p ) = map ( atleast_1d , ( z , p ) ) 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 = ( ( k * polyvalfromroots ( zm1 , z ) ) / polyvalfromroots ( zm1 , p ) ) return ( w , h )
compute the frequency response of a digital filter in zpk form .