将场加权标定模型接入回放分析
回放按声明的 30 帧加权空载窗口取基线并逐帧保存外推质量,field 模型单独进缓存键,实时入口拒绝。 新增测试覆盖窗口、质量与拒绝路径。全量门禁的 scene3d 两项失败与 studio 访问冲突为既有问题, 已归因并另立 studio-gate-hang。
This commit is contained in:
@@ -182,3 +182,39 @@ def test_video_unloaded_reference_is_explicit_and_requires_the_whole_interval(mo
|
||||
assert len(list(processor._pass_frames(state))) == frame_count
|
||||
assert applied == [{"fn": 100.}]
|
||||
assert state.provenance.counts["unloaded_reference_frames"] == 30
|
||||
|
||||
|
||||
def test_a_field_model_reading_keeps_raw_and_reports_weighted_quality(tmp_path):
|
||||
"""The field model is a different zeroing protocol, not a different validity rule.
|
||||
|
||||
Its reading carries the SDK's weighted diagnostics; the app must keep the raw
|
||||
counts while the baseline is pending and report the extrapolated fraction as
|
||||
quality (0.0 is a real value, "no diagnostics" is unknown).
|
||||
"""
|
||||
from orisys_app_shared.acquisition.sdk_worker import read_forces_from_sensor
|
||||
from orisys_app_shared.analysis.model import ForceSample
|
||||
|
||||
from _field_fakes import FakeFieldSensor # tests' own SDK double
|
||||
|
||||
sensor = FakeFieldSensor()
|
||||
sensor.declare_unloaded_reference(reference_id="unloaded-1")
|
||||
sensor.step()
|
||||
reading = read_forces_from_sensor(sensor)
|
||||
assert reading["calibration_status"] == {"fn": "zero_unavailable"}
|
||||
assert reading["calibration_diagnostics"]["pending_reference_frames"] == 1
|
||||
sample = ForceSample.from_reading(reading)
|
||||
assert sample.valid and sample.normal_raw == pytest.approx(100.0)
|
||||
assert math.isnan(sample.normal)
|
||||
# Quality is a statement about the frame's support, available while the baseline
|
||||
# is still pending; only absent diagnostics mean "unknown".
|
||||
assert sample.field_quality() == pytest.approx((0.4, 0.9))
|
||||
reading.pop("calibration_diagnostics")
|
||||
assert ForceSample.from_reading(reading).field_quality() is None
|
||||
|
||||
for _ in range(30):
|
||||
sensor.step()
|
||||
ready = read_forces_from_sensor(sensor)
|
||||
assert ready["calibration_status"] == {"fn": "ok"}
|
||||
ready_sample = ForceSample.from_reading(ready)
|
||||
assert ready_sample.normal == pytest.approx(1.5)
|
||||
assert ready_sample.field_quality() == pytest.approx((0.2, 0.97))
|
||||
|
||||
Reference in New Issue
Block a user