diff rs_fsp7_noisetest.py @ 52:c1891d9074c1

Add option to run for N iterations and exit.
author Daniel O'Connor <doconnor@gsoft.com.au>
date Thu, 21 Mar 2013 11:48:42 +1030
parents 03b06d71f0fd
children d90acb55ce31
line wrap: on
line diff
--- a/rs_fsp7_noisetest.py	Thu Mar 21 11:11:10 2013 +1030
+++ b/rs_fsp7_noisetest.py	Thu Mar 21 11:48:42 2013 +1030
@@ -133,6 +133,7 @@
     parser.add_option('-i', '--input', dest = 'input', default = None, help = 'Input frequency (Hz) for down converters', type = float)
     parser.add_option('-w', '--sweeps', dest = 'sweeps', default = 20, help = 'Number of sweeps', type = int)
     parser.add_option('-b', '--bw', dest = 'bw', default = 1000, help = 'Bandwidth (Hz)', type = float)
+    parser.add_option('-r', '--repeat', dest = 'repeat', help = 'Repetitions (otherwise do one and ask to continue)', type = int)
 
     (options, args) = parser.parse_args()
 
@@ -164,9 +165,11 @@
     r.write("INIT:CONT OFF")
 
     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 True:
+    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 "Press enter to perform a new measurement"
-        sys.stdin.readline()
-    
+        if options.repeat == None:
+            print "Press enter to perform a new measurement"
+            sys.stdin.readline()
+        else:
+            options.repeat -= 1