Уточнить обработку плотных трендов и восстановление сигналов

This commit is contained in:
2026-10-12 00:48:15 +03:00
parent 20454ff7fa
commit bbb4bc2b9d
14 changed files with 91 additions and 14 deletions

View File

@@ -21,6 +21,20 @@ from set_devices.signal_reconstruction import METHODS
class PlotProcessingTests(unittest.TestCase):
def test_million_output_points_for_all_methods(self):
snapshot = Snapshot([Series("a", "A", [(0, 1), (1, 3), (2, 5)])])
for method in METHODS:
with self.subTest(method=method):
curve = process(prepare(snapshot, "a", method, 1_000_000, 1))
self.assertEqual(1_000_000, len(curve.points))
self.assertEqual((0., 2.), (curve.points[0][0], curve.points[-1][0]))
for x, y in curve.points[::10000]:
self.assertAlmostEqual(1 + 2 * x, y)
self.assertAlmostEqual(5., curve.points[-1][1])
self.assertTrue(curve.pieces)
with self.assertRaises(ValueError):
process(prepare(snapshot, "a", "linear", 1_000_001))
def test_snapshot_copies_mutable_samples_and_excludes_hidden_and_digital(self):
points = [[0, 0], [1, 1]]
channel = Series("a", "Analog", points)