comparison 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
comparison
equal deleted inserted replaced
44:c93d6d4cb04b 45:6bd941d96c03
1 # Docs are at http://ena.tm.agilent.com/e5071c/manuals/webhelp/eng/ 1 # Docs are at http://ena.tm.agilent.com/e5071c/manuals/webhelp/eng/
2 2
3 import numpy
3 import scpi 4 import scpi
4 import pylab 5 import pylab
6
7 fname = 'data'
5 8
6 # Connect 9 # Connect
7 inst = scpi.instURL('vxi://203.31.81.47') 10 inst = scpi.instURL('vxi://203.31.81.47')
8 11
9 # Read ID 12 # Read ID
26 dat = scpi.bindecode(inst.read(), dtype = numpy.float64) 29 dat = scpi.bindecode(inst.read(), dtype = numpy.float64)
27 30
28 # We only want the real part (no imag for this measurement) 31 # We only want the real part (no imag for this measurement)
29 dat = dat[::2] 32 dat = dat[::2]
30 33
34 # Plot
35 pylab.plot(freqs, dat)
36 pylab.show()
37
31 # Save for later 38 # Save for later
32 numpy.savez('GS_preamp_20110929', freqs, dat) 39 numpy.savez('data.npz', freqs, dat)
33 40
34 # Load.. 41 # Load..
35 f = numpy.load('GS_preamp_20110929.npz') 42 f = numpy.load(fname + '.npz')
36 freqs = f['arr_0'] 43 freqs = f['arr_0']
37 dat = f['arr_1'] 44 dat = f['arr_1']
38 45
39 pylab.plot(freqs.dat) 46 f = file(fname + '.csv', 'wb')
47 f.write("Frequencies\n")
48 numpy.savetxt(f, [freqs], delimiter = ',')
49 f.write("Gain\n")
50 numpy.savetxt(f, [dat], delimiter = ',')
51 del f
52