--- /dev/null
+#!/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()
+
--- /dev/null
+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')
+
+
+
+