range for phase diff
This commit is contained in:
@ -202,7 +202,7 @@ def build_gui():
|
||||
p_norm.setXLink(p_raw)
|
||||
c_norm_amp = p_norm.plot(pen=pg.mkPen((80, 120, 255), width=1))
|
||||
|
||||
# Row 3: normalized phase + linear fit + deviation
|
||||
# Row 3: normalized phase + linear fit + deviation (right axis)
|
||||
p_ph = win.addPlot(row=3, col=0, title="Нормированная фаза arg(S)")
|
||||
p_ph.showGrid(x=True, y=True, alpha=0.3)
|
||||
p_ph.setLabel("bottom", "Частота", units="ГГц")
|
||||
@ -211,7 +211,25 @@ def build_gui():
|
||||
p_ph.addLegend(offset=(10, 10))
|
||||
c_ph = p_ph.plot(pen=pg.mkPen((230, 180, 40), width=1), name="Фаза")
|
||||
c_ph_line = p_ph.plot(pen=pg.mkPen((180, 180, 180), width=1, style=QtCore.Qt.DashLine), name="Лин. прибл.")
|
||||
c_ph_dev = p_ph.plot(pen=pg.mkPen((255, 100, 200), width=1), name="Отклонение")
|
||||
|
||||
# Secondary Y axis (right) for deviation, fixed -1..1
|
||||
vb_dev = pg.ViewBox()
|
||||
p_ph.showAxis("right")
|
||||
p_ph.scene().addItem(vb_dev)
|
||||
p_ph.getAxis("right").linkToView(vb_dev)
|
||||
vb_dev.setXLink(p_ph)
|
||||
p_ph.setLabel("right", "Отклонение", units="рад")
|
||||
p_ph.getAxis("right").setPen(pg.mkPen((255, 100, 200)))
|
||||
c_ph_dev = pg.PlotCurveItem(pen=pg.mkPen((255, 100, 200), width=1), name="Отклонение")
|
||||
vb_dev.addItem(c_ph_dev)
|
||||
vb_dev.setYRange(-1, 1)
|
||||
vb_dev.enableAutoRange(axis=pg.ViewBox.YAxis, enable=False)
|
||||
|
||||
# Keep secondary ViewBox geometry in sync
|
||||
def sync_views():
|
||||
vb_dev.setGeometry(p_ph.vb.sceneBoundingRect())
|
||||
vb_dev.linkedViewChanged(p_ph.vb, vb_dev.XAxis)
|
||||
p_ph.vb.sigResized.connect(sync_views)
|
||||
|
||||
# Row 4: FFT distance
|
||||
p_fft = win.addPlot(row=4, col=0, title="FFT — расстояние")
|
||||
@ -307,8 +325,8 @@ def make_update(reader, parser, assembler, curves, plots):
|
||||
p_norm.setXRange(fx0, fx1, padding=0)
|
||||
p_norm.setYRange(float(norm_amp.min()), float(norm_amp.max()), padding=0.05)
|
||||
|
||||
# Row 3: phase + line + deviation
|
||||
y_all = np.concatenate([phase, line, deviation])
|
||||
# Row 3: phase + line (deviation is on separate right axis, fixed -1..1)
|
||||
y_all = np.concatenate([phase, line])
|
||||
p_ph.disableAutoRange()
|
||||
p_ph.setXRange(fx0, fx1, padding=0)
|
||||
p_ph.setYRange(float(y_all.min()), float(y_all.max()), padding=0.05)
|
||||
|
||||
Reference in New Issue
Block a user