(datas, lognames, max_freq, axis)
| 134 | return fig |
| 135 | |
| 136 | def plot_compare_frequency(datas, lognames, max_freq, axis): |
| 137 | fig, ax = matplotlib.pyplot.subplots() |
| 138 | ax.set_title('Frequency responses comparison') |
| 139 | ax.set_xlabel('Frequency (Hz)') |
| 140 | ax.set_ylabel('Power spectral density') |
| 141 | |
| 142 | for data, logname in zip(datas, lognames): |
| 143 | calibration_data = calc_freq_response(data, max_freq) |
| 144 | freqs = calibration_data.freq_bins |
| 145 | psd = calibration_data.get_psd(axis)[freqs <= max_freq] |
| 146 | freqs = freqs[freqs <= max_freq] |
| 147 | ax.plot(freqs, psd, label="\n".join(wrap(logname, 60)), alpha=0.6) |
| 148 | |
| 149 | ax.xaxis.set_minor_locator(matplotlib.ticker.AutoMinorLocator()) |
| 150 | ax.yaxis.set_minor_locator(matplotlib.ticker.AutoMinorLocator()) |
| 151 | ax.grid(which='major', color='grey') |
| 152 | ax.grid(which='minor', color='lightgrey') |
| 153 | fontP = matplotlib.font_manager.FontProperties() |
| 154 | fontP.set_size('x-small') |
| 155 | ax.legend(loc='best', prop=fontP) |
| 156 | fig.tight_layout() |
| 157 | return fig |
| 158 | |
| 159 | # Plot data in a "spectrogram colormap" |
| 160 | def plot_specgram(data, logname, max_freq, axis): |
no test coverage detected