smallest_peak_idx = min(get_peaks(spectrum), key=spectrum.__getitem__) ymin = (spectrum[smallest_peak_idx] - spectrum[0] - 5) // 10 * 10 fig, (time_ax, freq_ax) = plt.subplots(2, 1, num=name) time_ax.vlines(np.arange(- size // 2, size // 2 + 1), 0, wnd_symm) time_ax.set(xlim=(-(size // 2), size // 2), ylim=(-.1, 1.1), xlabel="Time (samples)", title=name) freq_ax.plot(list(line(full_size, -1, 1)), full_spectrum) freq_ax.set(xlim=(-1, 1), ylim=(ymin, 0), ylabel="dB", xlabel="Frequency (% of the Nyquist frequency)") fig.tight_layout() # Prints the table and other text contents print(__doc__) print(""" Schema ------ """) for row in rst_table([(v, schema_full[k]) for k, v in iteritems(schema)], ["Column", "Description"]): print(row) print(""" Windows and Figures of Merit ---------------------------- """) for row in rst_table(table, schema.values()): print(row) # Some values aren't the same to the paper, though plt.ioff() plt.show()
fig, (time_ax, freq_ax) = plt.subplots(2, 1, num=name) time_ax.vlines(np.arange(-size // 2, size // 2 + 1), 0, wnd_symm) time_ax.set(xlim=(-(size // 2), size // 2), ylim=(-.1, 1.1), xlabel="Time (samples)", title=name) freq_ax.plot(list(line(full_size, -1, 1)), full_spectrum) freq_ax.set(xlim=(-1, 1), ylim=(ymin, 0), ylabel="dB", xlabel="Frequency (% of the Nyquist frequency)") fig.tight_layout() # Prints the table and other text contents print(__doc__) print(""" Schema ------ """) for row in rst_table([(v, schema_full[k]) for k, v in iteritems(schema)], ["Column", "Description"]): print(row) print(""" Windows and Figures of Merit ---------------------------- """) for row in rst_table(table, schema.values()): print(row) # Some values aren't the same to the paper, though plt.ioff() plt.show()
wnd_full = wnd_func(full_size) wnd_data = { "name": name, "cg": coherent_gain(wnd_full), "enbw": enbw(wnd_full), "bw3": 2 * find_xdb_bin(wnd, .5), "scallop": scalloping_loss(wnd_full), "wcpl": worst_case_processing_loss(wnd_full), "bw6": 2 * find_xdb_bin(wnd, .25), "ol75": overlap_correlation(wnd_full, .25 * full_size) * 100, "ol50": overlap_correlation(wnd_full, .5 * full_size) * 100, } table.append([to_string(wnd_data[k]) for k in schema]) wnd_symm = wnd + [wnd[0]] full_spectrum = np.hstack([spectrum[::-1], spectrum[1:-1]]) - spectrum[0] fig, (time_ax, freq_ax) = plt.subplots(2, 1, num=name) time_ax.vlines(np.arange(- size // 2, size // 2 + 1), 0, wnd_symm) time_ax.set(xlim=(-(size // 2), size // 2), ylim=(-.1, 1.1), xlabel="Time (samples)", title=name) freq_ax.plot(list(line(full_size, -1, 1)), full_spectrum) freq_ax.set(xlim=(-1, 1), ylim=(-90, 0), ylabel="dB", xlabel="Frequency (% of the Nyquist frequency)") fig.tight_layout() print(__doc__) for row in rst_table(table, schema.values()): print(row) # Some values aren't the same to the paper, though plt.show()