new channel mode

This commit is contained in:
awe
2026-04-10 19:18:38 +03:00
parent 3cd29c60d6
commit 709976c527
2 changed files with 112 additions and 4 deletions

View File

@ -412,6 +412,30 @@ def resolve_visible_aux_curves(aux_curves: SweepAuxCurves, enabled: bool) -> Swe
return aux_1_arr, aux_2_arr
def resolve_visible_raw_plot_curves(
raw_sweep: Optional[np.ndarray],
aux_curves: SweepAuxCurves,
*,
channel_pair_raw_mode: bool,
parsed_data_enabled: bool,
) -> Tuple[Optional[np.ndarray], SweepAuxCurves]:
"""Resolve visible series for the raw plot depending on current input mode."""
raw_arr = None
if raw_sweep is not None:
candidate = np.asarray(raw_sweep, dtype=np.float32).reshape(-1)
if candidate.size > 0:
raw_arr = candidate
if channel_pair_raw_mode:
visible_aux = resolve_visible_aux_curves(aux_curves, enabled=True)
if visible_aux is not None:
return None, visible_aux
return raw_arr, None
visible_aux = resolve_visible_aux_curves(aux_curves, enabled=parsed_data_enabled)
return raw_arr, visible_aux
def decimate_curve_for_display(
xs: Optional[np.ndarray],
ys: Optional[np.ndarray],
@ -534,6 +558,7 @@ def run_pyqtgraph(args) -> None:
or getattr(args, "parser_16_bit_x2", False)
or getattr(args, "parser_test", False)
)
channel_pair_raw_mode = bool(getattr(args, "bin_mode", False) and (not complex_sweep_mode))
if not sys.platform.startswith("win"):
display_name = os.environ.get("DISPLAY") or os.environ.get("WAYLAND_DISPLAY")
if not display_name:
@ -762,6 +787,12 @@ def run_pyqtgraph(args) -> None:
parsed_data_cb.setText("Сырые Re/Im")
except Exception:
pass
if channel_pair_raw_mode:
try:
parsed_data_cb.setEnabled(False)
parsed_data_cb.setToolTip("В режиме CH1/CH2 каналы отображаются всегда.")
except Exception:
pass
fft_curve_group = QtWidgets.QGroupBox("FFT кривые")
fft_curve_layout = QtWidgets.QVBoxLayout(fft_curve_group)
fft_curve_layout.setContentsMargins(6, 6, 6, 6)
@ -1656,10 +1687,15 @@ def run_pyqtgraph(args) -> None:
else (runtime.calib_envelope.size if runtime.calib_envelope is not None else 0)
)
displayed_calib = None
displayed_aux = resolve_visible_aux_curves(runtime.current_aux_curves, parsed_data_enabled)
displayed_raw, displayed_aux = resolve_visible_raw_plot_curves(
runtime.current_sweep_raw,
runtime.current_aux_curves,
channel_pair_raw_mode=channel_pair_raw_mode,
parsed_data_enabled=parsed_data_enabled,
)
if runtime.current_sweep_raw is not None:
raw_x, raw_y = decimate_curve_for_display(xs, runtime.current_sweep_raw)
if displayed_raw is not None:
raw_x, raw_y = decimate_curve_for_display(xs, displayed_raw)
raw_x, raw_y = sanitize_curve_data_for_display(raw_x, raw_y)
curve.setData(raw_x, raw_y, autoDownsample=False)
else:
@ -1701,7 +1737,7 @@ def run_pyqtgraph(args) -> None:
if fixed_ylim is None:
y_series = [
runtime.current_sweep_raw,
displayed_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,