tweak calibration stats script
authorDan White <dan@whiteaudio.com>
Tue, 4 Sep 2012 01:03:08 +0000 (20:03 -0500)
committerDan White <dan@whiteaudio.com>
Tue, 4 Sep 2012 01:03:08 +0000 (20:03 -0500)
python-lib/test-data/chip01/chip01-cal-plots.pdf [new file with mode: 0644]
python-lib/test-data/chip02/chip02-cal-plots.pdf
python-lib/test-data/chip02/stats.py

diff --git a/python-lib/test-data/chip01/chip01-cal-plots.pdf b/python-lib/test-data/chip01/chip01-cal-plots.pdf
new file mode 100644 (file)
index 0000000..462d388
Binary files /dev/null and b/python-lib/test-data/chip01/chip01-cal-plots.pdf differ
index dc1c0328265775cf6099133dcfc3d6e2adb07f13..e41584113c8c85357a026c525cb27f459a0fbddd 100644 (file)
Binary files a/python-lib/test-data/chip02/chip02-cal-plots.pdf and b/python-lib/test-data/chip02/chip02-cal-plots.pdf differ
index 3c8fd9d7b4ce16cae512deae683bb8d14524c3d6..4e95ac27905cdb90a1810ae9e06440e476f6bcc8 100644 (file)
@@ -2,7 +2,9 @@
 
 from pylab import *
 
+import os
 from glob import glob
+from random import sample as rand_sample
 
 
 cal_values = []
@@ -10,9 +12,10 @@ cal_outs = []
 
 infiles = sorted(glob('*.npz'))
 N_RUNS = min(len(infiles), 8)
-sample_runs = randint(len(infiles), size=(N_RUNS,))
+sample_runs = sorted(rand_sample(range(len(infiles)), N_RUNS))
 N_PLOTS = 4
-sample_channels = sorted(randint(48, size=(N_PLOTS,)))
+#sample_channels = sorted(rand_sample(range(48), N_PLOTS))
+sample_channels = range(N_PLOTS)
 N_COLS = 4
 nrun = 0
 for infile in infiles:
@@ -41,18 +44,6 @@ for infile in infiles:
             subplot(N_PLOTS, N_COLS, N_COLS*i+2)
             plot(r[:nevals[0,k]+1], '-')
 
-        subplot(N_PLOTS, N_COLS, 1)
-        title('calibration value')
-
-        subplot(N_PLOTS, N_COLS, 2)
-        title('Vout (mV)')
-
-        subplot(N_PLOTS, N_COLS, 3)
-        title('Cal histogram')
-
-        subplot(N_PLOTS, N_COLS, 4)
-        title('Vout (mV) histogram')
-
     cal_values.append(guesses[-1, :, :])
     cal_outs.append(results[-1, :, :])
     nrun += 1
@@ -60,20 +51,45 @@ for infile in infiles:
 cv = array(cal_values)
 co = array(cal_outs)
 
-for i in range(N_PLOTS):
+for i,k in enumerate(sample_channels):
     subplot(N_PLOTS, N_COLS, N_COLS*i+3)
-    data = cv[:, 0, i]
+    data = cv[:, 0, k]
     hist(data, bins=range(128), align='left')
     xlim((data.min()-1, data.max()+1))
     xlim((0, 127))
 
     subplot(N_PLOTS, N_COLS, N_COLS*i+4)
-    data = 1e3*(2.5/2/2**13)*co[:, 0, i]
+    data = 1e3*(2.5/2/2**13)*co[:, 0, k]
     dm = max((abs(data.min()), abs(data.max())))
     print dm
     dm = 200
     hist(data, bins=100, range=(-dm, dm), align='left')
     xlim((-dm, dm))
 
+subplot(N_PLOTS, N_COLS, 1)
+title('calibration value')
+subplot(N_PLOTS, N_COLS, (N_PLOTS-1)*N_COLS+1)
+xlabel('Iteration step')
+
+subplot(N_PLOTS, N_COLS, 2)
+title('Vout (mV)')
+subplot(N_PLOTS, N_COLS, (N_PLOTS-1)*N_COLS+2)
+xlabel('Iteration step')
+
+subplot(N_PLOTS, N_COLS, 3)
+title('Cal histogram')
+subplot(N_PLOTS, N_COLS, (N_PLOTS-1)*N_COLS+3)
+xlabel('OTA tuning DAC')
+
+subplot(N_PLOTS, N_COLS, 4)
+title('Vout (mV) histogram')
+subplot(N_PLOTS, N_COLS, (N_PLOTS-1)*N_COLS+4)
+xlabel('Residual Voos (mV)')
+
+suptitle('Calibration data from %s\nNruns = %i' %
+        (os.path.basename(os.getcwd()),
+            len(infiles)))
 
 print sample_runs
+print [infiles[s] for s in sample_runs]
+