From: Dan White Date: Thu, 13 Feb 2014 10:24:24 +0000 (-0600) Subject: add 3-panel plot of iout-gm-gm X-Git-Tag: cheetah~30 X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=dc36b6360063aeb8976294a1a9f8a0723fd2ac9a;p=430.git add 3-panel plot of iout-gm-gm --- diff --git a/python-lib/test-data/chip14/arb0/vios-offset-gm/arb0-chip14-iout-gm-2.pdf b/python-lib/test-data/chip14/arb0/vios-offset-gm/arb0-chip14-iout-gm-2.pdf new file mode 100644 index 0000000..5d0397d Binary files /dev/null and b/python-lib/test-data/chip14/arb0/vios-offset-gm/arb0-chip14-iout-gm-2.pdf differ diff --git a/python-lib/test-data/chip14/arb0/vios-offset-gm/arb0-chip14-iout-gm-2.py b/python-lib/test-data/chip14/arb0/vios-offset-gm/arb0-chip14-iout-gm-2.py new file mode 100644 index 0000000..682a8cb --- /dev/null +++ b/python-lib/test-data/chip14/arb0/vios-offset-gm/arb0-chip14-iout-gm-2.py @@ -0,0 +1,214 @@ +#!/usr/bin/env python + +from pylab import * + +from glob import glob +import yaml +import scipy.signal as sig + + + + + +close('all') + + +def circular_cycle(a, b): + from itertools import cycle + + a_cycler = cycle(a) + b_cycler = cycle(b) + + while True: + yield a_cycler.next() + b_cycler.next() + +def style_cycle(): + lines = ('-', '--', '-.', ':') + colors = ('b', 'g', 'r', 'k', 'm', 'c') + return circular_cycle(lines, colors) + + +def mkgm(vd, vout, tint, Cint=50e-12): + dvout = diff(vout / tint) + dvd = diff(vd) + gm = Cint * dvout / dvd + return (vd[:-1], gm) + + +def smooth(x, npoints=21.0): + return sig.filtfilt(ones(npoints)/npoints, [1], x) + + +# collect data to plot sorted by offset value +d = {} +for npz in glob('arb0-2013*.npz'): + data = np.load(npz) + cfg = yaml.load(open(npz.replace('.npz', '.yaml'), 'rb')) + ios = cfg['arb']['harmonics'][0]['otaA']['offset'] + + d[ios] = {'data':data, 'fname':npz} + + +if 0: + figure(figsize=(5.0, 3.5)) + subplots_adjust(top=0.98, bottom=0.12, left=0.15, right=0.95) + + for ios in sorted(d.keys()): + if ios == 100: + continue + + data = d[ios]['data'] + tint = data['tint'] + vd = data['vd'] + vout = data['vout'] + + vdgm, dgm = mkgm(vd, vout, tint) + + #plot(vdgm, dgm, 'b.', label='raw') + plot(vdgm, 1e12*smooth(dgm, 15.0), + linewidth=2.0, + label=ios) + + + legend(loc='best', ncol=2) + + #xlim((-2.0, 2.0)) + xlabel('$V_d$ (V)') + ylim((0, 100)) + ylabel('$g_m$ (pA/V)') + + savefig('arb0-chip14-gm.pdf') + + + + + +if 1: + figure(figsize=(5.0, 6.0)) + subplots_adjust(top=0.98, bottom=0.08, left=0.14, right=0.98) + + + subplot(311) + styler = style_cycle() + for ios in sorted(d.keys()): + #if ios == 100: + #continue + + data = d[ios]['data'] + tint = data['tint'] + vd = data['vd'] + vout = data['vout'] + + iout = 50e-12 * vout / tint + plot(vd, 1e12*iout, + styler.next(), + label='%i'%ios) + + + hlines(0, -10, 10, linewidth=0.5, color='0.40') + vlines(0, -1000, 1000, linewidth=0.5, color='0.40') + + xlim((-2.5, 2.5)) + ylim((-180, 180)) + ylabel('$I_{out}$ (pA)') + + legend(title='offset code', + loc='lower right', + ncol=3, + fontsize='small', + handletextpad=0.2, + labelspacing=0.2, + columnspacing=1.0) + + subplot(312) + styler = style_cycle() #reset iterator + for ios in sorted(d.keys()): + #if ios == 100: + #continue + + data = d[ios]['data'] + tint = data['tint'] + vd = data['vd'] + vout = data['vout'] + + vdgm, dgm = mkgm(vd, vout, tint) + + #plot(vdgm, dgm, 'b.', label='raw') + #plot(vd, 1e12*smooth(50e-12*vout/tint, 15.0)/vd, + plot(vdgm, 1e12*smooth(dgm, 15.0), + styler.next(), + label=ios) + + xlim((-2.5, 2.5)) + hlines(0, -10, 10, linewidth=0.5, color='0.40') + vlines(0, -1000, 1000, linewidth=0.5, color='0.40') + ylim((-5, 100)) + #ylabel(r'$g_m = dI_{out}/dV_d$ (pA/V)') + ylabel(r'$\partial G_m / \partial V_{id}$ (pA/V)') + #xlabel('$V_d$ (V)') + + + subplot(313) + styler = style_cycle() + for ios in sorted(d.keys()): + #if ios == 100: + #continue + + data = d[ios]['data'] + tint = data['tint'] + vd = data['vd'] + vout = data['vout'] + + iout = 50e-12 * vout / tint + idx = find(vd == abs(vd).min()) + iout = iout - iout[idx] + + gm = 1e12 * iout / vd + gm = [gm[i] for i in range(len(gm)) + if i not in (idx-1, idx, idx+1)] + vd = [vd[i] for i in range(len(vd)) + if i not in (idx-1, idx, idx+1)] + plot(vd, gm, + styler.next(), + label='%i'%ios) + + + hlines(0, -10, 10, linewidth=0.5, color='0.40') + vlines(0, -1000, 1000, linewidth=0.5, color='0.40') + + xlim((-2.5, 2.5)) + ylim((-5, 100)) + ylabel('$G_m$ (pA/V)') + xlabel('$V_{id}$ (V)') + + + #subplot(313) + #styler = style_cycle() #reset iterator + #for ios in sorted(d.keys()): + ##if ios == 100: + ##continue + + #data = d[ios]['data'] + #tint = data['tint'] + #vd = data['vd'] + #vout = data['vout'] + + #vdgm, dgm = mkgm(vd, vout, tint) + + ##plot(vdgm, dgm, 'b.', label='raw') + ##plot(vd, 1e12*smooth(50e-12*vout/tint, 15.0)/vd, + #plot(vdgm, 1e12*smooth(dgm, 15.0), + #styler.next(), + #label=ios) + + #xlim((-2.5, 2.5)) + #hlines(0, -10, 10, linewidth=0.5, color='0.40') + #vlines(0, -1000, 1000, linewidth=0.5, color='0.40') + #ylim((-5, 100)) + ##ylabel(r'$g_m = dI_{out}/dV_d$ (pA/V)') + #ylabel(r'$G_m$ (pA/V)') + #xlabel('$V_d$ (V)') + + + savefig('arb0-chip14-iout-gm-2.pdf') +