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)
# 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), origin='lower', vmin=mx - 15, interpolation='nearest',
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): #test if microfon positions are correct def test_mic_positions(self): self.assertAlmostEqual(m.mpos.sum() / mpos_num.sum(), 1, 3)
csm32 = f32.csm[:] eva32 = f32.eva[:] psf32 = PointSpreadFunction(grid=g, mpos=m, c=346.04, precision='float32') psf32Res = psf32.psf[:] psf64 = PointSpreadFunction(grid=g, mpos=m, c=346.04, precision='float64') psf64Res = psf64.psf[:] bb32 = BeamformerBase(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04, precision='float32') bb32Res = bb32.synthetic(cfreq,1) bb64 = BeamformerBase(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04, precision='float64') bb64Res = bb64.synthetic(cfreq,1) bf = BeamformerFunctional(freq_data=f, grid=g, mpos=m, r_diag=False, c=346.04, gamma = 60, precision='float32') bfRes = bf.synthetic(cfreq,1) # 32 Bit PSF precision bd3232 = BeamformerDamas(beamformer=bb32, n_iter=100, psf_precision='float32') bd3232Res = bd3232.synthetic(cfreq,1) bc3232 = BeamformerClean(beamformer=bb32, psf_precision='float32') bc3232Res = bc3232.synthetic(cfreq,1) bdp3232 = BeamformerDamasPlus(beamformer=bb32, n_iter=100, psf_precision='float32') bdp3232Res = bdp3232.synthetic(cfreq,1) #64 Bit bd3264 = BeamformerDamas(beamformer=bb32, n_iter=100, psf_precision='float64') bd3264Res = bd3264.synthetic(cfreq,1) bc3264 = BeamformerClean(beamformer=bb32, psf_precision='float64') bc3264Res = bc3264.synthetic(cfreq,1)
r_diag=False, c=346.04, steer='true location') Lbb1Rem = L_p(bb1Rem.synthetic(4000, 1)) Lbb2Rem = L_p(bb2Rem.synthetic(4000, 1)) Lbb3Rem = L_p(bb3Rem.synthetic(4000, 1)) Lbb4Rem = L_p(bb4Rem.synthetic(4000, 1)) Lbb1Full = L_p(bb1Full.synthetic(4000, 1)) Lbb2Full = L_p(bb2Full.synthetic(4000, 1)) Lbb3Full = L_p(bb3Full.synthetic(4000, 1)) Lbb4Full = L_p(bb4Full.synthetic(4000, 1)) bf1Rem = BeamformerFunctional(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04, steer='classic', gamma=3) bf2Rem = BeamformerFunctional(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04, steer='inverse', gamma=3) bf3Rem = BeamformerFunctional(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04,
bb3Rem = BeamformerBase(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04, steer='true level') bb4Rem = BeamformerBase(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04, steer='true location') bb1Full = BeamformerBase(freq_data=f, grid=g, mpos=m, r_diag=False, c=346.04, steer='classic') bb2Full = BeamformerBase(freq_data=f, grid=g, mpos=m, r_diag=False, c=346.04, steer='inverse') bb3Full = BeamformerBase(freq_data=f, grid=g, mpos=m, r_diag=False, c=346.04, steer='true level') bb4Full = BeamformerBase(freq_data=f, grid=g, mpos=m, r_diag=False, c=346.04, steer='true location') Lbb1Rem = L_p(bb1Rem.synthetic(4000,1)) Lbb2Rem = L_p(bb2Rem.synthetic(4000,1)) Lbb3Rem = L_p(bb3Rem.synthetic(4000,1)) Lbb4Rem = L_p(bb4Rem.synthetic(4000,1)) Lbb1Full = L_p(bb1Full.synthetic(4000,1)) Lbb2Full = L_p(bb2Full.synthetic(4000,1)) Lbb3Full = L_p(bb3Full.synthetic(4000,1)) Lbb4Full = L_p(bb4Full.synthetic(4000,1)) bf1Rem = BeamformerFunctional(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04, steer='classic', gamma=3) bf2Rem = BeamformerFunctional(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04, steer='inverse', gamma=3) bf3Rem = BeamformerFunctional(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04, steer='true level', gamma=3) bf4Rem = BeamformerFunctional(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04, steer='true location', gamma=3) bf1Full = BeamformerFunctional(freq_data=f, grid=g, mpos=m, r_diag=False, c=346.04, steer='classic', gamma=3) bf2Full = BeamformerFunctional(freq_data=f, grid=g, mpos=m, r_diag=False, c=346.04, steer='inverse', gamma=3) bf3Full = BeamformerFunctional(freq_data=f, grid=g, mpos=m, r_diag=False, c=346.04, steer='true level', gamma=3) bf4Full = BeamformerFunctional(freq_data=f, grid=g, mpos=m, r_diag=False, c=346.04, steer='true location', gamma=3) Lbf1Rem = L_p(bf1Rem.synthetic(4000,1)) Lbf2Rem = L_p(bf2Rem.synthetic(4000,1)) Lbf3Rem = L_p(bf3Rem.synthetic(4000,1)) Lbf4Rem = L_p(bf4Rem.synthetic(4000,1)) Lbf1Full = L_p(bf1Full.synthetic(4000,1)) Lbf2Full = L_p(bf2Full.synthetic(4000,1)) Lbf3Full = L_p(bf3Full.synthetic(4000,1)) Lbf4Full = L_p(bf4Full.synthetic(4000,1))
#=============================================================================== f = EigSpectra(time_data=t1, window='Hanning', overlap='50%', block_size=128, #FFT-parameters ind_low=7, ind_high=15) #to save computational effort, only # frequencies with index 1-30 are used #=============================================================================== # beamformers in frequency domain #=============================================================================== bb = BeamformerBase(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04) bd = BeamformerDamas(beamformer=bb, n_iter=100) be = BeamformerEig(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04, n=54) 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) bf = BeamformerFunctional(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04, gamma = 60) #=============================================================================== # plot result maps for different beamformers in frequency domain #=============================================================================== fi = 1 #no of figure for r_diag in (True,False): figure(fi) suptitle('Old Implementation | R_diag=' + str(r_diag)) fi +=1 bb.r_diag = r_diag be.r_diag = r_diag bs.r_diag = r_diag
block_size=128, #FFT-parameters ind_low=7, ind_high=15) #to save computational effort, only # frequencies with index 1-30 are used #=============================================================================== # beamformers in frequency domain #=============================================================================== bb = BeamformerBase(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04) bd = BeamformerDamas(beamformer=bb, n_iter=100) be = BeamformerEig(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04, n=54) 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) bf = BeamformerFunctional(freq_data=f, grid=g, mpos=m, r_diag=True, c=346.04, gamma=60) #=============================================================================== # plot result maps for different beamformers in frequency domain #=============================================================================== fi = 1 #no of figure for r_diag in (True, False): figure(fi) suptitle('Old Implementation | R_diag=' + str(r_diag)) fi += 1 bb.r_diag = r_diag be.r_diag = r_diag bs.r_diag = r_diag