subplots_adjust(top=0.97, bottom=0.15, left=0.15, right=0.98)
zphase_outs = zeros((2, 7))
+angles = {}
+vouts = {}
for name in glob('arb0-*5.0-*.npz'):
wphase = 180/pi * (data['phase'] % (2*pi))
vout = data['vout']
-
+ #save for later
+ angles[fh, fsin] = wphase
+ vouts[fh, fsin] = vout
col = (fh / 5) - 1
row = (fsin / 5) - 1
#idx = 2*row + col + 1
idx = 7*col + row + 1
- print col, row, idx
+ #print col, row, idx
ax = subplot(2, 7, idx)
savefig('tmp.pdf')
+
+
+#
+# Specific correlations
+#
+for fh, fsin in ((5, 5),
+ (5, 15),
+ (10, 10),
+ (10, 30)):
+ fig = figure(figsize=(5.0, 3.0))
+ subplots_adjust(top=0.92, bottom=0.14, left=0.12, right=0.96)
+
+ angle = angles[fh, fsin]
+ vout = vouts[fh, fsin]
+
+ a = zeros((16,))
+ vo = zeros((16,))
+
+ for i, ang in enumerate(arange(0, 360, 360/16.)):
+ a[i] = ang
+ vo[i] = mean(vout[range(i, len(angle), 16)])
+ idx = find(angle == ang)
+
+ vo = vo - vo.mean()
+ plot(a, vo, 'o', label='data')
+ hlines(0, 0, 360, linewidth=0.5, color='0.40')
+
+ x = linspace(0, 360)
+ plot(x, vo[0]*cos(pi*x/180), '-g', label='$\cos()$')
+
+ #scale = vouts[fh, fh][0] - vouts[fh, fh].mean()
+ #plot(x, 1.0*fh/fsin*scale*cos(pi*x/180), '-r', label='$\cos()$')
+
+ ax = fig.gca()
+ xlim((0, 360))
+ ax.set_xticks(range(0, 360+1, 45))
+ xlabel('Relative phase, deg')
+
+ ylim((-0.8, 0.8))
+ ylabel('$y_{I,%i}$ (V)' % (fsin/fh))
+
+ legend(loc='lower right')
+
+ title(r'FF = $%i\,\mathrm{Hz}$, Input = $%i\,\mathrm{Hz}$'
+ % (fh, fsin))
+
+ savefig('aht-%02i-%02i.pdf' % (fh, fsin))
+
+
+#
+# 1-1 correlation
+#
+for i, fh in enumerate((5, 10)):
+ break
+ print i, fh
+ fig = figure(figsize=(6.0, 4.0))
+ subplots_adjust(top=0.92, bottom=0.14, left=0.12, right=0.96)
+
+ for fsin in (fh, 3*fh):
+ subplot(2, 1, i+1)
+ angle = angles[fh, fsin]
+ vout = vouts[fh, fsin]
+
+ a = zeros((16,))
+ vo = zeros((16,))
+
+ for i, ang in enumerate(arange(0, 360, 360/16.)):
+ a[i] = ang
+ vo[i] = mean(vout[range(i, len(angle), 16)])
+ idx = find(angle == ang)
+
+ vo = vo - vo.mean()
+ plot(a, vo, 'o', label='data')
+ hlines(0, 0, 360, linewidth=0.5, color='0.40')
+
+ x = linspace(0, 360)
+ plot(x, vo[0]*cos(pi*x/180), '-g', label='$\cos()$')
+
+ ax = fig.gca()
+ xlim((0, 360))
+ ax.set_xticks(range(0, 360+1, 45))
+ xlabel('Relative phase, deg')
+
+ ylim((-0.8, 0.8))
+ ylabel('$V_{out} = y_{I,%i}$ (V)' % (fsin/fh))
+
+ legend(loc='lower right')
+
+ title(r'Input = $%i\,\mathrm{Hz}$, Harmonic = $%i\,\mathrm{Hz}$'
+ % (fh, fsin))
+
+ savefig('aht-%02i-%02i.pdf' % (fh, fsin))
+