fix graph and white background added

This commit is contained in:
Ayzen
2026-10-15 14:46:06 +03:00
parent 5102ed751c
commit 9a9b8ce5c7
35 changed files with 730 additions and 463 deletions
@@ -160,6 +160,36 @@ class CaptureWindowTest(unittest.TestCase):
np.testing.assert_array_equal(trace.s21, np.full(5, 0.5))
class CycleClosureTest(unittest.TestCase):
def test_next_sweep_without_its_point_zero_still_closes_the_cycle(self) -> None:
# A point of this sweep and point 0 of the next are lost: the next sweep's point 1
# must close the cycle instead of overwriting this sweep's point 1.
points = 40
configuration = SweepConfiguration(1_000_000, 2_000_000, points, 1000, -10.0)
frames = [*((point, 1 + 0j) for point in range(points) if point != 3),
*((point, 7 + 0j) for point in range(1, points))]
def connection(serial: str) -> Mock:
sequence = iter(frames)
def receive(*, timeout_seconds):
point, measured = next(sequence)
values = [(0x13, 2 + 0j), (0x01, measured), (0x02, measured),
(0x33, 2 + 0j), (0x21, measured), (0x22, measured)]
return 27, _datapoint_frame(1_000_000 + point * 25_000, point, values)[4:-4]
return Mock(serial_number=serial, receive_packet=receive)
result = collect_complete_running_sweep_cycle(
master_device_connection=connection("M"), slave_device_connections=[connection("A"), connection("B")],
active_sweep_configuration=configuration, master_stimulus_ports=(1, 2),
)
expected = np.full(points, .5)
expected[3] = 0 # the lost point is zero-filled
for trace in result.s_parameters.values():
np.testing.assert_array_equal(trace, expected)
class CrossDeviceCycleSynchronizerTest(unittest.TestCase):
"""N1: cycle-0 anchors are accepted only when all devices saw the same wrap."""