added tmp reference capture
This commit is contained in:
@@ -14,9 +14,13 @@ from python_app.workflows.multi_radar_capture_workflow import (
|
||||
MultiRadarSequentialCaptureSession,
|
||||
)
|
||||
from python_app.workflows.radar_config_variants import scan_radar_config_variants
|
||||
from python_app.workflows.reference_workflow import capture_reference_set
|
||||
from python_app.workflows.sequential_capture_workflow import SequentialCaptureSession
|
||||
|
||||
|
||||
TMP_REFERENCE_SET_NAME = "tmp_reference"
|
||||
|
||||
|
||||
class AppWindowPreprocessMixin:
|
||||
"""Handles preprocess set management and sequential capture workflows."""
|
||||
|
||||
@@ -103,6 +107,63 @@ class AppWindowPreprocessMixin:
|
||||
dialog.raise_()
|
||||
dialog.activateWindow()
|
||||
|
||||
def _capture_tmp_reference(self) -> None:
|
||||
"""Capture, save, and select a temporary S21 reference with current sweep settings."""
|
||||
if self._capture_session is not None:
|
||||
self._show_error(
|
||||
"Cannot capture tmp reference during active capture sequence",
|
||||
details=self._capture_state_details(),
|
||||
)
|
||||
return
|
||||
|
||||
pipeline_was_running = self._supervisor.is_running()
|
||||
pipeline_was_paused = False
|
||||
|
||||
try:
|
||||
if pipeline_was_running:
|
||||
self._log("Pipeline paused for tmp reference capture")
|
||||
self._stop_run()
|
||||
pipeline_was_paused = True
|
||||
|
||||
config = self._build_config()
|
||||
radar_key = self._radar_key(config)
|
||||
self._log(
|
||||
"Tmp S21 Reference capture started: "
|
||||
f"set={TMP_REFERENCE_SET_NAME}, radar_key={radar_key}"
|
||||
)
|
||||
|
||||
radar_key, collection = capture_reference_set(config, TMP_REFERENCE_SET_NAME, self._store)
|
||||
self._selected_preprocess_sets["s21_reference"] = TMP_REFERENCE_SET_NAME
|
||||
self._selected_preprocess_radar_key = radar_key
|
||||
self._processor_run_signature = None
|
||||
self._history_run_signature = None
|
||||
if self._supervisor.is_processor_running():
|
||||
self._stop_all_processes()
|
||||
self._reset_runtime_history()
|
||||
self._refresh_preprocess_summary_labels()
|
||||
if collection.traces:
|
||||
self._draw_single_trace(
|
||||
collection.traces[-1],
|
||||
title="Tmp S21 Reference last trace",
|
||||
channel="s21",
|
||||
)
|
||||
if self._preprocess_dialog is not None:
|
||||
self._refresh_sets()
|
||||
self._preprocess_dialog.set_status(
|
||||
f"S21 Reference set saved: {TMP_REFERENCE_SET_NAME} ({len(collection.traces)} traces)"
|
||||
)
|
||||
|
||||
self._log(
|
||||
"Tmp S21 Reference captured and selected: "
|
||||
f"set={TMP_REFERENCE_SET_NAME}, key={radar_key}, traces={len(collection.traces)}; "
|
||||
"runtime history reset"
|
||||
)
|
||||
except Exception as exc: # noqa: BLE001
|
||||
self._show_exception("Failed to capture tmp reference", exc)
|
||||
finally:
|
||||
if pipeline_was_paused:
|
||||
self._start_run()
|
||||
|
||||
def _ensure_preprocess_dialog(self) -> PreprocessDialog:
|
||||
"""Create preprocessing dialog lazily and wire its signals once."""
|
||||
if self._preprocess_dialog is not None:
|
||||
|
||||
Reference in New Issue
Block a user