diff rs_fsp7_noisetest.py @ 56:91b476ebc0f2

Run through 2to3
author Daniel O'Connor <doconnor@gsoft.com.au>
date Tue, 08 Dec 2020 14:00:45 +1030
parents 42621291eb9b
children 23c96322cfb6
line wrap: on
line diff
--- a/rs_fsp7_noisetest.py	Tue Dec 08 13:59:05 2020 +1030
+++ b/rs_fsp7_noisetest.py	Tue Dec 08 14:00:45 2020 +1030
@@ -119,10 +119,10 @@
     return nf
     
 def donoisetest(r, enr):
-    print "Acquiring with noise off.."
+    print("Acquiring with noise off..")
     setnoise(r, False)
     off = getnoise(r)
-    print "Acquiring with noise on.."
+    print("Acquiring with noise on..")
     setnoise(r, True)
     on = getnoise(r)
     return off, on, calcnf(enr, off, on)
@@ -159,7 +159,7 @@
 
     # ID instrument
     r.write('*IDN?')
-    print "ID is " + r.read(5)
+    print("ID is " + r.read(5))
 
     # Setup parameters
     setup(r, freq, options.span, options.sweeps, options.bw)
@@ -167,18 +167,18 @@
     r.write("INIT:CONT OFF")
 
     nfs = []
-    print "Centre: %.1f Mhz, Span %.1f Mhz, Input %.1f MHz, BW %.1f kHz, %d sweeps, ENR %.2f dB" % (freq / 1e6, options.span / 1e6, options.input / 1e6, options.bw / 1e3, options.sweeps, enr)
+    print("Centre: %.1f Mhz, Span %.1f Mhz, Input %.1f MHz, BW %.1f kHz, %d sweeps, ENR %.2f dB" % (freq / 1e6, options.span / 1e6, options.input / 1e6, options.bw / 1e3, options.sweeps, enr))
     while options.repeat == None or options.repeat > 0:
         off, on, nf = donoisetest(r, enr)
-        print "Off %.3f dBm/Hz, on %.3f dBm/Hz, NF %.2f dB" % (off, on, nf)
+        print("Off %.3f dBm/Hz, on %.3f dBm/Hz, NF %.2f dB" % (off, on, nf))
         nfs.append(nf)
         if options.repeat == None:
-            print "Press enter to perform a new measurement"
+            print("Press enter to perform a new measurement")
             sys.stdin.readline()
         else:
             options.repeat -= 1
 
     if len(nfs) > 1:
         nfs = numpy.array(nfs)
-        print "NF min: %.1f dBm/Hz, max: %.1f dBm/Hz, avg: %.1f dBm/hz, stddev: %.1f" % (
-            nfs.min(), nfs.max(), nfs.sum() / len(nfs), numpy.std(nfs))
+        print("NF min: %.1f dBm/Hz, max: %.1f dBm/Hz, avg: %.1f dBm/hz, stddev: %.1f" % (
+            nfs.min(), nfs.max(), nfs.sum() / len(nfs), numpy.std(nfs)))