parameters: (z, p, k)
return_statement: return b, a
docstring: Return polynomial transfer function representation from zeros and poles
  
      Parameters
      ----------
      z : array_like
          Zeros of the transfer function.
      p : array_like
          Poles of the transfer function.
      k : float
          System gain.
  
      Returns
      -------
      b : ndarray
          Numerator polynomial coefficients.
      a : ndarray
          Denominator polynomial coefficients.
docstring_summary: Return polynomial transfer function representation from zeros and poles
docstring_tokens: Return polynomial transfer function representation from zeros and poles
function: def zpk2tf(z, p, k):
      """
      Return polynomial transfer function representation from zeros and poles
  
      Parameters
      ----------
      z : array_like
          Zeros of the transfer function.
      p : array_like
          Poles of the transfer function.
      k : float
          System gain.
  
      Returns
      -------
      b : ndarray
          Numerator polynomial coefficients.
      a : ndarray
          Denominator polynomial coefficients.
  
      """
      z = atleast_1d(z)
      k = atleast_1d(k)
      if len(z.shape) > 1:
          temp = poly(z[0])
          b = zeros((z.shape[0], z.shape[1] + 1), temp.dtype.char)
          if len(k) == 1:
              k = [k[0]] * z.shape[0]
          for i in range(z.shape[0]):
              b[i] = k[i] * poly(z[i])
      else:
          b = k * poly(z)
      a = atleast_1d(poly(p))
  
      # Use real output if possible.  Copied from numpy.poly, since
      # we can't depend on a specific version of numpy.
      if issubclass(b.dtype.type, numpy.complexfloating):
          # if complex roots are all complex conjugates, the roots are real.
          roots = numpy.asarray(z, complex)
          pos_roots = numpy.compress(roots.imag > 0, roots)
          neg_roots = numpy.conjugate(numpy.compress(roots.imag < 0, roots))
          if len(pos_roots) == len(neg_roots):
              if numpy.all(numpy.sort_complex(neg_roots) ==
                           numpy.sort_complex(pos_roots)):
                  b = b.real.copy()
  
      if issubclass(a.dtype.type, numpy.complexfloating):
          # if complex roots are all complex conjugates, the roots are real.
          roots = numpy.asarray(p, complex)
          pos_roots = numpy.compress(roots.imag > 0, roots)
          neg_roots = numpy.conjugate(numpy.compress(roots.imag < 0, roots))
          if len(pos_roots) == len(neg_roots):
              if numpy.all(numpy.sort_complex(neg_roots) ==
                           numpy.sort_complex(pos_roots)):
                  a = a.real.copy()
  
      return b, a
function_tokens: def zpk2tf ( z , p , k ) : z = atleast_1d ( z ) k = atleast_1d ( k ) if len ( z . shape ) > 1 : temp = poly ( z [ 0 ] ) b = zeros ( ( z . shape [ 0 ] , z . shape [ 1 ] + 1 ) , temp . dtype . char ) if len ( k ) == 1 : k = [ k [ 0 ] ] * z . shape [ 0 ] for i in range ( z . shape [ 0 ] ) : b [ i ] = k [ i ] * poly ( z [ i ] ) else : b = k * poly ( z ) a = atleast_1d ( poly ( p ) ) # Use real output if possible.  Copied from numpy.poly, since # we can't depend on a specific version of numpy. if issubclass ( b . dtype . type , numpy . complexfloating ) : # if complex roots are all complex conjugates, the roots are real. roots = numpy . asarray ( z , complex ) pos_roots = numpy . compress ( roots . imag > 0 , roots ) neg_roots = numpy . conjugate ( numpy . compress ( roots . imag < 0 , roots ) ) if len ( pos_roots ) == len ( neg_roots ) : if numpy . all ( numpy . sort_complex ( neg_roots ) == numpy . sort_complex ( pos_roots ) ) : b = b . real . copy ( ) if issubclass ( a . dtype . type , numpy . complexfloating ) : # if complex roots are all complex conjugates, the roots are real. roots = numpy . asarray ( p , complex ) pos_roots = numpy . compress ( roots . imag > 0 , roots ) neg_roots = numpy . conjugate ( numpy . compress ( roots . imag < 0 , roots ) ) if len ( pos_roots ) == len ( neg_roots ) : if numpy . all ( numpy . sort_complex ( neg_roots ) == numpy . sort_complex ( pos_roots ) ) : a = a . real . copy ( ) return b , a