From: Dan White Date: Tue, 4 Sep 2012 01:03:08 +0000 (-0500) Subject: tweak calibration stats script X-Git-Tag: calibrations~7 X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=69168e617d10f9ae86e4bf6a77715d428a3e733c;p=430.git tweak calibration stats script --- 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 index 0000000..462d388 Binary files /dev/null and b/python-lib/test-data/chip01/chip01-cal-plots.pdf differ diff --git a/python-lib/test-data/chip02/chip02-cal-plots.pdf b/python-lib/test-data/chip02/chip02-cal-plots.pdf index dc1c032..e415841 100644 Binary files a/python-lib/test-data/chip02/chip02-cal-plots.pdf and b/python-lib/test-data/chip02/chip02-cal-plots.pdf differ diff --git a/python-lib/test-data/chip02/stats.py b/python-lib/test-data/chip02/stats.py index 3c8fd9d..4e95ac2 100644 --- a/python-lib/test-data/chip02/stats.py +++ b/python-lib/test-data/chip02/stats.py @@ -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] +