added capture time for every sweep
This commit is contained in:
@@ -140,6 +140,36 @@ class SwitchedMatrixComboAcquisitionTest(unittest.TestCase):
|
||||
expected_combos,
|
||||
)
|
||||
|
||||
def test_each_switch_step_stamps_its_traces_with_its_own_capture_window(self) -> None:
|
||||
# The whole point of per-trace timing: three switch steps are measured one
|
||||
# after another, so their traces must NOT all share the collection window.
|
||||
service, _inner, _input_switch = _switched_service(input_steps=3)
|
||||
|
||||
collection = service.acquire_collection(collection_id=7)
|
||||
|
||||
windows_by_step: dict[int, set[tuple[int, int]]] = {}
|
||||
for trace in collection.traces:
|
||||
step = int(trace.combo.input) // _INNER_INPUTS
|
||||
windows_by_step.setdefault(step, set()).add(
|
||||
(int(trace.capture_start_ns), int(trace.capture_end_ns))
|
||||
)
|
||||
|
||||
self.assertEqual(sorted(windows_by_step), [0, 1, 2])
|
||||
for step, windows in windows_by_step.items():
|
||||
self.assertEqual(len(windows), 1, f"step {step} traces disagree on their window")
|
||||
start_ns, end_ns = next(iter(windows))
|
||||
self.assertGreater(start_ns, 0)
|
||||
self.assertGreaterEqual(end_ns, start_ns)
|
||||
# Each step's window sits inside the collection's.
|
||||
self.assertGreaterEqual(start_ns, collection.capture_start_ns)
|
||||
self.assertLessEqual(end_ns, collection.capture_end_ns)
|
||||
|
||||
# Steps are strictly ordered in time — the whole reason the collection-level
|
||||
# window cannot stand in for a per-combo timestamp.
|
||||
step_starts = [next(iter(windows_by_step[step]))[0] for step in sorted(windows_by_step)]
|
||||
self.assertEqual(step_starts, sorted(step_starts))
|
||||
self.assertGreater(len(set(step_starts)), 1)
|
||||
|
||||
|
||||
class ManualComboCaptureUsesTargetedAcquisitionTest(unittest.TestCase):
|
||||
"""The per-combo capture session must not sweep the full widened matrix."""
|
||||
|
||||
Reference in New Issue
Block a user