Refactor radar system
This commit is contained in:
@@ -22,7 +22,8 @@ def build_data_actions_group(owner) -> QGroupBox:
|
||||
layout.setSpacing(8)
|
||||
data_defaults = owner._gui_defaults.data_actions
|
||||
|
||||
save_button = QPushButton("Save Dataset")
|
||||
save_button = QPushButton("Save Last 1000")
|
||||
save_button.setToolTip("Save up to 1000 most recent measurements with all available data stages.")
|
||||
save_button.clicked.connect(owner._save_snapshot)
|
||||
save_button.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed)
|
||||
save_vna_json_button = QPushButton("Save S21 JSON")
|
||||
@@ -43,10 +44,6 @@ def build_data_actions_group(owner) -> QGroupBox:
|
||||
)
|
||||
record_button.clicked.connect(owner._start_run_with_recording)
|
||||
record_button.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Fixed)
|
||||
owner._save_count = QSpinBox()
|
||||
owner._save_count.setMinimum(1)
|
||||
owner._save_count.setMaximum(10_000)
|
||||
owner._save_count.setValue(int(data_defaults.save_count))
|
||||
owner._record_count = QSpinBox()
|
||||
owner._record_count.setMinimum(1)
|
||||
owner._record_count.setMaximum(1_000_000)
|
||||
@@ -64,13 +61,6 @@ def build_data_actions_group(owner) -> QGroupBox:
|
||||
button_grid.setColumnStretch(1, 1)
|
||||
layout.addLayout(button_grid)
|
||||
|
||||
count_row = QHBoxLayout()
|
||||
count_row.setSpacing(8)
|
||||
count_row.addWidget(QLabel("Number of Measurements to Save"))
|
||||
count_row.addWidget(owner._save_count)
|
||||
count_row.addStretch(1)
|
||||
layout.addLayout(count_row)
|
||||
|
||||
record_count_row = QHBoxLayout()
|
||||
record_count_row.setSpacing(8)
|
||||
record_count_row.addWidget(QLabel("Number of Sweeps to Record"))
|
||||
|
||||
@@ -8,9 +8,7 @@ from PyQt6.QtWidgets import (
|
||||
QDoubleSpinBox,
|
||||
QFormLayout,
|
||||
QGroupBox,
|
||||
QLabel,
|
||||
QLineEdit,
|
||||
QPlainTextEdit,
|
||||
QSizePolicy,
|
||||
QSpinBox,
|
||||
QStackedWidget,
|
||||
@@ -20,6 +18,7 @@ from PyQt6.QtWidgets import (
|
||||
|
||||
from python_app.gui.controllers.app_window_config.state_builders import GUI_SAVE_HISTORY_LIMIT
|
||||
from python_app.gui.controllers.sections.layout_helpers import FormRow, build_two_column_form_widget
|
||||
from python_app.gui.antenna_geometry_editor import AntennaGeometryEditor
|
||||
|
||||
|
||||
# Same semantics on every GPR-like page; the data_processor applies them.
|
||||
@@ -30,31 +29,6 @@ _IGNORE_SOCKET_SPEED_TOOLTIP = (
|
||||
)
|
||||
|
||||
|
||||
def _format_geometry_row(position: int, x_m: float, y_m: float, z_m: float) -> str:
|
||||
"""Render one geometry row, trimming trailing zero y/z so 1D layouts stay compact."""
|
||||
if z_m != 0.0:
|
||||
return f"{position} {x_m:g} {y_m:g} {z_m:g}"
|
||||
if y_m != 0.0:
|
||||
return f"{position} {x_m:g} {y_m:g}"
|
||||
return f"{position} {x_m:g}"
|
||||
|
||||
|
||||
def _format_tx_geometry(owner) -> str:
|
||||
"""Render Tx geometry defaults into editable line-based text."""
|
||||
return "\n".join(
|
||||
_format_geometry_row(int(entry.output_pos), float(entry.x_m), float(entry.y_m), float(entry.z_m))
|
||||
for entry in owner._defaults_config.gpr.tx_geometry
|
||||
)
|
||||
|
||||
|
||||
def _format_rx_geometry(owner) -> str:
|
||||
"""Render Rx geometry defaults into editable line-based text."""
|
||||
return "\n".join(
|
||||
_format_geometry_row(int(entry.input_pos), float(entry.x_m), float(entry.y_m), float(entry.z_m))
|
||||
for entry in owner._defaults_config.gpr.rx_geometry
|
||||
)
|
||||
|
||||
|
||||
def _build_processing_mode_page(parent: QStackedWidget, rows: list[FormRow], *, split_index: int | None = None) -> QWidget:
|
||||
"""Create one processing-mode page with a two-column form body."""
|
||||
page = QWidget(parent)
|
||||
@@ -199,21 +173,19 @@ def build_processing_group(owner) -> QGroupBox:
|
||||
|
||||
# Medium permittivity is a legacy-GPR-only knob (shown on the legacy page below).
|
||||
# Coherent BP fixes the medium to eps_r = 1 (Horns_motion_3libre.py), so it is not
|
||||
# offered there. Applies on the next pipeline start (a run_config field).
|
||||
# offered there.
|
||||
owner._gpr_relative_permittivity = QDoubleSpinBox()
|
||||
owner._gpr_relative_permittivity.setDecimals(4)
|
||||
owner._gpr_relative_permittivity.setRange(0.0001, 1000.0)
|
||||
owner._gpr_relative_permittivity.setSingleStep(0.05)
|
||||
owner._gpr_relative_permittivity.setToolTip("Applied on the next pipeline start (Save Config and restart).")
|
||||
owner._gpr_relative_permittivity.setValue(float(gpr_defaults.relative_permittivity))
|
||||
|
||||
owner._gpr_tx_geometry_input = QPlainTextEdit(_format_tx_geometry(owner))
|
||||
owner._gpr_tx_geometry_input.setPlaceholderText("output_pos x_m [y_m] [z_m]")
|
||||
owner._gpr_tx_geometry_input.setFixedHeight(78)
|
||||
|
||||
owner._gpr_rx_geometry_input = QPlainTextEdit(_format_rx_geometry(owner))
|
||||
owner._gpr_rx_geometry_input.setPlaceholderText("input_pos x_m [y_m] [z_m]")
|
||||
owner._gpr_rx_geometry_input.setFixedHeight(78)
|
||||
owner._gpr_tx_geometry_input = AntennaGeometryEditor(
|
||||
"output_pos", gpr_defaults.tx_geometry, position_count=owner._defaults_config.output_switch.positions,
|
||||
)
|
||||
owner._gpr_rx_geometry_input = AntennaGeometryEditor(
|
||||
"input_pos", gpr_defaults.rx_geometry, position_count=owner._defaults_config.input_switch.positions,
|
||||
)
|
||||
|
||||
owner._gpr_common_page = _build_processing_mode_page(
|
||||
group,
|
||||
@@ -224,9 +196,9 @@ def build_processing_group(owner) -> QGroupBox:
|
||||
split_index=1,
|
||||
)
|
||||
|
||||
owner._gpr_geometry_hint = QLabel("To apply Tx/Rx geometry changes: Save Config and restart the app")
|
||||
owner._gpr_geometry_hint.setWordWrap(True)
|
||||
owner._gpr_common_page.layout().addWidget(owner._gpr_geometry_hint)
|
||||
owner._gpr_tx_geometry_input.changed.connect(owner._on_gpr_geometry_changed)
|
||||
owner._gpr_rx_geometry_input.changed.connect(owner._on_gpr_geometry_changed)
|
||||
owner._gpr_relative_permittivity.valueChanged.connect(owner._on_gpr_geometry_changed)
|
||||
|
||||
owner._gpr_input_positions_input = QLineEdit(str(gpr_live_defaults.input_positions))
|
||||
owner._gpr_input_positions_input.setPlaceholderText("0,1,2")
|
||||
|
||||
@@ -45,6 +45,8 @@ def build_switch_group(owner) -> QGroupBox:
|
||||
owner._single_combo_input.setPlaceholderText("0")
|
||||
owner._single_combo_select_button = QPushButton("Select")
|
||||
owner._single_combo_select_button.setCheckable(True)
|
||||
owner._next_combo_button = QPushButton("Next combination")
|
||||
owner._next_combo_button.setToolTip("Advance through input/output pairs and redraw the selected B-scan.")
|
||||
|
||||
single_row = QHBoxLayout()
|
||||
single_row.setSpacing(8)
|
||||
@@ -54,6 +56,7 @@ def build_switch_group(owner) -> QGroupBox:
|
||||
single_row.addWidget(QLabel("Output"))
|
||||
single_row.addWidget(owner._single_combo_output)
|
||||
single_row.addWidget(owner._single_combo_select_button)
|
||||
single_row.addWidget(owner._next_combo_button)
|
||||
layout.addLayout(single_row)
|
||||
|
||||
owner._combo_select_group = QButtonGroup(group)
|
||||
@@ -63,6 +66,7 @@ def build_switch_group(owner) -> QGroupBox:
|
||||
|
||||
owner._run_combos_select_button.clicked.connect(lambda: owner._set_combo_selection_mode("text"))
|
||||
owner._single_combo_select_button.clicked.connect(lambda: owner._set_combo_selection_mode("single"))
|
||||
owner._next_combo_button.clicked.connect(owner._select_next_combo)
|
||||
# The live processing config has no combo: picking another one only changes which
|
||||
# B-scan is shown (and, outside matrix mode, the combo of the next run).
|
||||
owner._single_combo_output.editingFinished.connect(owner._on_bscan_display_combo_changed)
|
||||
|
||||
Reference in New Issue
Block a user