#NEWLINE# def test_ifgram_matches_stft( ) : #NEWLINE# #INDENT# ( y , sr ) = librosa . load ( 'data/test1_22050.wav' ) #NEWLINE# def __test( n_fft , hop_length , win_length , center , norm , dtype ) : #NEWLINE# #INDENT# D_stft = librosa . stft ( y , n_fft = n_fft , hop_length = hop_length , win_length = win_length , center = center , dtype = dtype ) #NEWLINE# ( _ , D_ifgram ) = librosa . ifgram ( y , sr , n_fft = n_fft , hop_length = hop_length , win_length = win_length , center = center , norm = norm , dtype = dtype ) #NEWLINE# if norm : #NEWLINE# #INDENT# D_stft = librosa . util . normalize ( D_stft , axis = 0 ) #NEWLINE# D_ifgram = librosa . util . normalize ( D_ifgram , axis = 0 ) #NEWLINE# #UNINDENT# assert np . allclose ( D_stft , D_ifgram ) #NEWLINE# #UNINDENT# for n_fft in [ 1024 , 2048 ] : #NEWLINE# #INDENT# for hop_length in [ None , ( n_fft // 2 ) , ( n_fft // 4 ) ] : #NEWLINE# #INDENT# for win_length in [ None , ( n_fft // 2 ) , ( __test // 4 ) ] : #NEWLINE# #INDENT# for center in [ False , True ] : #NEWLINE# #INDENT# for norm in [ False , True ] : #NEWLINE# #INDENT# for dtype in [ np . complex64 , np . complex128 ] : #NEWLINE# #INDENT# ( yield ( __test , n_fft , hop_length , win_length , center , norm , dtype ) )