something working new format
This commit is contained in:
@ -146,9 +146,7 @@ def run_matplotlib(args):
|
||||
ax_line.set_ylim(fixed_ylim)
|
||||
|
||||
# График спектра
|
||||
fft_line_t1, = ax_fft.plot([], [], lw=1, color="tab:blue", label="1/3 (low f)")
|
||||
fft_line_t2, = ax_fft.plot([], [], lw=1, color="tab:orange", label="2/3 (mid f)")
|
||||
fft_line_t3, = ax_fft.plot([], [], lw=1, color="tab:green", label="3/3 (high f)")
|
||||
fft_line_obj, = ax_fft.plot([], [], lw=1, color="tab:blue", label="full band")
|
||||
ax_fft.set_title("FFT", pad=1)
|
||||
ax_fft.set_xlabel("Глубина, м")
|
||||
ax_fft.set_ylabel("Амплитуда")
|
||||
@ -438,9 +436,7 @@ def run_matplotlib(args):
|
||||
ring.set_fft_complex_mode(str(label))
|
||||
except Exception:
|
||||
pass
|
||||
fft_line_t1.set_data([], [])
|
||||
fft_line_t2.set_data([], [])
|
||||
fft_line_t3.set_data([], [])
|
||||
fft_line_obj.set_data([], [])
|
||||
_refresh_status_texts()
|
||||
try:
|
||||
fig.canvas.draw_idle()
|
||||
@ -590,31 +586,20 @@ def run_matplotlib(args):
|
||||
ax_line.autoscale_view(scalex=False, scaley=True)
|
||||
ax_line.set_ylabel("Y")
|
||||
|
||||
# Профиль по глубине: три линии для 1/3, 2/3, 3/3 частотного диапазона.
|
||||
third_axes = ring.last_fft_third_axes_m
|
||||
third_vals = ring.last_fft_third_vals
|
||||
lines = (fft_line_t1, fft_line_t2, fft_line_t3)
|
||||
xs_max = []
|
||||
ys_min = []
|
||||
ys_max = []
|
||||
for line_fft, xs_fft, fft_vals in zip(lines, third_axes, third_vals):
|
||||
if xs_fft is None or fft_vals is None:
|
||||
line_fft.set_data([], [])
|
||||
continue
|
||||
n = min(int(xs_fft.size), int(fft_vals.size))
|
||||
if n <= 0:
|
||||
line_fft.set_data([], [])
|
||||
continue
|
||||
x_seg = xs_fft[:n]
|
||||
y_seg = fft_vals[:n]
|
||||
line_fft.set_data(x_seg, y_seg)
|
||||
xs_max.append(float(x_seg[n - 1]))
|
||||
ys_min.append(float(np.nanmin(y_seg)))
|
||||
ys_max.append(float(np.nanmax(y_seg)))
|
||||
|
||||
if xs_max and ys_min and ys_max:
|
||||
ax_fft.set_xlim(0, float(max(xs_max)))
|
||||
ax_fft.set_ylim(float(min(ys_min)), float(max(ys_max)))
|
||||
axis_fft = ring.fft_depth_axis_m
|
||||
vals_fft = ring.last_fft_vals
|
||||
if axis_fft is None or vals_fft is None:
|
||||
fft_line_obj.set_data([], [])
|
||||
else:
|
||||
n_fft = min(int(axis_fft.size), int(vals_fft.size))
|
||||
if n_fft <= 0:
|
||||
fft_line_obj.set_data([], [])
|
||||
else:
|
||||
x_fft = axis_fft[:n_fft]
|
||||
y_fft = vals_fft[:n_fft]
|
||||
fft_line_obj.set_data(x_fft, y_fft)
|
||||
ax_fft.set_xlim(0, float(x_fft[n_fft - 1]))
|
||||
ax_fft.set_ylim(float(np.nanmin(y_fft)), float(np.nanmax(y_fft)))
|
||||
|
||||
# Водопад сырых данных
|
||||
if changed and ring.is_ready:
|
||||
@ -664,9 +649,7 @@ def run_matplotlib(args):
|
||||
line_env_lo,
|
||||
line_env_hi,
|
||||
img_obj,
|
||||
fft_line_t1,
|
||||
fft_line_t2,
|
||||
fft_line_t3,
|
||||
fft_line_obj,
|
||||
img_fft_obj,
|
||||
status_text,
|
||||
pipeline_text,
|
||||
|
||||
@ -202,9 +202,7 @@ def run_pyqtgraph(args):
|
||||
# FFT (слева-снизу)
|
||||
p_fft = win.addPlot(row=1, col=0, title="FFT")
|
||||
p_fft.showGrid(x=True, y=True, alpha=0.3)
|
||||
curve_fft_t1 = p_fft.plot(pen=pg.mkPen((80, 120, 255), width=1))
|
||||
curve_fft_t2 = p_fft.plot(pen=pg.mkPen((255, 140, 70), width=1))
|
||||
curve_fft_t3 = p_fft.plot(pen=pg.mkPen((60, 180, 90), width=1))
|
||||
curve_fft = p_fft.plot(pen=pg.mkPen((80, 120, 255), width=1))
|
||||
p_fft.setLabel("bottom", "Глубина, м")
|
||||
p_fft.setLabel("left", "Амплитуда")
|
||||
|
||||
@ -494,9 +492,7 @@ def run_pyqtgraph(args):
|
||||
changed = False
|
||||
if changed:
|
||||
try:
|
||||
curve_fft_t1.setData([], [])
|
||||
curve_fft_t2.setData([], [])
|
||||
curve_fft_t3.setData([], [])
|
||||
curve_fft.setData([], [])
|
||||
except Exception:
|
||||
pass
|
||||
_refresh_pipeline_label()
|
||||
@ -630,31 +626,20 @@ def run_pyqtgraph(args):
|
||||
p_line.enableAutoRange(axis="y", enable=True)
|
||||
p_line.setLabel("left", "Y")
|
||||
|
||||
# Профиль по глубине: три линии для 1/3, 2/3, 3/3 частотного диапазона.
|
||||
third_axes = ring.last_fft_third_axes_m
|
||||
third_vals = ring.last_fft_third_vals
|
||||
curves = (curve_fft_t1, curve_fft_t2, curve_fft_t3)
|
||||
xs_max = []
|
||||
ys_min = []
|
||||
ys_max = []
|
||||
for curve_fft, xs_fft, fft_vals in zip(curves, third_axes, third_vals):
|
||||
if xs_fft is None or fft_vals is None:
|
||||
axis_fft = ring.fft_depth_axis_m
|
||||
vals_fft = ring.last_fft_vals
|
||||
if axis_fft is None or vals_fft is None:
|
||||
curve_fft.setData([], [])
|
||||
else:
|
||||
n_fft = min(int(axis_fft.size), int(vals_fft.size))
|
||||
if n_fft <= 0:
|
||||
curve_fft.setData([], [])
|
||||
continue
|
||||
n = min(int(xs_fft.size), int(fft_vals.size))
|
||||
if n <= 0:
|
||||
curve_fft.setData([], [])
|
||||
continue
|
||||
x_seg = xs_fft[:n]
|
||||
y_seg = fft_vals[:n]
|
||||
curve_fft.setData(x_seg, y_seg)
|
||||
xs_max.append(float(x_seg[n - 1]))
|
||||
ys_min.append(float(np.nanmin(y_seg)))
|
||||
ys_max.append(float(np.nanmax(y_seg)))
|
||||
|
||||
if xs_max and ys_min and ys_max:
|
||||
p_fft.setXRange(0.0, float(max(xs_max)), padding=0)
|
||||
p_fft.setYRange(float(min(ys_min)), float(max(ys_max)), padding=0)
|
||||
else:
|
||||
x_fft = axis_fft[:n_fft]
|
||||
y_fft = vals_fft[:n_fft]
|
||||
curve_fft.setData(x_fft, y_fft)
|
||||
p_fft.setXRange(0.0, float(x_fft[n_fft - 1]), padding=0)
|
||||
p_fft.setYRange(float(np.nanmin(y_fft)), float(np.nanmax(y_fft)), padding=0)
|
||||
|
||||
# Позиция подписи канала
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user