Improved plotting of frequency sweep.

This commit is contained in:
jupfi 2023-08-08 19:23:11 +02:00
parent e2eafb4e6d
commit 720e3ac9f1

View file

@ -141,16 +141,22 @@ class AutoTMView(ModuleView):
#y_corr = np.array(y) - np.array(load_calibration) #y_corr = np.array(y) - np.array(load_calibration)
#y_corr = y_corr - np.mean(y_corr) #y_corr = y_corr - np.mean(y_corr)
ax = self._ui_form.S11Plot.canvas.ax phase_ax = self._ui_form.S11Plot.canvas.ax.twinx()
ax.clear() phase_ax.set_ylabel("Phase (deg)")
ax.set_xlabel("Frequency (MHz)") phase_ax.plot(x, phase, color="orange", linestyle="--")
ax.set_ylabel("S11 (dB)") phase_ax.set_ylim(-180, 180)
ax.set_title("S11") phase_ax.invert_yaxis()
ax.grid(True)
ax.plot(x, y) magnitude_ax = self._ui_form.S11Plot.canvas.ax
ax.plot(x, phase) magnitude_ax.clear()
magnitude_ax.set_xlabel("Frequency (MHz)")
magnitude_ax.set_ylabel("S11 (dB)")
magnitude_ax.set_title("S11")
magnitude_ax.grid(True)
magnitude_ax.plot(x, y)
# make the y axis go down instead of up # make the y axis go down instead of up
ax.invert_yaxis() magnitude_ax.invert_yaxis()
self._ui_form.S11Plot.canvas.draw() self._ui_form.S11Plot.canvas.draw()
self._ui_form.S11Plot.canvas.flush_events() self._ui_form.S11Plot.canvas.flush_events()
# Wait for the signals to be processed before adding the info text # Wait for the signals to be processed before adding the info text