def plot_spectrum(self, filename=None, plot_db=True):
header, data = self.read_next_data_block()<EOL>print("<STR_LIT>")<EOL>d_xx_fft = np.abs(np.fft.fft(data[..., <NUM_LIT:0>]))<EOL>d_xx_fft = d_xx_fft.flatten()<EOL>dec_fac_x = <NUM_LIT:1><EOL>if d_xx_fft.shape[<NUM_LIT:0>] > MAX_PLT_POINTS:<EOL><INDENT>dec_fac_x = d_xx_fft.shape[<NUM_LIT:0>] / MAX_PLT_POINTS<EOL><DEDENT>d_xx_fft = rebin(d_xx_fft, dec_fac_x)<EOL>print("<STR_LIT>")<EOL>if plot_db:<EOL><INDENT>plt.plot(<NUM_LIT:10> * np.log10(d_xx_fft))<EOL>plt.ylabel("<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>plt.plot(d_xx_fft)<EOL>plt.ylabel("<STR_LIT>")<EOL>plt.xlabel("<STR_LIT>")<EOL><DEDENT>plt.title(self.filename)<EOL>if filename:<EOL><INDENT>plt.savefig(filename)<EOL><DEDENT>plt.show()<EOL>
Do a (slow) numpy FFT and take power of data