def main(fn,start,end):
fn = Path(fn).expanduser()
#rx_array is loading the last 45% of the waveform from the file
rx_array = load_bin(fn, start, end)
#peak_array holds the indexes of each peak in the waveform
#peak_distance is the smallest distance between each peak
peak_array,peak_distance = get_peaks(rx_array)
l = peak_distance-1
print('using window: ',l,'\n')
#remove first peak
peak_array= peak_array[1:]
Npulse=len(peak_array)-1
print(Npulse,'pulses detected')
wind = signal.hanning(l)
Ntone = 2
Nblockest = 160
fs = 4e6 # [Hz]
data = np.empty([Npulse,l])
#set each row of data to window * (first l samples after each peak)
for i in range(Npulse):
data[i,:] = wind * rx_array[peak_array[i]:peak_array[i]+l]
fb_est, sigma = esprit(data, Ntone, Nblockest, fs)
print ('fb_est',fb_est)
print ('sigma: ', sigma)
drange = (3e8*fb_est) / (2e6/.1)
print ('range: ',drange,'\n')
评论列表
文章目录