i1 += 1 map = b.synthetic(cfreq, 1) mx = L_p(map.max()) imshow(L_p(map.T), origin='lower', vmin=mx - 15, interpolation='nearest', extent=g.extend()) colorbar() title(b.__class__.__name__) #=============================================================================== # delay and sum beamformer in time domain # processing chain: beamforming, filtering, power, average #=============================================================================== bt = BeamformerTime(source=t1, grid=g, mpos=m, c=346.04) ft = FiltFiltOctave(source=bt, band=cfreq) pt = TimePower(source=ft) avgt = TimeAverage(source=pt, naverage=1024) cacht = TimeCache(source=avgt) # cache to prevent recalculation #=============================================================================== # delay and sum beamformer in time domain with autocorrelation removal # processing chain: zero-phase filtering, beamforming+power, average #=============================================================================== fi = FiltFiltOctave(source=t1, band=cfreq) bts = BeamformerTimeSq(source=fi, grid=g, mpos=m, r_diag=True, c=346.04) avgts = TimeAverage(source=bts, naverage=1024) cachts = TimeCache(source=avgts) # cache to prevent recalculation #===============================================================================
mg.mpos_tot = array([M1, M2, M3, M4]).T # add microphone positions to MicGeom object # define evaluation grid # Hier könntest du vielleicht eine neue Spherical Grid Klasse schreiben oder # eine ArbitraryGrid Klasse, damit wir ein sinnvolles Gitter zur Lokalisierung # verwenden können. # Als Anregung siehe: https://spaudiopy.readthedocs.io/en/latest/spaudiopy.grids.html # rg = SphericalGrid_Equiangular(NPOINTS_AZI, NPOINTS_ELE) st = SteeringVector(grid=rg, mics=mg) # analyze the data and generate map name = AUDIO_DIR + TRACK ts = WavSamples(name=name, start=STARTFRAME * NUM, stop=ENDFRAME * NUM) bf = BeamformerTime(source=ts, steer=st) #ft = FiltFiltOctave(source=bf,band=4000) tp = TimePower(source=bf) tavg = TimeAverage(source=tp, naverage=NUM) # ============================================================================= # plot first data block # ============================================================================= import matplotlib.pyplot as plt import mpl_toolkits.mplot3d gen = tavg.result(1) # make generator object ## show map #imshow( Lm.T, origin='lower', vmin=Lm.max()-10, extent=rg.extend, \ #interpolation='bicubic')
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) bbase = BeamformerBase(freq_data=f, steer=st, r_diag=True, cached=False) beig = BeamformerEig(freq_data=f, steer=st, r_diag=True, n=54, cached=False) #timebeamformer test bt = BeamformerTime(source=t1, steer=st) ft = FiltFiltOctave(source=bt, band=1000) pt = TimePower(source=ft) avgt = TimeAverage(source=pt, naverage=1024) res = next(avgt.result(1)) #squared fi = FiltFiltOctave(source=t1, band=4000) bts = BeamformerTimeSq(source=fi, steer=st, r_diag=True) avgts = TimeAverage(source=bts, naverage=1024) resq = next(avgts.result(1)) class acoular_beamformer_test(unittest.TestCase): #@unittest.skip('test time bf first') def test_beamformer_freq_results(self):
# write H5 File h5f1 = WriteH5(name='ps', source=ps).save() #============================================================================== #load H5 File #============================================================================== #load from h5 File mt1 = MaskedTimeSamples(name='ps') #============================================================================== #fixed focus time domain beamforming point source #============================================================================== bt_ps = BeamformerTime(source=ps, grid=g, mpos=m, c=c0) bt_ps_h5 = BeamformerTime(source=mt1, grid=g, mpos=m, c=c0) btSq_ps = BeamformerTimeSq(source=ps, grid=g, mpos=m, r_diag=True, c=c0) btSq_ps_h5 = BeamformerTimeSq(source=mt1, grid=g, mpos=m, r_diag=True, c=c0) avgt_ps = TimeAverage(source=bt_ps, naverage=int(sfreq * tmax / 2)) avgt_psSq = TimeAverage(source=btSq_ps, naverage=int(sfreq * tmax / 2)) avgt_ps_h5 = TimeAverage(source=bt_ps_h5, naverage=int(sfreq * tmax / 2)) avgt_psSq_h5 = TimeAverage(source=btSq_ps_h5, naverage=int(sfreq * tmax / 2)) #============================================================================== #plot point source #============================================================================== figure(1) for res in avgt_ps.result(1):