def poly2lsf(a):
<EOL>a = numpy.array(a)<EOL>if a[<NUM_LIT:0>] != <NUM_LIT:1>:<EOL><INDENT>a/=a[<NUM_LIT:0>]<EOL><DEDENT>if max(numpy.abs(numpy.roots(a))) >= <NUM_LIT:1.0>:<EOL><INDENT>error('<STR_LIT>');<EOL><DEDENT>p  = len(a)-<NUM_LIT:1>   <EOL>a1 = numpy.concatenate((a, numpy.array([<NUM_LIT:0>])))<EOL>a2 = a1[-<NUM_LIT:1>::-<NUM_LIT:1>]<EOL>P1 = a1 - a2        <EOL>Q1 = a1 + a2        <EOL>if p%<NUM_LIT:2>: <EOL><INDENT>P, r = deconvolve(P1,[<NUM_LIT:1>, <NUM_LIT:0> ,-<NUM_LIT:1>])<EOL>Q = Q1<EOL><DEDENT>else:          <EOL><INDENT>P, r = deconvolve(P1, [<NUM_LIT:1>, -<NUM_LIT:1>])<EOL>Q, r = deconvolve(Q1, [<NUM_LIT:1>,  <NUM_LIT:1>])<EOL><DEDENT>rP  = numpy.roots(P)<EOL>rQ  = numpy.roots(Q)<EOL>aP  = numpy.angle(rP[<NUM_LIT:1>::<NUM_LIT:2>])<EOL>aQ  = numpy.angle(rQ[<NUM_LIT:1>::<NUM_LIT:2>])<EOL>lsf = sorted(numpy.concatenate((-aP,-aQ)))<EOL>return lsf<EOL>
Prediction polynomial to line spectral frequencies.

    converts the prediction polynomial specified by A,
    into the corresponding line spectral frequencies, LSF.
    normalizes the prediction polynomial by A(1).

    .. doctest::

        >>> from spectrum import poly2lsf
        >>> a = [1.0000,  0.6149, 0.9899, 0.0000 ,0.0031, -0.0082]
        >>> lsf = poly2lsf(a)
        >>> lsf =  array([0.7842, 1.5605, 1.8776, 1.8984, 2.3593])

    .. seealso:: lsf2poly, poly2rc, poly2qc, rc2is