individual fh-fsin figures
authorDan White <dan@whiteaudio.com>
Sun, 3 Aug 2014 23:34:03 +0000 (18:34 -0500)
committerDan White <dan@whiteaudio.com>
Sun, 3 Aug 2014 23:34:03 +0000 (18:34 -0500)
python-lib/test-data/chip14/arb0/harmonic-sin-phase/aht-05-05.pdf [new file with mode: 0644]
python-lib/test-data/chip14/arb0/harmonic-sin-phase/aht-05-15.pdf [new file with mode: 0644]
python-lib/test-data/chip14/arb0/harmonic-sin-phase/aht-10-10.pdf [new file with mode: 0644]
python-lib/test-data/chip14/arb0/harmonic-sin-phase/aht-10-30.pdf [new file with mode: 0644]
python-lib/test-data/chip14/arb0/harmonic-sin-phase/harmonic-phase.py

diff --git a/python-lib/test-data/chip14/arb0/harmonic-sin-phase/aht-05-05.pdf b/python-lib/test-data/chip14/arb0/harmonic-sin-phase/aht-05-05.pdf
new file mode 100644 (file)
index 0000000..33f3e34
Binary files /dev/null and b/python-lib/test-data/chip14/arb0/harmonic-sin-phase/aht-05-05.pdf differ
diff --git a/python-lib/test-data/chip14/arb0/harmonic-sin-phase/aht-05-15.pdf b/python-lib/test-data/chip14/arb0/harmonic-sin-phase/aht-05-15.pdf
new file mode 100644 (file)
index 0000000..50b13c8
Binary files /dev/null and b/python-lib/test-data/chip14/arb0/harmonic-sin-phase/aht-05-15.pdf differ
diff --git a/python-lib/test-data/chip14/arb0/harmonic-sin-phase/aht-10-10.pdf b/python-lib/test-data/chip14/arb0/harmonic-sin-phase/aht-10-10.pdf
new file mode 100644 (file)
index 0000000..4450838
Binary files /dev/null and b/python-lib/test-data/chip14/arb0/harmonic-sin-phase/aht-10-10.pdf differ
diff --git a/python-lib/test-data/chip14/arb0/harmonic-sin-phase/aht-10-30.pdf b/python-lib/test-data/chip14/arb0/harmonic-sin-phase/aht-10-30.pdf
new file mode 100644 (file)
index 0000000..b2c26fa
Binary files /dev/null and b/python-lib/test-data/chip14/arb0/harmonic-sin-phase/aht-10-30.pdf differ
index 3f7f5c9543ce13ece1cdb1d711cf31c364548b7e..228f08e5b14825bd448f11d0a2699b2ff8f3090c 100644 (file)
@@ -12,6 +12,8 @@ fig = figure(figsize=(6.0, 3.5))
 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'):
@@ -27,13 +29,15 @@ 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)
@@ -111,3 +115,96 @@ xlim((4, 31))
 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))
+