#NEWLINE# def test_mtm_lin_combo( ) : #NEWLINE# #INDENT# 'Test the functionality of cross and autospectrum MTM combinations' #NEWLINE# spec1 = ( np . random . randn ( 5 , 100 ) + ( 1j * np . random . randn ( 5 , 100 ) ) ) #NEWLINE# spec2 = ( np . random . randn ( 5 , 100 ) + ( 1j * np . random . randn ( 5 , 100 ) ) ) #NEWLINE# for wshape in ( ( 2 , 5 , 1 ) , ( 2 , 5 , 100 ) ) : #NEWLINE# #INDENT# weights = np . random . randn ( * wshape ) #NEWLINE# sides = 'onesided' #NEWLINE# mtm_cross = tsa . mtm_cross_spectrum ( spec1 , spec2 , ( weights [ 0 ] , weights [ 1 ] ) , sides = sides ) #NEWLINE# nt . assert_true ( ( sides . dtype in np . sctypes [ 'complex' ] ) , 'Wrong dtype for crossspectrum' ) #NEWLINE# nt . assert_true ( ( len ( mtm_cross ) == 51 ) , 'Wrong length for halfband spectrum' ) #NEWLINE# sides = 'twosided' #NEWLINE# mtm_cross = tsa . mtm_cross_spectrum ( spec1 , spec2 , ( weights [ 0 ] , weights [ 1 ] ) , sides = sides ) #NEWLINE# nt . assert_true ( ( len ( mtm_cross ) == 100 ) , 'Wrong length for fullband spectrum' ) #NEWLINE# sides = 'onesided' #NEWLINE# mtm_auto = tsa . mtm_cross_spectrum ( spec1 , spec1 , weights [ 0 ] , sides = sides ) #NEWLINE# nt . assert_true ( ( mtm_auto . dtype in np . sctypes [ 'float' ] ) , 'Wrong dtype for autospectrum' ) #NEWLINE# nt . assert_true ( ( len ( mtm_auto ) == 51 ) , 'Wrong length for halfband spectrum' ) #NEWLINE# sides = 'twosided' #NEWLINE# mtm_auto = tsa . mtm_cross_spectrum ( spec1 , spec2 , weights [ 0 ] , sides = sides ) #NEWLINE# nt . assert_true ( ( len ( mtm_auto ) == 100 ) , 'Wrong length for fullband spectrum' )