Skip to content

fft_plotter

rfsoc_rfdc.plotter.fft_plotter

Classes

FFTPlotter(sample_rate, title)

Plot complex ADC samples in the frequency domain

Source code in rfsoc_rfdc/plotter/fft_plotter.py
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)
Attributes
sample_rate = sample_rate instance-attribute
fig = go.FigureWidget(layout={'title': title, 'xaxis': {'title': 'Frequency (Hz)'}, 'yaxis': {'title': 'Magnitude', 'type': 'log', 'range': [0, 8]}}) instance-attribute
Functions
update_plot(iq_data)
Source code in rfsoc_rfdc/plotter/fft_plotter.py
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