2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 03:08:27 +08:00

wavesynth: move test code to unittests, fix mutability style

This commit is contained in:
Robert Jördens 2015-04-05 04:24:44 -06:00
parent 3257275782
commit 75dfa95b4d
2 changed files with 10 additions and 17 deletions

View File

@ -116,3 +116,9 @@ class TestSynthesizer(unittest.TestCase):
def test_run(self):
x, y = self.drive()
@unittest.skip("manual/visual test")
def test_plot(self):
import cairoplot
x, y = self.drive()
cairoplot.scatter_plot("plot.png", [x, y])

View File

@ -8,7 +8,6 @@ def discrete_compensate(c):
if len(c) > 3:
c[1] += c[3]/6
c[2] += c[3]
return c
class Spline:
@ -16,7 +15,8 @@ class Spline:
self.c = [0.0]
def set_coefficients(self, c):
self.c = discrete_compensate(copy(c))
self.c = copy(c)
discrete_compensate(self.c)
def next(self):
r = self.c[0]
@ -32,7 +32,8 @@ class SplinePhase:
def set_coefficients(self, c):
self.c0 = c[0]
self.c[1:] = discrete_compensate(c[1:])
self.c[1:] = c[1:]
discrete_compensate(self.c[1:])
def clear(self):
self.c[0] = 0.0
@ -128,17 +129,3 @@ class Synthesizer:
except StopIteration:
self.line_iter = None
return r
def main():
from artiq.test.wavesynth import TestSynthesizer
import cairoplot
t = TestSynthesizer()
t.setUp()
x, y = t.drive()
cairoplot.scatter_plot("plot.png", [x, y])
if __name__ == "__main__":
main()