awg_h = awg.open(AWG_SLOT, AWG_CHANNEL) awg.configure("repeatedMain") dig = digitizer.Digitizer(DIGITIZER_SLOT, DIGITIZER_CHANNELS, CAPTURE_WIDTH) # awg.loadWaveform(waves[0], AWG_DELAYS[0]) awg.loadWaveforms(waves, AWG_DELAYS) dig.digitize(DIGITIZER_DELAY, NUMBER_OF_PULSES) hvi_path = os.getcwd() + '\\SyncStartRepeated_A1_D1.hvi' hvi_mapping = {'AWG0': awg_h, 'DIG0': dig.handle} hvi.init(hvi_path, hvi_mapping) hvi.setupConstants(NUMBER_OF_PULSES, PRI) hvi.start() # Allow the memory to partially fill. time.sleep(PRI * NUMBER_OF_PULSES / 100) log.info("Reading Waveforms....") plt.xlabel("us") start_time = time.time() for ii in range(NUMBER_OF_PULSES): samples = dig.get_data() if len(samples[0]) == 0: log.error( "Reading appears to have timed out after {} pulses".format(ii)) break if ii < PULSES_TO_PLOT: # do not plot too many waves plt.plot(dig.timeStamps / 1e-06, samples[0])
digitizer.Digitizer(DIGITIZER_SLOTS[dig], DIGITIZER_CHANNELS, CAPTURE_WIDTH)) for dig in digitizers: dig.digitize(DIGITIZER_DELAY, NUMBER_OF_PULSES) # awg.loadWaveform(waves[0], AWG_DELAYS[0]) awg.loadWaveforms(waves, AWG_DELAYS) hvi_mapping = {'AWG0': awg_h} for ii in range(len(digitizers)): hvi_mapping['DIG{}'.format(ii)] = digitizers[ii].handle hvi_file = '\\SyncStartRepeated_A1_D{}.hvi'.format(len(digitizers)) hvi_path = os.getcwd() + hvi_file hvi.init(hvi_path, hvi_mapping) hvi.start(NUMBER_OF_PULSES, PRI) # Allow the memory to partially fill. time.sleep(PRI * NUMBER_OF_PULSES / 100) log.info("Reading Waveforms....") pipeline = queue.Queue(maxsize=0) event = threading.Event() with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor: for dig in digitizers: executor.submit(getData, dig, pipeline, event, NUMBER_OF_PULSES) executor.submit(processData, pipeline, event, NUMBER_OF_PULSES) logging.info("AWG0 loop counter: {}".format(awg.readRegister(15))) logging.info("DIG0 loop counter: {}".format( digitizers[ii].readRegister(15)))