调整 Autocal 标定记录格式与目录命名
将人工参考载荷按档位区间保存,重排帧字段并明确界面操作。已通过相关测试、代码和文档检查。
This commit is contained in:
@@ -10,7 +10,13 @@ from types import SimpleNamespace
|
||||
import numpy as np
|
||||
import pytest
|
||||
from orisys_app_shared.acquisition.models import SdkPacket
|
||||
from orisys_autocal.trial import ManualTrial, load_path, site_at, uv_origin
|
||||
from orisys_autocal.trial import (
|
||||
REFERENCE_HEADER,
|
||||
ManualTrial,
|
||||
load_path,
|
||||
site_at,
|
||||
uv_origin,
|
||||
)
|
||||
|
||||
|
||||
class Worker:
|
||||
@@ -95,6 +101,7 @@ def test_manual_trial_records_video_stamps_and_load_unload_events(tmp_dir):
|
||||
site=site,
|
||||
levels=[5, 10],
|
||||
hold_s=20,
|
||||
sensor_model="Finger D40",
|
||||
sensor_sn="F-001",
|
||||
bundle_path=str(bundle),
|
||||
source={"kind": "camera", "value": 0},
|
||||
@@ -108,6 +115,7 @@ def test_manual_trial_records_video_stamps_and_load_unload_events(tmp_dir):
|
||||
report = trial.recorder.stop(wait=True)
|
||||
assert report.ok
|
||||
assert trial.poll() == "complete"
|
||||
assert "Finger-D40_F-001" in directory.name
|
||||
assert len(list(directory.glob("raw_*.mp4"))) == 1
|
||||
with (directory / "frames.csv").open(encoding="utf-8", newline="") as handle:
|
||||
row = next(csv.DictReader(handle))
|
||||
@@ -115,6 +123,30 @@ def test_manual_trial_records_video_stamps_and_load_unload_events(tmp_dir):
|
||||
assert row["source_frame_id"] == "7"
|
||||
assert row["time_basis"] == "host_camera"
|
||||
assert row["capture_dropped"] == "0"
|
||||
with (directory / "reference.csv").open(encoding="utf-8", newline="") as handle:
|
||||
reader = csv.DictReader(handle)
|
||||
assert tuple(reader.fieldnames) == REFERENCE_HEADER
|
||||
references = list(reader)
|
||||
assert [row["branch"] for row in references] == ["load", "load", "unload", "unload"]
|
||||
assert [row["F_ref_normal_N"] for row in references] == [
|
||||
"5.0",
|
||||
"10.0",
|
||||
"5.0",
|
||||
"0.0",
|
||||
]
|
||||
assert all(
|
||||
row["F_ref_x_N"] == row["F_ref_y_N"] == row["F_ref_z_N"] == ""
|
||||
for row in references
|
||||
)
|
||||
assert all(row["stability_verified"] == "0" for row in references)
|
||||
assert all(
|
||||
int(row["t_start_host_mono_ns"]) < int(row["t_end_host_mono_ns"])
|
||||
for row in references
|
||||
)
|
||||
assert all(
|
||||
previous["t_end_host_mono_ns"] == following["t_start_host_mono_ns"]
|
||||
for previous, following in zip(references, references[1:])
|
||||
)
|
||||
with (directory / "events.csv").open(encoding="utf-8", newline="") as handle:
|
||||
events = list(csv.DictReader(handle))
|
||||
reached = [event for event in events if event["kind"] == "step_reached"]
|
||||
@@ -128,12 +160,15 @@ def test_manual_trial_records_video_stamps_and_load_unload_events(tmp_dir):
|
||||
with (directory / "session.json").open(encoding="utf-8") as handle:
|
||||
session = json.load(handle)
|
||||
assert session["site"]["uv_xy_px"] == [0, 1]
|
||||
assert session["sensor_model"] == "Finger D40"
|
||||
assert session["reference_file"] == "reference.csv"
|
||||
assert session["site"]["mesh_sha256"]
|
||||
|
||||
|
||||
def test_calibration_page_keeps_precise_uv_site_when_switching_to_live_view(
|
||||
make_window,
|
||||
):
|
||||
from orisys_app_shared.i18n import t
|
||||
from orisys_autocal.sensor.uv_flat import FlatSurface
|
||||
|
||||
window = make_window()
|
||||
@@ -151,6 +186,8 @@ def test_calibration_page_keeps_precise_uv_site_when_switching_to_live_view(
|
||||
uv_max=(1, 1),
|
||||
)
|
||||
panel = window.calibration_panel
|
||||
assert panel.start_button.text() == t("calibration.start")
|
||||
assert panel.target_label.text() == t("calibration.before_start")
|
||||
panel.set_flat(flat, "bundle")
|
||||
panel._picked(2, 1)
|
||||
assert (panel.u_spin.value(), panel.v_spin.value()) == (-1, 2)
|
||||
|
||||
Reference in New Issue
Block a user