ch1 / ch2 add to pic

This commit is contained in:
awe
2026-04-10 21:02:14 +03:00
parent 0874a8aaf6
commit 44a89b8da3
2 changed files with 65 additions and 10 deletions

View File

@ -613,16 +613,57 @@ def run_pyqtgraph(args) -> None:
p_line = win.addPlot(row=0, col=0, title="Сырые данные")
p_line.showGrid(x=True, y=True, alpha=0.3)
curve = p_line.plot(pen=pg.mkPen((80, 120, 255), width=1))
curve_aux_1 = p_line.plot(pen=pg.mkPen((255, 170, 40), width=1))
curve_aux_2 = p_line.plot(pen=pg.mkPen((170, 70, 255), width=1))
p_line_aux_vb = None
if bin_iq_power_mode:
p_line_aux_vb = pg.ViewBox()
try:
p_line.showAxis("right")
p_line.getAxis("right").setLabel("CH1/CH2")
p_line.scene().addItem(p_line_aux_vb)
p_line.getAxis("right").linkToView(p_line_aux_vb)
p_line_aux_vb.setXLink(p_line)
except Exception:
p_line_aux_vb = None
curve_aux_1 = pg.PlotDataItem(pen=pg.mkPen((255, 170, 40), width=1))
curve_aux_2 = pg.PlotDataItem(pen=pg.mkPen((170, 70, 255), width=1))
if p_line_aux_vb is not None:
p_line_aux_vb.addItem(curve_aux_1)
p_line_aux_vb.addItem(curve_aux_2)
else:
p_line.addItem(curve_aux_1)
p_line.addItem(curve_aux_2)
else:
curve_aux_1 = p_line.plot(pen=pg.mkPen((255, 170, 40), width=1))
curve_aux_2 = p_line.plot(pen=pg.mkPen((170, 70, 255), width=1))
curve_calib = p_line.plot(pen=pg.mkPen((220, 60, 60), width=1))
curve_norm = p_line.plot(pen=pg.mkPen((60, 180, 90), width=1))
p_line.setLabel("bottom", "ГГц")
p_line.setLabel("left", "Y")
if bin_iq_power_mode:
try:
p_line.setLabel("left", "CH1^2 + CH2^2")
except Exception:
pass
ch_text = pg.TextItem("", anchor=(1, 1))
ch_text.setZValue(10)
p_line.addItem(ch_text)
def sync_line_aux_view() -> None:
if p_line_aux_vb is None:
return
try:
p_line_aux_vb.setGeometry(p_line.vb.sceneBoundingRect())
p_line_aux_vb.linkedViewChanged(p_line.vb, p_line_aux_vb.XAxis)
except Exception:
pass
if p_line_aux_vb is not None:
try:
p_line.vb.sigResized.connect(sync_line_aux_view)
sync_line_aux_view()
except Exception:
pass
p_img = win.addPlot(row=0, col=1, title="Сырые данные водопад")
p_img.invertY(False)
p_img.showGrid(x=False, y=False)
@ -1717,16 +1758,30 @@ def run_pyqtgraph(args) -> None:
curve_norm.setData([], [])
if fixed_ylim is None:
y_series = [
runtime.current_sweep_raw,
displayed_aux[0] if displayed_aux is not None else None,
displayed_aux[1] if displayed_aux is not None else None,
displayed_calib,
(runtime.current_sweep_norm * norm_display_scale) if runtime.current_sweep_norm is not None else None,
]
if bin_iq_power_mode:
y_series = [
runtime.current_sweep_raw,
displayed_calib,
(runtime.current_sweep_norm * norm_display_scale) if runtime.current_sweep_norm is not None else None,
]
else:
y_series = [
runtime.current_sweep_raw,
displayed_aux[0] if displayed_aux is not None else None,
displayed_aux[1] if displayed_aux is not None else None,
displayed_calib,
(runtime.current_sweep_norm * norm_display_scale) if runtime.current_sweep_norm is not None else None,
]
y_limits = compute_auto_ylim(*y_series)
if y_limits is not None:
p_line.setYRange(y_limits[0], y_limits[1], padding=0)
if p_line_aux_vb is not None:
aux_limits = compute_auto_ylim(
displayed_aux[0] if displayed_aux is not None else None,
displayed_aux[1] if displayed_aux is not None else None,
)
if aux_limits is not None:
p_line_aux_vb.setYRange(aux_limits[0], aux_limits[1], padding=0)
line_x_bounds = resolve_axis_bounds(xs)
if line_x_bounds is not None: