3 freq diversion
This commit is contained in:
@ -146,10 +146,13 @@ def run_matplotlib(args):
|
||||
ax_line.set_ylim(fixed_ylim)
|
||||
|
||||
# График спектра
|
||||
fft_line_obj, = ax_fft.plot([], [], lw=1)
|
||||
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)")
|
||||
ax_fft.set_title("FFT", pad=1)
|
||||
ax_fft.set_xlabel("Глубина, м")
|
||||
ax_fft.set_ylabel("Амплитуда")
|
||||
ax_fft.legend(loc="upper right", fontsize=8)
|
||||
|
||||
# Водопад сырых данных
|
||||
img_obj = ax_img.imshow(
|
||||
@ -435,6 +438,9 @@ 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([], [])
|
||||
_refresh_status_texts()
|
||||
try:
|
||||
fig.canvas.draw_idle()
|
||||
@ -584,18 +590,31 @@ def run_matplotlib(args):
|
||||
ax_line.autoscale_view(scalex=False, scaley=True)
|
||||
ax_line.set_ylabel("Y")
|
||||
|
||||
# Профиль по глубине — используем уже вычисленный в ring IFFT.
|
||||
if ring.last_fft_vals is not None and ring.fft_depth_axis_m is not None:
|
||||
fft_vals = ring.last_fft_vals
|
||||
xs_fft = ring.fft_depth_axis_m
|
||||
n = min(fft_vals.size, xs_fft.size)
|
||||
if n > 0:
|
||||
fft_line_obj.set_data(xs_fft[:n], fft_vals[:n])
|
||||
else:
|
||||
fft_line_obj.set_data([], [])
|
||||
if n > 0 and np.isfinite(np.nanmin(fft_vals)) and np.isfinite(np.nanmax(fft_vals)):
|
||||
ax_fft.set_xlim(0, float(xs_fft[n - 1]))
|
||||
ax_fft.set_ylim(float(np.nanmin(fft_vals)), float(np.nanmax(fft_vals)))
|
||||
# Профиль по глубине: три линии для 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)))
|
||||
|
||||
# Водопад сырых данных
|
||||
if changed and ring.is_ready:
|
||||
@ -645,7 +664,9 @@ def run_matplotlib(args):
|
||||
line_env_lo,
|
||||
line_env_hi,
|
||||
img_obj,
|
||||
fft_line_obj,
|
||||
fft_line_t1,
|
||||
fft_line_t2,
|
||||
fft_line_t3,
|
||||
img_fft_obj,
|
||||
status_text,
|
||||
pipeline_text,
|
||||
|
||||
@ -202,7 +202,9 @@ 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 = p_fft.plot(pen=pg.mkPen((255, 120, 80), width=1))
|
||||
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))
|
||||
p_fft.setLabel("bottom", "Глубина, м")
|
||||
p_fft.setLabel("left", "Амплитуда")
|
||||
|
||||
@ -492,7 +494,9 @@ def run_pyqtgraph(args):
|
||||
changed = False
|
||||
if changed:
|
||||
try:
|
||||
curve_fft.setData([], [])
|
||||
curve_fft_t1.setData([], [])
|
||||
curve_fft_t2.setData([], [])
|
||||
curve_fft_t3.setData([], [])
|
||||
except Exception:
|
||||
pass
|
||||
_refresh_pipeline_label()
|
||||
@ -626,15 +630,31 @@ def run_pyqtgraph(args):
|
||||
p_line.enableAutoRange(axis="y", enable=True)
|
||||
p_line.setLabel("left", "Y")
|
||||
|
||||
# Профиль по глубине — используем уже вычисленный в ring IFFT.
|
||||
if ring.last_fft_vals is not None and ring.fft_depth_axis_m is not None:
|
||||
fft_vals = ring.last_fft_vals
|
||||
xs_fft = ring.fft_depth_axis_m
|
||||
n = min(fft_vals.size, xs_fft.size)
|
||||
if n > 0:
|
||||
curve_fft.setData(xs_fft[:n], fft_vals[:n])
|
||||
p_fft.setXRange(0.0, float(xs_fft[n - 1]), padding=0)
|
||||
p_fft.setYRange(float(np.nanmin(fft_vals)), float(np.nanmax(fft_vals)), padding=0)
|
||||
# Профиль по глубине: три линии для 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:
|
||||
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)
|
||||
|
||||
# Позиция подписи канала
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user