Rework radar system
This commit is contained in:
@@ -32,7 +32,6 @@ def export_trace_png(
|
||||
trace: TraceData,
|
||||
output_path: Path,
|
||||
*,
|
||||
channel: str,
|
||||
title: str,
|
||||
) -> None:
|
||||
"""Render one trace's amplitude (dB) and wrapped phase (deg) panes to a PNG.
|
||||
@@ -41,22 +40,22 @@ def export_trace_png(
|
||||
curves as the live preview, and exports the scene as a PNG. Requires a
|
||||
running ``QApplication`` (always true inside the GUI).
|
||||
"""
|
||||
samples = trace.s11 if channel == "s11" else trace.s21
|
||||
samples = trace.s21
|
||||
magnitude_db = 20.0 * np.log10(np.maximum(np.abs(samples), 1e-12))
|
||||
phase_deg = np.degrees(np.angle(samples))
|
||||
|
||||
layout = pg.GraphicsLayoutWidget(show=False, size=_EXPORT_SIZE)
|
||||
layout.setBackground(_BACKGROUND)
|
||||
try:
|
||||
layout.addLabel(title, row=0, col=0, colspan=2)
|
||||
layout.ci.addLabel(title, row=0, col=0, colspan=2)
|
||||
|
||||
magnitude_plot = layout.addPlot(row=1, col=0)
|
||||
magnitude_plot = layout.ci.addPlot(row=1, col=0)
|
||||
magnitude_plot.showGrid(x=True, y=True, alpha=0.2)
|
||||
magnitude_plot.setLabel("bottom", "Frequency", units="Hz")
|
||||
magnitude_plot.setLabel("left", "Magnitude", units="dB")
|
||||
magnitude_plot.plot(trace.frequency_hz, magnitude_db, pen=_MAGNITUDE_PEN)
|
||||
|
||||
phase_plot = layout.addPlot(row=1, col=1)
|
||||
phase_plot = layout.ci.addPlot(row=1, col=1)
|
||||
phase_plot.showGrid(x=True, y=True, alpha=0.2)
|
||||
phase_plot.setLabel("bottom", "Frequency", units="Hz")
|
||||
phase_plot.setLabel("left", "Phase", units="deg")
|
||||
|
||||
Reference in New Issue
Block a user