comparison rs_fsp7_noisetest.py @ 85:60ad91b4c67c default tip

Add 'quick' option to use a faster sweep time with no averaging. Useful for testing the hardware is setup correctly without having to wait 3 minutes.
author Daniel O'Connor <doconnor@gsoft.com.au>
date Mon, 21 Oct 2024 14:12:50 +1030
parents 4b4ae555067b
children
comparison
equal deleted inserted replaced
84:4b4ae555067b 85:60ad91b4c67c
154 help = 'Wait between measurements (when not doing N repeats, default: %(default)s)') 154 help = 'Wait between measurements (when not doing N repeats, default: %(default)s)')
155 parser.add_argument('-r', '--repeat', help = 'Number of repetitions, if not specified do one and ask to continue', type = int) 155 parser.add_argument('-r', '--repeat', help = 'Number of repetitions, if not specified do one and ask to continue', type = int)
156 parser.add_argument('-s', '--span', default = 1e6, help = 'Span frequency in Hz (default: %(default).0f Hz)', type = float) 156 parser.add_argument('-s', '--span', default = 1e6, help = 'Span frequency in Hz (default: %(default).0f Hz)', type = float)
157 parser.add_argument('-t', '--time', default = 30, help = 'Sweep time (default: %(default)f sec)', type = float) 157 parser.add_argument('-t', '--time', default = 30, help = 'Sweep time (default: %(default)f sec)', type = float)
158 parser.add_argument('-w', '--sweeps', default = 3, help = 'Number of sweeps to average (default: %(default)d)', type = int) 158 parser.add_argument('-w', '--sweeps', default = 3, help = 'Number of sweeps to average (default: %(default)d)', type = int)
159 parser.add_argument('-q', '--quick', action = 'store_true', help = 'Use presets for a quick test to check hardware is setup correctly')
159 parser.add_argument('address', help = 'Spectrum analyser address', type = str) 160 parser.add_argument('address', help = 'Spectrum analyser address', type = str)
160 parser.add_argument('centre', help = 'Centre frequency (Hz)', type = float) 161 parser.add_argument('centre', help = 'Centre frequency (Hz)', type = float)
161 162
162 args = parser.parse_args() 163 args = parser.parse_args()
163 164
164 if args.input == None: 165 if args.input == None:
165 args.input = args.centre 166 args.input = args.centre
166 167
167 if args.time is not None and args.time <= 0: 168 if args.time is not None and args.time <= 0:
168 parser.error('Sweep time must be >0') 169 parser.error('Sweep time must be >0')
170
171 if args.quick:
172 args.time = 5
173 args.sweeps = 1
169 174
170 # Compute ENR at frequency of interest 175 # Compute ENR at frequency of interest
171 enr = findenr(args.input) 176 enr = findenr(args.input)
172 177
173 # Connect to the analyser 178 # Connect to the analyser