コード例 #1
0
 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))
コード例 #2
0
 def findDevices(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):
             devName = 'ATS%d::%d' %(systemNum, boardNum)
             handle = ats.Board(systemId=systemNum, boardId=boardNum)
             self.boardHandles[devName] = handle
             devType = ats.boardNames[handle.type]
             self.devTypes[devName] = devType
             self.devNames += [devName]
             print('Found %s Waveform Digitizer at %s'
                     %(devType, devName))
コード例 #3
0
    buffersPerSec = 0
    bytesPerSec = 0
    recordsPerSec = 0
    if transferTime_sec > 0:
        buffersPerSec = buffersCompletedAllBoards / transferTime_sec
        bytesPerSec = bytesTransferredAllBoards / transferTime_sec
        recordsPerSec = recordsPerBuffer * buffersCompletedAllBoards / transferTime_sec
    print(("Captured %d buffers (%f buffers per sec)" % (buffersCompletedAllBoards, buffersPerSec)))
    print(("Captured %d records (%f records per sec)" % (recordsPerBuffer * buffersCompletedAllBoards, recordsPerSec)))
    print(("Transferred %d bytes (%f bytes per sec)" % (bytesTransferredAllBoards, bytesPerSec)))

    # Abort transfer.
    board.abortAsyncRead()

# Handler for the SIGINT signal. This gets called when the user
# presses Ctrl+C.
def sigint_handler(signal, frame):
    print("Acquisition aborting. Please wait.")
    abortAcquisition = True
# Register SIGINT handler
signal.signal(signal.SIGINT, sigint_handler)

if __name__ == "__main__":
    boards = []
    systemId = 1
    for i in range(ats.boardsInSystemBySystemID(systemId)):
        boards.append(ats.Board(systemId, i + 1))
    waitBar = ats.WaitBar()
    for board in boards:
        ConfigureBoard(board)
    AcquireData(boards, waitBar)
コード例 #4
0
                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)