working version

This commit is contained in:
Ayzen
2026-05-18 17:27:00 +03:00
parent 907dbf29ce
commit 0da8b1283c
23 changed files with 1479 additions and 133 deletions
@@ -7,6 +7,7 @@ import numpy as np
import pyqtgraph as pg
from python_app.models.dataset_model import ResultCollection, TraceData
from python_app.models.run_config_model import parse_combos_from_text
class AppWindowTracePlotMixin:
@@ -26,6 +27,24 @@ class AppWindowTracePlotMixin:
y_max = float(self._pass_through_y_max_db.value())
return bool(self._pass_through_fixed_y_enabled.isChecked()), min(y_min, y_max), max(y_min, y_max)
def _pass_through_combo_filter(self) -> set[tuple[int, int]] | None:
"""Return selected pass-through switch combos, or `None` when all are visible."""
text = self._pass_through_combo_filter_input.text().strip()
if not text:
return None
try:
return {
(int(combo.input), int(combo.output))
for combo in parse_combos_from_text(text)
}
except Exception as exc: # noqa: BLE001
self._log_warning(
"Invalid pass-through switch-combo filter.",
details=f"{exc}\nExpected format: input:output,input:output",
once_key=f"pass_through_combo_filter_invalid_{text}",
)
return set()
def _configure_pass_through_magnitude_axis(self, plot: pg.PlotWidget) -> None:
"""Apply pass-through magnitude-axis autorange or fixed Y window."""
fixed_y_enabled, y_min, y_max = self._pass_through_fixed_y_range()
@@ -91,6 +110,7 @@ class AppWindowTracePlotMixin:
if not show_magnitude and not show_phase:
self._clear_trace_plots()
return False
combo_filter = self._pass_through_combo_filter()
if show_magnitude:
mag_item = magnitude_plot.getPlotItem()
@@ -133,6 +153,8 @@ class AppWindowTracePlotMixin:
x_max = -np.inf
for block in collection.blocks:
combo_key = (int(block.combo.input_pos), int(block.combo.output_pos))
if combo_filter is not None and combo_key not in combo_filter:
continue
if combo_key not in combo_colors:
combo_colors[combo_key] = palette[len(combo_colors) % len(palette)]
color = combo_colors[combo_key]