Mercurial > ~darius > hgwebdir.cgi > pyinst
comparison rs_fsp7_example.py @ 56:91b476ebc0f2
Run through 2to3
author | Daniel O'Connor <doconnor@gsoft.com.au> |
---|---|
date | Tue, 08 Dec 2020 14:00:45 +1030 |
parents | 438a5f1ddcd7 |
children | 00800345fbae |
comparison
equal
deleted
inserted
replaced
55:ad5942d22f78 | 56:91b476ebc0f2 |
---|---|
31 import scpi | 31 import scpi |
32 | 32 |
33 def test(r): | 33 def test(r): |
34 # ID instrument | 34 # ID instrument |
35 r.write('*IDN?') | 35 r.write('*IDN?') |
36 print "ID is " + r.read(5) | 36 print("ID is " + r.read(5)) |
37 | 37 |
38 # Reset to defaults | 38 # Reset to defaults |
39 r.write("*RST") | 39 r.write("*RST") |
40 | 40 |
41 # Set to single sweep mode | 41 # Set to single sweep mode |
54 r.write("INIT;*WAI") | 54 r.write("INIT;*WAI") |
55 | 55 |
56 # Wait up to 10 seconds for it to be done | 56 # Wait up to 10 seconds for it to be done |
57 r.write("*OPC?") | 57 r.write("*OPC?") |
58 opc = scpi.getdata(r.read(10), int) | 58 opc = scpi.getdata(r.read(10), int) |
59 print "OPC - %d" % (opc) | 59 print("OPC - %d" % (opc)) |
60 | 60 |
61 # Set peak excursion | 61 # Set peak excursion |
62 r.write("CALC:MARK:PEXC 6DB") | 62 r.write("CALC:MARK:PEXC 6DB") |
63 # Find 3rd order intercept & get result | 63 # Find 3rd order intercept & get result |
64 r.write("CALC:MARK:FUNC:TOI ON") | 64 r.write("CALC:MARK:FUNC:TOI ON") |
65 r.write("CALC:MARK:FUNC:TOI:RES?") | 65 r.write("CALC:MARK:FUNC:TOI:RES?") |
66 toi = scpi.getdata(r.read(1)) | 66 toi = scpi.getdata(r.read(1)) |
67 print "Result = %.2f" % (toi) | 67 print("Result = %.2f" % (toi)) |
68 | 68 |
69 # Set data format | 69 # Set data format |
70 r.write("FORM REAL,32") | 70 r.write("FORM REAL,32") |
71 #r.write("FORM:DATA ASC") | 71 #r.write("FORM:DATA ASC") |
72 | 72 |