y_min=-3.0, y_max=+3.0, z=Z, increment=0.3) b = BeamformerBase(freq_data=f, grid=g, mpos=m, r_diag=True, c=c0) map1 = b.synthetic(freq, 3) #=============================================================================== # fixed focus time domain beamforming #=============================================================================== fi = FiltFiltOctave(source=t, band=freq, fraction='Third octave') bt = BeamformerTimeSq(source=fi, grid=g, mpos=m, r_diag=True, c=c0) avgt = TimeAverage(source=bt, naverage=int(sfreq * tmax / 16)) # 16 single images cacht = TimeCache(source=avgt) # cache to prevent recalculation map2 = zeros(g.shape) # accumulator for average # plot single frames figure(1, (8, 7)) i = 1 for res in cacht.result(1): res0 = res[0].reshape(g.shape) map2 += res0 # average i += 1 subplot(4, 4, i) mx = L_p(res0.max()) imshow(L_p(transpose(res0)), vmax=mx, vmin=mx-10, interpolation='nearest',\ extent=g.extend(), origin='lower') colorbar() map2 /= i
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 #=============================================================================== # plot result maps for different beamformers in time domain #=============================================================================== i2 = 2 # no of figure for b in (cacht, cachts):
f = PowerSpectra(time_data=t, window='Hanning', overlap='50%', block_size=128, \ ind_low=1,ind_high=30) # CSM calculation g = RectGrid(x_min=-3.0, x_max=+3.0, y_min=-3.0, y_max=+3.0, z=Z, increment=0.3) st = SteeringVector(grid=g, mics=m) b = BeamformerBase(freq_data=f, steer=st, r_diag=True) map1 = b.synthetic(freq,3) #=============================================================================== # fixed focus time domain beamforming #=============================================================================== fi = FiltFiltOctave(source=t, band=freq, fraction='Third octave') bt = BeamformerTimeSq(source=fi, steer=st, r_diag=True) avgt = TimeAverage(source=bt, naverage=int(sfreq*tmax/16)) # 16 single images cacht = TimeCache(source=avgt) # cache to prevent recalculation map2 = zeros(g.shape) # accumulator for average # plot single frames figure(1,(8,7)) i = 1 for res in cacht.result(1): res0 = res[0].reshape(g.shape) map2 += res0 # average i += 1 subplot(4,4,i) mx = L_p(res0.max()) imshow(L_p(transpose(res0)), vmax=mx, vmin=mx-10, interpolation='nearest',\ extent=g.extend(), origin='lower') colorbar() map2 /= i