#NEWLINE# def find_lpc_fb( x , order , bad_roots , fix_mode , method ) : #NEWLINE# #INDENT# '\n    Determind LP coefficient using forward-backward linear prediction.\n\n    Averages LP coefficients generated from solving the forward and backward\n    linear prediction equations after reversing the roots of characteristic\n    polynomial of the backward solution.  Method is described in:\n    G. Zhu and A. Bax, Journal of Magnetic Resonance, 1992, 100, 202-207.\n\n    Description of parameters can be found in :py:func:`lp`.\n\n    ' #NEWLINE# ( D , d ) = make_Dd ( x , order , 'f' ) #NEWLINE# a = find_lpc ( D , d , method ) #NEWLINE# if ( bad_roots is not None ) : #NEWLINE# #INDENT# poles = find_roots ( a , 'f' ) #NEWLINE# poles = fix_roots ( poles , bad_roots , fix_mode ) #NEWLINE# a = find_coeff ( poles , 'f' ) #NEWLINE# #UNINDENT# forward_a = a . copy ( ) #NEWLINE# ( D , d ) = make_Dd ( x , order , 'b' ) #NEWLINE# a = find_lpc ( D , d , method ) #NEWLINE# poles = find_roots ( a , 'b' ) #NEWLINE# poles = [ ( 1.0 / pole ) for pole in poles ] #NEWLINE# if ( bad_roots is not None ) : #NEWLINE# #INDENT# poles = fix_roots ( poles , bad_roots , fix_mode ) #NEWLINE# #UNINDENT# backward_a = find_coeff ( D , 'f' ) #NEWLINE# return ( ( forward_a + backward_a ) / 2.0 )