Files
2026-10-06 12:32:26 +03:00

41 lines
1.2 KiB
Python

"""One-shot workflow for capturing a full reference set."""
from __future__ import annotations
import logging
from python_app.models.dataset_model import SweepCollection
from python_app.models.run_config_schema import RunConfigModel
from python_app.storage.npz.store import NpzStore
from python_app.workflows.sequential_capture_workflow import (
DEFAULT_CALIBRATION_MEDIAN_SWEEP_COUNT,
SequentialCaptureSession,
)
logger = logging.getLogger(__name__)
def capture_reference_set(
config: RunConfigModel,
set_name: str,
store: NpzStore,
*,
median_sweep_count: int = DEFAULT_CALIBRATION_MEDIAN_SWEEP_COUNT,
) -> tuple[str, SweepCollection]:
"""Capture all switch combinations and persist them as reference set."""
logger.info("Starting one-shot reference capture: set=%s", set_name)
session = SequentialCaptureSession(
config=config,
kind="s21_reference",
set_name=set_name,
median_sweep_count=median_sweep_count,
)
try:
session.open()
while not session.is_complete():
session.capture_current_combo()
saved = session.finalize(store)[0]
return saved.radar_key, saved.collection
finally:
session.close()