EWU research slide generation
authorDan White <dan@whiteaudio.com>
Fri, 1 Mar 2013 16:11:06 +0000 (10:11 -0600)
committerDan White <dan@whiteaudio.com>
Fri, 1 Mar 2013 16:11:06 +0000 (10:11 -0600)
python-lib/test-data/chip01/chip01-cal-plots2.pdf [new file with mode: 0644]
python-lib/test-data/chip01/foo.py

diff --git a/python-lib/test-data/chip01/chip01-cal-plots2.pdf b/python-lib/test-data/chip01/chip01-cal-plots2.pdf
new file mode 100644 (file)
index 0000000..4429e6e
Binary files /dev/null and b/python-lib/test-data/chip01/chip01-cal-plots2.pdf differ
index 7e52b4e229748843954ebaa01d252cc35d086ffc..52ce94578289d7cb844d7f2605215bec8653284d 100644 (file)
@@ -10,17 +10,19 @@ from random import sample as rand_sample
 cal_values = []
 cal_outs = []
 cal_nevals = []
+cal_means = []
+cal_stds = []
 
 infiles = sorted(glob('*.npz'))
 #N_RUNS = min(len(infiles), 8)
 N_RUNS = 0
 sample_runs = sorted(rand_sample(range(len(infiles)), N_RUNS))
-#N_PLOTS = 4
-N_PLOTS = 0
+N_PLOTS = 4
+#N_PLOTS = 0
 #sample_channels = sorted(rand_sample(range(48), N_PLOTS))
 sample_channels = range(N_PLOTS)
-#N_COLS = 4
-N_COLS = 0
+N_COLS = 4
+#N_COLS = 0
 nrun = 0
 for infile in infiles:
 #for infile in sorted(glob('*.npz')):
@@ -48,6 +50,22 @@ for infile in infiles:
             subplot(N_PLOTS, N_COLS, N_COLS*i+2)
             plot(r[:nevals[0,k]+1], '-')
 
+            subplot(N_PLOTS, N_COLS, N_COLS*i+3)
+            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, k]
+            dm = max((abs(data.min()), abs(data.max())))
+            print dm
+            dm = max(dm, 50)
+            hist(data, bins=100, range=(-dm, dm), align='left')
+            xlim((-dm, dm))
+            #ylim((0, 50))
+
+
     cal_values.append(guesses[-1, :, :])
 
     # results are zeros after [nevals:]
@@ -69,16 +87,27 @@ co = array(cal_outs)
 
 
 
-if 0:
-    figure()
+if 1:
+    figure(figsize=(14.0, 8.5))
     for i,k in enumerate(sample_channels):
+        g = guesses[:, 0, k]
+        r = 1e3*(2.5/2/2**13)*results[:, 0, k]
+
+        subplot(N_PLOTS, N_COLS, N_COLS*i+1)
+        plot(g[:nevals[0,k]+1], '-')
+        ylim((0, 127))
+        #ylabel('Channel %02i-A' % k)
+
+        subplot(N_PLOTS, N_COLS, N_COLS*i+2)
+        plot(r[:nevals[0,k]+1], '-')
+
         subplot(N_PLOTS, N_COLS, N_COLS*i+3)
         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)
+        ax = subplot(N_PLOTS, N_COLS, N_COLS*i+4)
         data = 1e3*(2.5/2/2**13)*co[:, 0, k]
         dm = max((abs(data.min()), abs(data.max())))
         print dm
@@ -86,6 +115,16 @@ if 0:
         hist(data, bins=100, range=(-dm, dm), align='left')
         xlim((-dm, dm))
         #ylim((0, 50))
+        dmean = data.mean()
+        dstd = data.std()
+        print nrun, dmean, dstd
+
+        text(0.03, 0.95, r'$\sigma=%4.1f$' % dstd,
+                horizontalalignment='left',
+                verticalalignment='top',
+                fontsize=18,
+                bbox=dict(facecolor='r', alpha=0.5, boxstyle="round"),
+                transform = ax.transAxes)
 
     subplot(N_PLOTS, N_COLS, 1)
     title('Offset DAC value')
@@ -111,9 +150,12 @@ if 0:
             (os.path.basename(os.getcwd()),
                 len(infiles)))
 
-interactive(False)
+    savefig('chip01-cal-plots2.pdf')
 
-if 1:
+#interactive(False)
+interactive(True)
+
+if 0:
     figure()
     data = cv.flatten()
     hist(data, bins=range(128), align='left')