def phase2_plot_update(f, ax1, data, passed, peak, hf1, hf2, progress):
# Update the plot with latest measurement
ax1.cla()
freq_mhz = map(lambda x: x/1e6, data.frequency)
sns.tsplot(data.ch1, time=freq_mhz, ax=ax1, interpolate=True)
ax1.plot(peak[0]/1e6, peak[1], 'v')
ax1.set(title='Beatnote Spectrum', xlabel='Frequency (MHz)', ylabel='Power (dBm)')
ax1.annotate('Peak (%.2f MHz)\nLinewidth (%.2f kHz)\nCompleted %d%%' % (peak[0]/1e6, (hf2[0]-hf1[0])/1e3, progress), xy=(0.80,0.90), xycoords='axes fraction', fontsize=14)
ax1.axvspan(hf1[0]/1e6,hf2[0]/1e6, alpha=0.1, color='green' if passed else 'red')
plt.pause(0.01)
评论列表
文章目录