def run_iq_vs_patterns(num_patterns=None, num_records_per_pattern=None): # get parameters: number of patterns, etc. daq_params = get_daq_parameters(num_patterns=num_patterns, num_records_per_pattern=num_records_per_pattern) alazar_params = daq_alazar.get_alazar_parameters(daq_params=daq_params) print("\nSetup Alazar configuration") board = ats.Board(systemId = 1, boardId = 1) daq_alazar.configure_board(alazar_params, board) # setup wx to start at first pattern print("Initialize DG535") dg535_control.initialize_dg535() # print("Acquire data\n") (rec_avg_all, rec_readout) = daq_alazar.acquire_data(daq_params, alazar_params, board) # reshape the records rec_readout_vs_pats = daq_processing.record_vs_patterns(daq_params, rec_readout) # make IQ plot for each pattern bins_cntr, counts = daq_processing.make_n_state_iq_plot(rec_readout_vs_pats) # fit_readout_histogram(rec_readout[0], bins_cntr[0], counts[0], num_gaussians=3) # average all repetitions for each pattern #rec_avg_vs_pats_ch_a, rec_avg_vs_pats_ch_b = record_avg_vs_patterns(daq_params, rec_readout_vs_pats) # threshold the readout signal for every record (channel a) n_readout = daq_processing.threshold_record_averages(daq_params, signal_in=rec_readout[0]) n_vs_pats, p_vs_pats = daq_processing.readout_vs_patterns(daq_params, n_readout) daq_processing.make_readout_vs_patterns_plot(p_vs_pats) return daq_params, rec_readout_vs_pats, n_vs_pats, p_vs_pats, bins_cntr, counts
def run_daq2(num_patterns=None, num_records_per_pattern=None, verbose=True): # get parameters: number of patterns, etc. daq_params = get_daq_parameters(num_patterns=num_patterns, num_records_per_pattern=num_records_per_pattern) alazar_params = daq_alazar.get_alazar_parameters(daq_params=daq_params,verbose=False) if verbose: print("\nSetup Alazar configuration") board = ats.Board(systemId = 1, boardId = 1) daq_alazar.configure_board(alazar_params, board) # setup wx to start at first pattern if verbose: print(" DO NOT Initialize DG535") #dg535_control.initialize_dg535() #dg535_control.set_state(0) # if verbose: print("Acquire data\n") #dg535_control.single_pulse(1) ## turn qubit drive on. (rec_avg_all, rec_readout) = daq_alazar.acquire_data(daq_params, alazar_params, board, verbose=False) #dg535_control.single_pulse(0) return rec_avg_all, rec_readout
def get_data(self, queue_data, parameters): """ Method allowing the transfert of data from the board to the computer. The board is instanced following the parameters input and data are transfert to the queue_data memory buffer. Input: - queue_data_cha: FIFO memory buffer instance from the multiprocess library. - queue_data_chb: FIFO memory buffer instance from the multiprocess library. - parameters: Dictionnary with all board parameters instance from multiprocess library """ # We instance a board object # All the parameters of the measurement will be set on this instance board = ats.Board(systemId=1, boardId=1) # We set the clock self.set_clock(board, parameters) # We set the two inputs (chanel A and B) self.set_input_control(board) # We set the trigger self.set_trigger(board, parameters) # We prepare the acquisition buffers = self.prepare_acquisition(board, parameters) # We wait a little to let the time to the board to initialize itself time.sleep(0.5) # We launch the data acquisition parameters['measured_buffers'] = self.data_acquisition( board, queue_data, parameters, buffers) # We stop the transfer. if parameters['mode'] == 'FFT': board.dspAbortCapture() else: board.abortAsyncRead() # We inform the parent process that the board is properly "closed" parameters['safe_acquisition'] = True # Once the board is "close" properly, we close the FIFO memory if parameters['mode'] == 'FFT': queue_data.close() if parameters['mode'] == 'CHANNEL_AB': queue_data[0].close() queue_data[1].close() if parameters['mode'] == 'CHANNEL_A': queue_data.close() if parameters['mode'] == 'CHANNEL_B': queue_data.close()
def findBoards(self): """Find available devices.""" self.numSystems = ats.numOfSystems() for systemNum in range(1, self.numSystems + 1): numBoardsInSystem = ats.boardsInSystemBySystemID(systemNum) for boardNum in range(1, numBoardsInSystem + 1): boardName = 'ATS%d::%d' % (systemNum, boardNum) handle = ats.Board(systemId=systemNum, boardId=boardNum) self.boardHandles[boardName] = handle devType = ats.boardNames[handle.type] self.boardTypes[boardName] = devType self.boardNames += [boardName] print('Found %s Waveform Digitizer at %s' % (devType, boardName))
if dataFile: buffer.buffer.tofile(dataFile) # Add the buffer to the end of the list of available buffers. boards[b].postAsyncBuffer(buffer.addr, buffer.size_bytes) buffersCompletedPerBoard += 1 finally: board.abortAsyncRead() # Compute the total transfer time, and display performance information. transferTime_sec = time.clock() - start print("Capture completed in %f sec" % transferTime_sec) buffersPerSec = 0 bytesPerSec = 0 if transferTime_sec > 0: buffersPerSec = buffersCompletedAllBoards / transferTime_sec bytesPerSec = bytesTransferredAllBoards / transferTime_sec print("Captured %d buffers (%f buffers per sec)" % (buffersCompletedAllBoards, buffersPerSec)) print("Transferred %d bytes (%f bytes per sec)" % (bytesTransferredAllBoards, bytesPerSec)) if __name__ == "__main__": boards = [] systemId = 1 for i in range(ats.boardsInSystemBySystemID(systemId)): boards.append(ats.Board(systemId, i + 1)) for board in boards: ConfigureBoard(board) AcquireData(boards)
# # Sample codes are unsigned by default. As a result: # - 0x0000 represents a negative full scale input signal. # - 0x8000 represents a ~0V signal. # - 0xFFFF represents a positive full scale input signal. # Optionaly save data to file if dataFile: buffer.buffer.tofile(dataFile) # Add the buffer to the end of the list of available buffers. board.postAsyncBuffer(buffer.addr, buffer.size_bytes) finally: board.abortAsyncRead() # Compute the total transfer time, and display performance information. transferTime_sec = time.clock() - start print("Capture completed in %f sec" % transferTime_sec) buffersPerSec = 0 bytesPerSec = 0 if transferTime_sec > 0: buffersPerSec = buffersCompleted / transferTime_sec bytesPerSec = bytesTransferred / transferTime_sec print("Captured %d buffers (%f buffers per sec)" % (buffersCompleted, buffersPerSec)) print("Transferred %d bytes (%f bytes per sec)" % (bytesTransferred, bytesPerSec)) if __name__ == "__main__": board = ats.Board(systemId=1, boardId=1) ConfigureBoard(board) AcquireData(board)
def configure_DAQ_board(self): self.board = ats.Board(systemId = 1, boardId = 1) OCT_tech.ConfigureBoard_OCT(self.board,self.channel,self.samplesPerSec,self.pm_range)