code: def lsf(fir_filt):
    
    den = fir_filt.denominator
    if len(den) != 1:
      raise ValueError("Filter has feedback")
    elif den[0] != 1: # So we don't have to worry with the denominator anymore
      fir_filt /= den[0]
  
    from numpy import roots
    rev_filt = ZFilter(fir_filt.numerator[::-1]) * z ** -1
    P = fir_filt + rev_filt
    Q = fir_filt - rev_filt
    roots_p = roots(P.numerator[::-1])
    roots_q = roots(Q.numerator[::-1])
    lsf_p = sorted(phase(roots_p))
    lsf_q = sorted(phase(roots_q))
    return reduce(operator.concat, xzip(*sorted([lsf_p, lsf_q])), tuple())
docs: Find the Line Spectral Frequencies (LSF) from a given FIR filter.
  
    Parameters
    ----------
    filt :
      A LTI FIR filter as a LinearFilter object.
  
    Returns
    -------
    A tuple with all LSFs in rad/sample, alternating from the forward prediction
    and backward prediction filters, starting with the lowest LSF value.