def _print_stats(seq):
bipolar = np.where(seq, 1.0, -1.0)
autocorr = np.correlate(bipolar, bipolar, 'same')
peaks = np.sort(np.abs(autocorr))
peak = peaks[-1]
noise = np.sqrt(np.mean(peaks[:-1]**2))
peak_to_peak2 = peak / peaks[-2]
peak_to_noise = peak / noise
print("Peak amplitude: {:.0f}".format(peak))
print("Largest non-peak amplitude: {:.0f}".format(peaks[-2]))
print("Peak-to-max: {:.2f}".format(peak_to_peak2))
print("Peak-to-noise: {:.2f}".format(peak_to_noise))
评论列表
文章目录