def fbeamformers(): bb = BeamformerBase(freq_data=f, steer=st, r_diag=True, cached=False) be = BeamformerEig(freq_data=f, steer=st, r_diag=True, n=54, cached=False) #frequency beamformers to test bbase = BeamformerBase(freq_data=f, steer=st, r_diag=True, cached=False) bc = BeamformerCapon(freq_data=f, steer=st, cached=False) beig = BeamformerEig(freq_data=f, steer=st, r_diag=True, n=54, cached=False) bm = BeamformerMusic(freq_data=f, steer=st, n=6, cached=False) bd = BeamformerDamas(beamformer=bb, n_iter=10, cached=False) bdp = BeamformerDamasPlus(beamformer=bb, n_iter=100, cached=False) bo = BeamformerOrth(beamformer=be, eva_list=list(range(38, 54)), cached=False) bs = BeamformerCleansc(freq_data=f, steer=st, r_diag=True, cached=False) bcmf = BeamformerCMF(freq_data=f, steer=st, method='LassoLarsBIC', cached=False) bl = BeamformerClean(beamformer=bb, n_iter=10, cached=False) bf = BeamformerFunctional(freq_data=f, steer=st, r_diag=False, gamma=3, cached=False) bgib = BeamformerGIB(freq_data=f, steer=st, method='LassoLars', n=2, cached=False) return (bbase, bc, beig, bm, bl, bo, bs, bd, bcmf, bf, bdp, bgib)
block_size=128, #FFT-parameters ind_low=8, ind_high=16) #to save computational effort, only # frequencies with indices 8..15 are used #=============================================================================== # different beamformers in frequency domain #=============================================================================== bb = BeamformerBase(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04) bc = BeamformerCapon(freq_data=f, grid=g, mpos=m, c=346.04, cached=False) be = BeamformerEig(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04, n=54) bm = BeamformerMusic(freq_data=f, grid=g, mpos=m, c=346.04, n=6) bd = BeamformerDamas(beamformer=bb, n_iter=100) bo = BeamformerOrth(beamformer=be, eva_list=list(range(38, 54))) bs = BeamformerCleansc(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04) bcmf = BeamformerCMF(freq_data=f, grid=g, mpos=m, c=346.04, \ method='LassoLarsBIC') bl = BeamformerClean(beamformer=bb, n_iter=100) bf = BeamformerFunctional(freq_data=f, grid=g, mpos=m, r_diag=False, c=346.04, \ gamma=4) #=============================================================================== # plot result maps for different beamformers in frequency domain #=============================================================================== figure(1, (10, 6)) i1 = 1 #no of subplot for b in (bb, bc, be, bm, bl, bo, bs, bd, bcmf, bf): subplot(3, 4, i1) i1 += 1 map = b.synthetic(cfreq, 1) mx = L_p(map.max()) imshow(L_p(map.T),
# eigenvalues and eigenvectors, if only the matrix is needed then class # PowerSpectra can be used instead #=============================================================================== f = EigSpectra( time_data=t1, window='Hanning', overlap='50%', block_size=256, #FFT-parameters ind_low=15, ind_high=31) #to save computational effort, only # frequencies with index 15-31 are used #=============================================================================== # beamformers in frequency domain #=============================================================================== b = BeamformerCMF(freq_data=f, grid=g, mpos=m, c=346.04, alpha=1e-8) #=============================================================================== # plot result maps for different beamformers in frequency domain #=============================================================================== figure(1) #no of figure i1 = 1 #no of subplot from time import time for method in ('LassoLars', 'LassoLarsBIC', \ 'OMPCV', 'NNLS'): b.method = method subplot(2, 2, i1) i1 += 1 ti = time() map = b.synthetic(cfreq, 1) print time() - ti
time_data=t1, window='Hanning', overlap='50%', block_size=128, #FFT-parameters cached=False) #cached = False bb = BeamformerBase(freq_data=f, steer=st, r_diag=True, cached=False) bc = BeamformerCapon(freq_data=f, steer=st, cached=False) be = BeamformerEig(freq_data=f, steer=st, r_diag=True, n=54, cached=False) bm = BeamformerMusic(freq_data=f, steer=st, n=6, cached=False) bd = BeamformerDamas(beamformer=bb, n_iter=100, cached=False) bdp = BeamformerDamasPlus(beamformer=bb, n_iter=100, cached=False) bo = BeamformerOrth(beamformer=be, eva_list=list(range(38, 54)), cached=False) bs = BeamformerCleansc(freq_data=f, steer=st, r_diag=True, cached=False) bcmf = BeamformerCMF(freq_data=f, steer=st, method='LassoLarsBIC', cached=False) bl = BeamformerClean(beamformer=bb, n_iter=100, cached=False) bf = BeamformerFunctional(freq_data=f, steer=st, r_diag=False, gamma=4, cached=False) bgib = BeamformerGIB(freq_data=f, steer=st, method='LassoLars', n=10, cached=False) class acoular_test(unittest.TestCase):
st = SteeringVector(grid=g, mics=m, env=env) #=============================================================================== # for frequency domain methods, this provides the cross spectral matrix and its # eigenvalues and eigenvectors, if only the matrix is needed then class # PowerSpectra can be used instead #=============================================================================== f = PowerSpectra(time_data=t1, window='Hanning', overlap='50%', block_size=256, #FFT-parameters ind_low=15, ind_high=31) #to save computational effort, only # frequencies with index 15-31 are used #=============================================================================== # beamformers in frequency domain #=============================================================================== b = BeamformerCMF(freq_data=f, steer=st, alpha=1e-8) #=============================================================================== # plot result maps for different beamformers in frequency domain #=============================================================================== figure(1,(7,7)) #no of figure i1 = 1 #no of subplot from time import time for method in ('LassoLars', 'LassoLarsBIC', 'OMPCV', 'NNLS'): b.method = method subplot(2,2,i1) i1 += 1 ti = time() map = b.synthetic(cfreq,1) print(time()-ti) mx = L_p(map.max())
bort1Full = BeamformerOrth(beamformer=be1Full, eva_list=list(range(4, 8))) bort2Full = BeamformerOrth(beamformer=be2Full, eva_list=list(range(4, 8))) bort3Full = BeamformerOrth(beamformer=be3Full, eva_list=list(range(4, 8))) bort4Full = BeamformerOrth(beamformer=be4Full, eva_list=list(range(4, 8))) Lbort1Rem = L_p(bort1Rem.synthetic(4000, 1)) Lbort2Rem = L_p(bort2Rem.synthetic(4000, 1)) Lbort3Rem = L_p(bort3Rem.synthetic(4000, 1)) Lbort4Rem = L_p(bort4Rem.synthetic(4000, 1)) Lbort1Full = L_p(bort1Full.synthetic(4000, 1)) Lbort2Full = L_p(bort2Full.synthetic(4000, 1)) Lbort3Full = L_p(bort3Full.synthetic(4000, 1)) Lbort4Full = L_p(bort4Full.synthetic(4000, 1)) bcmf1Rem = BeamformerCMF(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04, steer='classic') bcmf2Rem = BeamformerCMF(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04, steer='inverse') bcmf3Rem = BeamformerCMF(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04, steer='true level') bcmf4Rem = BeamformerCMF(freq_data=f,
bort3Rem = BeamformerOrth(beamformer=be3Rem, eva_list=list(range(4,8))) bort4Rem = BeamformerOrth(beamformer=be4Rem, eva_list=list(range(4,8))) bort1Full = BeamformerOrth(beamformer=be1Full, eva_list=list(range(4,8))) bort2Full = BeamformerOrth(beamformer=be2Full, eva_list=list(range(4,8))) bort3Full = BeamformerOrth(beamformer=be3Full, eva_list=list(range(4,8))) bort4Full = BeamformerOrth(beamformer=be4Full, eva_list=list(range(4,8))) Lbort1Rem = L_p(bort1Rem.synthetic(4000,1)) Lbort2Rem = L_p(bort2Rem.synthetic(4000,1)) Lbort3Rem = L_p(bort3Rem.synthetic(4000,1)) Lbort4Rem = L_p(bort4Rem.synthetic(4000,1)) Lbort1Full = L_p(bort1Full.synthetic(4000,1)) Lbort2Full = L_p(bort2Full.synthetic(4000,1)) Lbort3Full = L_p(bort3Full.synthetic(4000,1)) Lbort4Full = L_p(bort4Full.synthetic(4000,1)) bcmf1Rem = BeamformerCMF(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04, steer='classic') bcmf2Rem = BeamformerCMF(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04, steer='inverse') bcmf3Rem = BeamformerCMF(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04, steer='true level') bcmf4Rem = BeamformerCMF(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04, steer='true location') bcmf1Full = BeamformerCMF(freq_data=f, grid=g, mpos=m, r_diag=False, c=346.04, steer='classic') bcmf2Full = BeamformerCMF(freq_data=f, grid=g, mpos=m, r_diag=False, c=346.04, steer='inverse') bcmf3Full = BeamformerCMF(freq_data=f, grid=g, mpos=m, r_diag=False, c=346.04, steer='true level') bcmf4Full = BeamformerCMF(freq_data=f, grid=g, mpos=m, r_diag=False, c=346.04, steer='true location') Lbcmf1Rem = L_p(bcmf1Rem.synthetic(4000,1)) Lbcmf2Rem = L_p(bcmf2Rem.synthetic(4000,1)) Lbcmf3Rem = L_p(bcmf3Rem.synthetic(4000,1)) Lbcmf4Rem = L_p(bcmf4Rem.synthetic(4000,1)) Lbcmf1Full = L_p(bcmf1Full.synthetic(4000,1)) Lbcmf2Full = L_p(bcmf2Full.synthetic(4000,1)) Lbcmf3Full = L_p(bcmf3Full.synthetic(4000,1)) Lbcmf4Full = L_p(bcmf4Full.synthetic(4000,1))
increment=0.025) #=============================================================================== # for frequency domain methods, this provides the cross spectral matrix and its # eigenvalues and eigenvectors, if only the matrix is needed then class # PowerSpectra can be used instead #=============================================================================== f = EigSpectra(time_data=t1, window='Hanning', overlap='50%', block_size=256, #FFT-parameters ind_low=15, ind_high=31) #to save computational effort, only # frequencies with index 15-31 are used #=============================================================================== # beamformers in frequency domain #=============================================================================== b = BeamformerCMF(freq_data=f, grid=g, mpos=m, c=346.04, alpha=1e-8) #=============================================================================== # plot result maps for different beamformers in frequency domain #=============================================================================== figure(1) #no of figure i1 = 1 #no of subplot from time import time for method in ('LassoLars', 'LassoLarsBIC', \ 'OMPCV', 'NNLS'): b.method = method subplot(2,2,i1) i1 += 1 ti = time() map = b.synthetic(cfreq,1) print time()-ti
ind_low=8, ind_high=16) #to save computational effort, only # frequencies with indices 8..15 are used #=============================================================================== # different beamformers in frequency domain #=============================================================================== bb = BeamformerBase(freq_data=f, steer=st, r_diag=True) bc = BeamformerCapon(freq_data=f, steer=st, cached=False) be = BeamformerEig(freq_data=f, steer=st, r_diag=True, n=54) bm = BeamformerMusic(freq_data=f, steer=st, n=6) bd = BeamformerDamas(beamformer=bb, n_iter=100) bdp = BeamformerDamasPlus(beamformer=bb, n_iter=100) bo = BeamformerOrth(beamformer=be, eva_list=list(range(38, 54))) bs = BeamformerCleansc(freq_data=f, steer=st, r_diag=True) bcmf = BeamformerCMF(freq_data=f, steer=st, method='LassoLarsBIC') bl = BeamformerClean(beamformer=bb, n_iter=100) bf = BeamformerFunctional(freq_data=f, steer=st, r_diag=False, gamma=4) bgib = BeamformerGIB(freq_data=f, steer=st, method='LassoLars', n=10) #=============================================================================== # plot result maps for different beamformers in frequency domain #=============================================================================== figure(1, (10, 6)) i1 = 1 #no of subplot for b in (bb, bc, be, bm, bl, bo, bs, bd, bcmf, bf, bdp, bgib): subplot(4, 4, i1) i1 += 1 map = b.synthetic(cfreq, 1) mx = L_p(map.max()) imshow(L_p(map.T),