32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
"""One-shot workflow for capturing a full calibration set."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from python_app.models.dataset_model import SweepCollection
|
|
from python_app.models.run_config_model import RunConfigModel
|
|
from python_app.storage.npz_store import NpzStore
|
|
from python_app.workflows.sequential_capture_workflow import SequentialCaptureSession
|
|
|
|
|
|
def capture_calibration_set(
|
|
config: RunConfigModel,
|
|
set_name: str,
|
|
store: NpzStore,
|
|
) -> tuple[str, SweepCollection]:
|
|
"""Capture all switch combinations and persist them as calibration set."""
|
|
if config.is_multi_device:
|
|
raise RuntimeError(
|
|
"LibreVNA multi-device S21 through calibration is not supported by this one-shot full-set helper. "
|
|
"Use the sequential preprocess capture flow so each virtual combo can be connected through "
|
|
"and captured explicitly."
|
|
)
|
|
|
|
session = SequentialCaptureSession(config=config, kind="s21_calibration", set_name=set_name)
|
|
try:
|
|
session.open()
|
|
while not session.is_complete():
|
|
session.capture_current_combo()
|
|
return session.finalize(store)
|
|
finally:
|
|
session.close()
|