p.set_usage('feng_plot_quant.py [options] CONFIG_FILE') p.set_description(__doc__) p.add_option('-s', '--spectra', dest='snap_id', default=0, help='Select which Quantize Snap Block, default=0') opts, args = p.parse_args(sys.argv[1:]) if args==[]: print 'Please specify a configuration file! \nExiting.' exit() lh=log_handlers.DebugLogHandler() try: print 'Connecting...', inst=medInstrument.fEngine(args[0],lh) print 'done' start_t = time.time() for fn,fpga in enumerate(inst.ffpgas): inst.write_int('quant_snap_snap_sel_reg',int(opts.snap_id),fpga) spectra=inst.snap(fpga,'quant_snap_snap',8192) pwr_spec0 = [] pwr_spec1 = [] pwr_spec2 = [] pwr_spec3 = [] for c,channel in enumerate(spectra): s0 = channel&(2**8-1) s1 = (channel>>8)&(2**8-1)
p.add_option('-v', '--verbose', dest='verbose',action='store_true', default=False, help='Be verbose about errors.') opts, args = p.parse_args(sys.argv[1:]) if args==[]: print 'Please specify a configuration file! \nExiting.' exit() verbose=opts.verbose lh=log_handlers.DebugLogHandler() try: print 'Loading configuration file and connecting...', xeng=medInstrument.xEngine(args[0],lh,program=False) feng=medInstrument.fEngine(args[0],lh,program=False) print 'done' print('\nResetting vector accumulators...'), sys.stdout.flush() xeng.get_ctrl_sw(ctrl='ctrl') """print xeng.ctrl_sw xeng.change_ctrl_sw_bits(0, 0, 1, ctrl='ctrl') print xeng.ctrl_sw xeng.change_ctrl_sw_bits(0, 0, 0, ctrl='ctrl') print xeng.ctrl_sw""" xeng.rst_vacc() xeng.get_ctrl_sw(ctrl='ctrl') # Sync and Arm Vector Accumulators xeng.xeng_vacc_sync(feng)