#NEWLINE# def check_response( self , h , expected_response , tol = 0.05 ) : #NEWLINE# #INDENT# N = len ( h ) #NEWLINE# alpha = ( 0.5 * ( N - 1 ) ) #NEWLINE# m = ( np . arange ( 0 , N ) - alpha ) #NEWLINE# for ( freq , expected ) in expected_response : #NEWLINE# #INDENT# actual = abs ( np . sum ( ( h * np . exp ( ( ( ( ( - 1j ) * np . pi ) * m ) * freq ) ) ) ) ) #NEWLINE# mse = ( abs ( ( actual - expected ) ) ** 2 ) #NEWLINE# self . assertTrue ( ( mse < self ) , ( 'response not as expected, mse=%g > %g' % ( mse , tol ) ) )