fixed UI
This commit is contained in:
@@ -17,6 +17,14 @@ from python_app.orchestration.gpr_locator import (
|
||||
class AppWindowGprPlotMixin:
|
||||
"""Renders GPR accumulator heatmaps and detected object overlays."""
|
||||
|
||||
def _gpr_plot_title(self, *, objects_only: bool = False) -> str:
|
||||
"""Return title for the active GPR-like processing mode."""
|
||||
if self._processing_mode.currentText() == "legacy_gpr":
|
||||
title = f"Legacy GPR {self._legacy_gpr_config_mode.currentText()}"
|
||||
else:
|
||||
title = "GPR coherent BP"
|
||||
return f"{title} Objects Only" if objects_only else title
|
||||
|
||||
def _clear_gpr_plot(self) -> None:
|
||||
"""Clear latest GPR plot surface."""
|
||||
if not hasattr(self, "_gpr_plot"):
|
||||
@@ -39,7 +47,7 @@ class AppWindowGprPlotMixin:
|
||||
if self._gpr_region_centers_item is not None:
|
||||
self._gpr_region_centers_item.setData(x=[], y=[])
|
||||
self._gpr_region_centers_item.hide()
|
||||
self._gpr_plot.setTitle("GPR coherent BP")
|
||||
self._gpr_plot.setTitle(self._gpr_plot_title())
|
||||
|
||||
def _configure_gpr_plot_axes(self) -> None:
|
||||
"""Apply persistent GPR plot axis labels and base view settings."""
|
||||
@@ -162,8 +170,14 @@ class AppWindowGprPlotMixin:
|
||||
|
||||
def _selected_gpr_geometry(self) -> tuple[np.ndarray, np.ndarray]:
|
||||
"""Resolve selected Tx/Rx geometry arrays for current GPR selection."""
|
||||
requested_inputs = tuple(self._parse_csv_int_list(self._gpr_input_positions_input.text()))
|
||||
requested_outputs = tuple(self._parse_csv_int_list(self._gpr_output_positions_input.text()))
|
||||
if self._processing_mode.currentText() == "legacy_gpr":
|
||||
input_positions_text = self._legacy_gpr_input_positions_input.text()
|
||||
output_positions_text = self._legacy_gpr_output_positions_input.text()
|
||||
else:
|
||||
input_positions_text = self._gpr_input_positions_input.text()
|
||||
output_positions_text = self._gpr_output_positions_input.text()
|
||||
requested_inputs = tuple(self._parse_csv_int_list(input_positions_text))
|
||||
requested_outputs = tuple(self._parse_csv_int_list(output_positions_text))
|
||||
signature = (
|
||||
self._gpr_tx_geometry_input.toPlainText(),
|
||||
self._gpr_rx_geometry_input.toPlainText(),
|
||||
@@ -193,7 +207,7 @@ class AppWindowGprPlotMixin:
|
||||
|
||||
def _draw_gpr_map(self, collection: ResultCollection) -> bool:
|
||||
"""Draw latest collection-level GPR plot according to current render mode."""
|
||||
if self._gpr_render_mode.currentText() == "objects_only":
|
||||
if self._gpr_render_mode_text() == "objects_only":
|
||||
return self._draw_gpr_objects_only(collection)
|
||||
return self._draw_gpr_heatmap(collection)
|
||||
|
||||
@@ -251,7 +265,8 @@ class AppWindowGprPlotMixin:
|
||||
)
|
||||
self._gpr_points_item.show()
|
||||
for x_value, y_value, score in points:
|
||||
label = pg.TextItem(text=f"{float(score):.2f}", color="#ffffff", anchor=(0.0, 1.0))
|
||||
label_text = f"{float(score):.0f}" if self._processing_mode.currentText() == "legacy_gpr" else f"{float(score):.2f}"
|
||||
label = pg.TextItem(text=label_text, color="#ffffff", anchor=(0.0, 1.0))
|
||||
label.setZValue(40)
|
||||
label.setPos(float(x_value), float(y_value))
|
||||
plot.addItem(label)
|
||||
@@ -297,7 +312,7 @@ class AppWindowGprPlotMixin:
|
||||
self._gpr_region_mask_items.append(mask_image)
|
||||
self._gpr_region_contours.append(contour)
|
||||
|
||||
plot.setTitle("GPR coherent BP")
|
||||
plot.setTitle(self._gpr_plot_title())
|
||||
finally:
|
||||
plot.setUpdatesEnabled(True)
|
||||
return True
|
||||
@@ -315,14 +330,24 @@ class AppWindowGprPlotMixin:
|
||||
|
||||
def _gpr_visible_bounds(self) -> tuple[float, float, float, float]:
|
||||
"""Return normalized GPR visible X/Z bounds from GUI controls."""
|
||||
if self._processing_mode.currentText() == "legacy_gpr":
|
||||
x_min_widget = self._legacy_gpr_visible_x_min_m
|
||||
x_max_widget = self._legacy_gpr_visible_x_max_m
|
||||
z_min_widget = self._legacy_gpr_visible_z_min_m
|
||||
z_max_widget = self._legacy_gpr_visible_z_max_m
|
||||
else:
|
||||
x_min_widget = self._gpr_visible_x_min_m
|
||||
x_max_widget = self._gpr_visible_x_max_m
|
||||
z_min_widget = self._gpr_visible_z_min_m
|
||||
z_max_widget = self._gpr_visible_z_max_m
|
||||
x_min, x_max = self._normalized_display_range(
|
||||
float(self._gpr_visible_x_min_m.value()),
|
||||
float(self._gpr_visible_x_max_m.value()),
|
||||
float(x_min_widget.value()),
|
||||
float(x_max_widget.value()),
|
||||
minimum_span=0.1,
|
||||
)
|
||||
z_min, z_max = self._normalized_display_range(
|
||||
float(self._gpr_visible_z_min_m.value()),
|
||||
float(self._gpr_visible_z_max_m.value()),
|
||||
float(z_min_widget.value()),
|
||||
float(z_max_widget.value()),
|
||||
minimum_span=0.1,
|
||||
)
|
||||
return x_min, x_max, z_min, z_max
|
||||
@@ -331,6 +356,18 @@ class AppWindowGprPlotMixin:
|
||||
"""Return normalized object/locator visible X/Z bounds from GUI controls."""
|
||||
return self._gpr_visible_bounds()
|
||||
|
||||
def _gpr_render_mode_text(self) -> str:
|
||||
"""Return render mode for the active GPR-like processing mode."""
|
||||
if self._processing_mode.currentText() == "legacy_gpr":
|
||||
return self._legacy_gpr_render_mode.currentText()
|
||||
return self._gpr_render_mode.currentText()
|
||||
|
||||
def _gpr_locator_threshold(self) -> float:
|
||||
"""Return object threshold using the active GPR mode's score semantics."""
|
||||
if self._processing_mode.currentText() == "legacy_gpr":
|
||||
return float(self._legacy_gpr_min_visible_pair_count.value())
|
||||
return float(self._gpr_min_visible_score.value())
|
||||
|
||||
@staticmethod
|
||||
def _gpr_display_y_min(z_min: float, z_max: float) -> float:
|
||||
"""Return lower display bound, preserving surface markers only when surface is visible."""
|
||||
@@ -372,9 +409,10 @@ class AppWindowGprPlotMixin:
|
||||
self._gpr_rx_item.setData(x=[], y=[])
|
||||
self._gpr_rx_item.hide()
|
||||
|
||||
@staticmethod
|
||||
def _format_gpr_object_label(x_m: float, z_m: float, score: float) -> str:
|
||||
def _format_gpr_object_label(self, x_m: float, z_m: float, score: float) -> str:
|
||||
"""Format object-only annotation text with normalized BP score and coordinates."""
|
||||
if self._processing_mode.currentText() == "legacy_gpr":
|
||||
return f"{int(round(score))} | x={x_m:.1f} | z={z_m:.1f}"
|
||||
return f"{score:.2f} | x={x_m:.1f} | z={z_m:.1f}"
|
||||
|
||||
@staticmethod
|
||||
@@ -451,7 +489,7 @@ class AppWindowGprPlotMixin:
|
||||
return rows
|
||||
|
||||
x_min, x_max, z_min, z_max = self._gpr_visible_object_bounds()
|
||||
min_score = float(self._gpr_min_visible_score.value())
|
||||
min_score = self._gpr_locator_threshold()
|
||||
finite_mask = np.all(np.isfinite(rows[:, :3]), axis=1)
|
||||
visible_mask = (
|
||||
finite_mask
|
||||
@@ -527,7 +565,7 @@ class AppWindowGprPlotMixin:
|
||||
|
||||
plot.setXRange(x_min, x_max, padding=0.0)
|
||||
plot.setYRange(self._gpr_display_y_min(z_min, z_max), z_max, padding=0.0)
|
||||
plot.setTitle("GPR coherent BP Objects Only")
|
||||
plot.setTitle(self._gpr_plot_title(objects_only=True))
|
||||
finally:
|
||||
plot.setUpdatesEnabled(True)
|
||||
return True
|
||||
|
||||
@@ -37,7 +37,7 @@ class AppWindowTracePlotMixin:
|
||||
|
||||
def _on_trace_visibility_changed(self, *_args) -> None:
|
||||
"""Redraw pass-through traces when magnitude/phase toggles changed."""
|
||||
if self._processing_mode.currentText() in {"bscan", "gpr"}:
|
||||
if self._processing_mode.currentText() in {"bscan", "gpr", "legacy_gpr"}:
|
||||
return
|
||||
if self._result_history:
|
||||
self._draw_results(self._result_history[-1])
|
||||
|
||||
Reference in New Issue
Block a user