From ef57651bb8b4696910e1c787385ded0bc19c218b Mon Sep 17 00:00:00 2001 From: Dan White Date: Fri, 15 Jun 2012 17:17:34 -0500 Subject: [PATCH] cleanup --- python-lib/mpsse-test.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/python-lib/mpsse-test.py b/python-lib/mpsse-test.py index c66acdc..7f0b21f 100755 --- a/python-lib/mpsse-test.py +++ b/python-lib/mpsse-test.py @@ -16,7 +16,7 @@ do_shell = True -def bytes2str(self, c): +def bytes2str(c): r = c if not isinstance(c, str): if isinstance(c, (tuple, list)): @@ -25,9 +25,11 @@ def bytes2str(self, c): raise TypeError, 'Cannot convert type %s to raw string.' % type(c) return r + def mkcfg(n): return ''.join(map(chr, np.random.randint(0, 256, n))) + def str2hex(x): return ''.join(map(lambda h: '%02x' % ord(h), x)) @@ -330,6 +332,23 @@ if 0: print str2hex(code[-4:]), str2hex(c2[-4:]) +if 0: + raw_input() + cm = 0.9 + vos = 0.2 + dac.vcmi(cm) + while True: + for i in range(1000): + a = 0.2*sin(2*pi*i/1000.0) + a = 0.2 * (i - 500.0)/1000.0 + va = cm + a + vos + vb = cm - a + vos + print '%3i %6.3f %6.3f %6.3f' % (i, a, va, vb) + dac.vina(va) + dac.vinb(vb) + sleep(0.01) + + ############################################################################## # drop into an IPython shell # @@ -337,3 +356,4 @@ if do_shell: IPython.embed() + -- 2.25.1