Mercurial > ~darius > hgwebdir.cgi > pyinst
diff agilent_r5071.py @ 45:6bd941d96c03
Commit final version that went to Norway
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Thu, 20 Dec 2012 10:59:18 +1030 |
parents | 9ce709b7da4b |
children |
line wrap: on
line diff
--- a/agilent_r5071.py Wed Sep 28 17:15:23 2011 +0930 +++ b/agilent_r5071.py Thu Dec 20 10:59:18 2012 +1030 @@ -1,8 +1,11 @@ # Docs are at http://ena.tm.agilent.com/e5071c/manuals/webhelp/eng/ +import numpy import scpi import pylab +fname = 'data' + # Connect inst = scpi.instURL('vxi://203.31.81.47') @@ -28,12 +31,22 @@ # We only want the real part (no imag for this measurement) dat = dat[::2] +# Plot +pylab.plot(freqs, dat) +pylab.show() + # Save for later -numpy.savez('GS_preamp_20110929', freqs, dat) +numpy.savez('data.npz', freqs, dat) # Load.. -f = numpy.load('GS_preamp_20110929.npz') +f = numpy.load(fname + '.npz') freqs = f['arr_0'] dat = f['arr_1'] -pylab.plot(freqs.dat) +f = file(fname + '.csv', 'wb') +f.write("Frequencies\n") +numpy.savetxt(f, [freqs], delimiter = ',') +f.write("Gain\n") +numpy.savetxt(f, [dat], delimiter = ',') +del f +