add harmonic vs phase correlations
authorDan White <dan@whiteaudio.com>
Sun, 9 Feb 2014 21:50:53 +0000 (15:50 -0600)
committerDan White <dan@whiteaudio.com>
Sun, 9 Feb 2014 21:50:53 +0000 (15:50 -0600)
.gitignore
python-lib/test-data/chip14/arb0/harmonic-sin-phase/harmonic-phase.pdf [new file with mode: 0644]
python-lib/test-data/chip14/arb0/harmonic-sin-phase/harmonic-phase.py [new file with mode: 0644]
python-lib/test-data/chip14/arb0/harmonic-sin-phase/matplotlibrc [new symlink]

index 0d4a274e6527fa2beea250a58720b0f4d385e0c6..c44be79805ddfb7028a9467255760324a6a60a97 100644 (file)
@@ -7,5 +7,6 @@ x.asm
 .*.swp
 \#*
 
+.ropeproject/
 #subdir of libraries
 ftdi/
diff --git a/python-lib/test-data/chip14/arb0/harmonic-sin-phase/harmonic-phase.pdf b/python-lib/test-data/chip14/arb0/harmonic-sin-phase/harmonic-phase.pdf
new file mode 100644 (file)
index 0000000..ade28e3
Binary files /dev/null and b/python-lib/test-data/chip14/arb0/harmonic-sin-phase/harmonic-phase.pdf differ
diff --git a/python-lib/test-data/chip14/arb0/harmonic-sin-phase/harmonic-phase.py b/python-lib/test-data/chip14/arb0/harmonic-sin-phase/harmonic-phase.py
new file mode 100644 (file)
index 0000000..124f324
--- /dev/null
@@ -0,0 +1,86 @@
+#!/usr/bin/env python
+
+from pylab import *
+
+
+from glob import glob
+
+
+
+close('all')
+fig = figure(figsize=(6.5, 4.0))
+subplots_adjust(top=0.97, bottom=0.15, left=0.15, right=0.98)
+
+for name in glob('arb0-*5.0-*.npz'):
+    # ['f0', 'fs', 'vout', 'phase', 'Nperiods', 'fh', 'fsin', 'duration']
+    data = np.load(name)
+
+    # arb0-2013-04-08_130324_5.0-005-005.npz
+    s = name.split('_')[-1].rstrip('.npz')
+    s = s.split('-')
+    fh = int(s[1][1:])
+    fsin = int(s[2][1:])
+
+    wphase = 180/pi * (data['phase'] % (2*pi))
+    vout = data['vout']
+
+
+
+    col = (fh / 5) - 1
+    row = (fsin / 5) - 1
+    #idx = 2*row + col + 1
+    idx = 7*col + row + 1
+    print col, row, idx
+
+
+    ax = subplot(2, 7, idx)
+
+    if (1.0*fsin/fh % 2) == 1:
+        style = '.b'
+        text(180, 0.2,
+             'h=%i'%(fsin/fh),
+             horizontalalignment='center')
+    else:
+        style = '+g'
+
+    plot(wphase, vout, style)
+
+    ylim([-0.8, 0.8])
+    xlim([0, 360])
+
+    ax = plt.gca()
+    xticks = range(0, 361, 45)
+    ax.set_xticks(xticks)
+    ax.set_xticklabels([''] * len(xticks))
+
+    yticks = linspace(-0.8, 0.8, 5)
+    ax.set_yticks(yticks)
+    if (idx % 7) == 1:
+        ylabel('$%i$' % fsin)
+    else:
+        ax.set_yticklabels([''] * len(yticks))
+
+    if idx in (1, 8):
+        ylabel('%i Hz' % fh)
+
+    if idx in range(8, 15):
+        xlabel('%i Hz' % fsin)
+
+text(0.01, 0.55,
+     'Harmonic correlator frequency',
+     size='large',
+     transform=fig.transFigure,
+     verticalalignment='center',
+     rotation='vertical')
+
+text(0.55, 0.01,
+     'Input frequency',
+     size='large',
+     transform=fig.transFigure,
+     horizontalalignment='center',
+     rotation='horizontal')
+
+savefig('harmonic-phase.pdf')
+
+
+
diff --git a/python-lib/test-data/chip14/arb0/harmonic-sin-phase/matplotlibrc b/python-lib/test-data/chip14/arb0/harmonic-sin-phase/matplotlibrc
new file mode 120000 (symlink)
index 0000000..9b93625
--- /dev/null
@@ -0,0 +1 @@
+../vios-offset-gm/matplotlibrc
\ No newline at end of file