testing arb0 channel DC integration
authorDan White <dan@whiteaudio.com>
Thu, 28 Mar 2013 19:39:26 +0000 (14:39 -0500)
committerDan White <dan@whiteaudio.com>
Thu, 28 Mar 2013 19:39:26 +0000 (14:39 -0500)
python-lib/arb.py [new file with mode: 0644]
python-lib/arb0-test.pdf [new file with mode: 0644]
python-lib/slope-arb.py [new file with mode: 0644]

diff --git a/python-lib/arb.py b/python-lib/arb.py
new file mode 100644 (file)
index 0000000..d895b28
--- /dev/null
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+import IPython
+from time import sleep
+
+import devboard as dev
+dev.init_devboard(1)
+
+# requires devboard be already initialized
+from calibrate import calibrate as cal
+
+
+#do_shell = True
+do_shell = False
+
+
+
+chain = dev.chain
+mux = dev.mux
+
+arb = dev.arb
+amux = dev.amux
+
+a = arb.h[0]
+m = amux.otaB
+
+
+
+
+
+
+##############################################################################
+# drop into an IPython shell
+#
+if do_shell:
+    IPython.embed()
+
diff --git a/python-lib/arb0-test.pdf b/python-lib/arb0-test.pdf
new file mode 100644 (file)
index 0000000..c19aebe
Binary files /dev/null and b/python-lib/arb0-test.pdf differ
diff --git a/python-lib/slope-arb.py b/python-lib/slope-arb.py
new file mode 100644 (file)
index 0000000..75d4448
--- /dev/null
@@ -0,0 +1,71 @@
+while True:
+    vcm = 1.25
+
+    dev.adc.triggerMode(dev.adc.MODE_IDLE)
+    dev.adc.channelMode(6, dev.adc.SE) #even channel only
+    dev.adc.channelGain(6, 1)
+    dev.adc.channelGain(7, 1)
+    dev.adc.mux(6)
+    dev.adc.triggerMode(dev.adc.MODE_MANUAL_MANUAL)
+    dev.adc.read()
+
+    vout = []
+    vd = []
+    tint = []
+
+    for d in arange(-800e-3, 800e-3+1e-3, 10e-3):
+        print d*1e3
+        vd.append(d)
+
+        ti = 0.5
+        #for ti in (0.4, 0.2, 0.1, 0.05, 0.025):
+        while True:
+            a0.otaA.zero=1; arb.write(); a0.otaA.zero=0; arb.write()
+            dev.adc.read()
+            v0 = dev.adc.read() * (2.5 / 2**16)
+
+            vina(vcm + d)
+            vinb(vcm - d)
+            sleep(ti)
+            vina(vcm)
+            vinb(vcm)
+
+            dev.adc.read()
+            v1 = dev.adc.read() * (2.5 / 2**16)
+
+
+            vo = v1 - v0
+
+            print ti, vo
+            if abs(vo) < 1.1:
+                break
+
+            ti *= 0.5
+
+        tint.append(ti)
+        vout.append(vo)
+        
+        #sleep(0.1)
+
+    break
+    
+out0 = array(out0)
+out1 = array(out1)
+vd = array(vd)
+tint = array(tint)
+
+
+figure()
+subplot(221)
+plot(vd, vout, 'o')
+
+subplot(223)
+plot(vd, tint, 'o')
+ylim([0, 0.6])
+
+subplot(222)
+plot(vd, vout/tint, 'o')
+
+
+
+