Уточнить обработку плотных трендов и восстановление сигналов
This commit is contained in:
@@ -53,6 +53,21 @@ class PlotTests(unittest.TestCase):
|
||||
crossed = markers.move(Marker.A, 1900).move(Marker.B, 1100)
|
||||
self.assertEqual(-800, self.core.delta(crossed.a, crossed.b))
|
||||
|
||||
def test_deep_x_zoom_preserves_anchor_and_allows_pan_and_zoom_out(self):
|
||||
view = Viewport()
|
||||
for _ in range(65):
|
||||
view = view.transform(self.core, zoom_x=1.25, focus_x=.3)
|
||||
self.assertAlmostEqual(.3, view.x + .3 * view.width)
|
||||
self.assertLess(view.width * 5_000_000, 3)
|
||||
moved = view.transform(self.core, pan_x=.2)
|
||||
self.assertLess(moved.x, view.x)
|
||||
self.assertEqual(view.width, moved.width)
|
||||
expanded = moved.transform(self.core, zoom_x=.8)
|
||||
self.assertGreater(expanded.width, moved.width)
|
||||
limited = view.transform(self.core, zoom_x=1e10)
|
||||
self.assertEqual(1e-7, limited.width)
|
||||
self.assertEqual(limited, limited.transform(self.core, zoom_x=2))
|
||||
|
||||
def test_invalid_numeric_inputs_do_not_escape_to_painter(self):
|
||||
for value in (math.nan, math.inf, -math.inf):
|
||||
self.assertEqual(Viewport(), Viewport().transform(self.core, zoom_x=value))
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -56,6 +56,7 @@ class ProcessingQtTests(unittest.TestCase):
|
||||
self.panel.method.setCurrentIndex(self.panel.method.findData(method))
|
||||
self.calculate()
|
||||
self.assertEqual(method, self.panel.curve.request.method)
|
||||
|
||||
self.panel.count.setValue(self.panel.count.value() + 1)
|
||||
self.assertEqual(index + 1, len(self.panel.curves))
|
||||
self.assertTrue(self.panel.export_button.isEnabled())
|
||||
@@ -67,6 +68,12 @@ class ProcessingQtTests(unittest.TestCase):
|
||||
self.assertEqual((), self.panel.curves)
|
||||
self.assertIsNone(self.panel.curve)
|
||||
|
||||
def test_large_output_count_reaches_worker(self):
|
||||
self.assertEqual(10000, self.panel.count.value())
|
||||
self.panel.count.setValue(1_000_000)
|
||||
self.calculate()
|
||||
self.assertEqual(1_000_000, len(self.panel.curve.points))
|
||||
|
||||
def test_repeated_request_does_not_duplicate_curve(self):
|
||||
self.calculate()
|
||||
self.calculate()
|
||||
|
||||
Reference in New Issue
Block a user