This commit is contained in:
awe
2026-05-04 21:26:08 +03:00
parent 3b5af19c6f
commit 16146eda1e

View File

@ -436,7 +436,7 @@ def resolve_distance_cut_start(
distance_axis: Optional[np.ndarray], distance_axis: Optional[np.ndarray],
cut_percent: float, cut_percent: float,
) -> Optional[float]: ) -> Optional[float]:
"""Return distance threshold for hiding the beginning of FFT/B-scan axis.""" """Return distance threshold for hiding the beginning of the FFT line axis."""
if distance_axis is None: if distance_axis is None:
return None return None
axis_arr = np.asarray(distance_axis, dtype=np.float64).reshape(-1) axis_arr = np.asarray(distance_axis, dtype=np.float64).reshape(-1)
@ -1065,7 +1065,7 @@ def run_pyqtgraph(args) -> None:
fft_mode_combo.addItem("Симметричный", "symmetric") fft_mode_combo.addItem("Симметричный", "symmetric")
fft_mode_combo.addItem("Нули [-max,+min]", "positive_only") fft_mode_combo.addItem("Нули [-max,+min]", "positive_only")
fft_mode_combo.addItem("Нули [-max,+min] точный", "positive_only_exact") fft_mode_combo.addItem("Нули [-max,+min] точный", "positive_only_exact")
fft_low_cut_label = QtWidgets.QLabel("Срез начала FFT/B-scan") fft_low_cut_label = QtWidgets.QLabel("Срез начала FFT")
fft_low_cut_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal) fft_low_cut_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
fft_low_cut_slider.setRange(0, int(FFT_LOW_CUT_MAX_PERCENT * FFT_LOW_CUT_SLIDER_SCALE)) fft_low_cut_slider.setRange(0, int(FFT_LOW_CUT_MAX_PERCENT * FFT_LOW_CUT_SLIDER_SCALE))
fft_low_cut_slider.setValue(0) fft_low_cut_slider.setValue(0)
@ -1501,20 +1501,22 @@ def run_pyqtgraph(args) -> None:
distance_bounds = resolve_axis_bounds(runtime.ring.distance_axis) distance_bounds = resolve_axis_bounds(runtime.ring.distance_axis)
if distance_bounds is not None: if distance_bounds is not None:
d_min, d_max = distance_bounds d_min_full, d_max = distance_bounds
d_cut = _active_distance_cut_start() span = max(1e-9, float(d_max - d_min_full))
if d_cut is not None and np.isfinite(d_cut): set_image_rect_if_changed("fft_waterfall_rect", img_fft, 0.0, d_min_full, float(max_sweeps), span)
d_min = max(float(d_min), float(d_cut))
span = max(1e-9, float(d_max - d_min))
set_image_rect_if_changed("fft_waterfall_rect", img_fft, 0.0, d_min, float(max_sweeps), span)
set_xy_range_if_changed( set_xy_range_if_changed(
"fft_waterfall_range", "fft_waterfall_range",
p_spec, p_spec,
x_bounds=(0, max_sweeps - 1), x_bounds=(0, max_sweeps - 1),
y_bounds=(d_min, d_max), y_bounds=(d_min_full, d_max),
padding=0, padding=0,
) )
set_x_range_if_changed("fft_x", p_fft, d_min, d_max, padding=0)
d_min_fft = d_min_full
d_cut = _active_distance_cut_start()
if d_cut is not None and np.isfinite(d_cut):
d_min_fft = max(float(d_min_fft), float(d_cut))
set_x_range_if_changed("fft_x", p_fft, d_min_fft, d_max, padding=0)
refresh_fft_low_cut_label() refresh_fft_low_cut_label()
def resolve_curve_xs(size: int) -> np.ndarray: def resolve_curve_xs(size: int) -> np.ndarray:
@ -3419,12 +3421,7 @@ def run_pyqtgraph(args) -> None:
disp_fft_lin = disp_fft_lin[:row_take, :] disp_fft_lin = disp_fft_lin[:row_take, :]
if active_background is not None: if active_background is not None:
active_background = active_background[:row_take] active_background = active_background[:row_take]
fft_cut_start = _active_distance_cut_start() # B-scan must show the full distance range; the low-cut slider only crops the FFT line plot.
axis_arr, keep_mask = apply_distance_cut_to_axis(axis_arr, fft_cut_start)
if keep_mask.size > 0:
disp_fft_lin = disp_fft_lin[keep_mask, :]
if active_background is not None and active_background.size == keep_mask.size:
active_background = active_background[keep_mask]
disp_fft_axis = axis_arr disp_fft_axis = axis_arr
disp_fft_axis, disp_fft_lin, display_row_idx = decimate_bscan_rows_for_display( disp_fft_axis, disp_fft_lin, display_row_idx = decimate_bscan_rows_for_display(
disp_fft_axis, disp_fft_axis,