Plot complex ADC samples in the frequency domain
Source code in rfsoc_rfdc/plotter/fft_plotter.py
| class FFTPlotter:
"""Plot complex ADC samples in the frequency domain
"""
def __init__(self, sample_rate, title):
self.sample_rate = sample_rate
self.fig = go.FigureWidget(layout={
'title': title,
'xaxis': {'title': 'Frequency (Hz)'},
'yaxis': {'title': 'Magnitude',
'type': 'log',
'range': [0, 8]
}
})
self.fig.add_scattergl(x=[], y=[], name='Magnitude')
display(self.fig)
def update_plot(self, iq_data):
iq_fft = fft(iq_data)
freq = fftfreq(len(iq_data), d=1/self.sample_rate)
magnitude = np.abs(iq_fft)
self.fig.data[0].x = freq
self.fig.data[0].y = magnitude
def close(self):
"""Close the figure widget."""
self.fig.close()
def __del__(self):
self.close()
|
Functions
close()
Close the figure widget.
Source code in rfsoc_rfdc/plotter/fft_plotter.py
| def close(self):
"""Close the figure widget."""
self.fig.close()
|