Пример #1
0
Файл: UL.py Проект: ptweir/wjul
def cbAInScan(board, LowChan, HighChan, Count, Rate, Gain, ADData, Options):
    """Scan range of A/D channels and store samples in an array

    Inputs
    ------

    BoardNum
    LowChan
    HighChan
    Count
    Rate
    Gain
    ADData -- modified to contain the sampled data
    Options

    Outputs
    -------
    Count
    Rate

    """
    global _usbhandler
    device = _get_device(board)

    if not Options == CONVERTDATA:
        raise NotImplementedError(
            "The only option I currently understand is CONVERTDATA")

    ADData = numpy.asarray(ADData)
    if ADData.dtype != numpy.int16:
        raise TypeError(
            "argument ADData must be (convertable to) a numpy int16 array")

    # in the test-usb1208FS.c example program, the single grab is done before calling scan
    svalue = PMD.usbAIn_USB1208FS(device, 0, gain_str2pmd[Gain])
    # START CHANGED BY PETER
    #options = PMD.AIN_EXECUTION
    options = 0
    # END CHANGED BY PETER
    count, rate = PMD.usbAInScan_USB1208FS(device, LowChan, HighChan, Count,
                                           Rate, options, ADData)
    return count, rate
Пример #2
0
Файл: UL.py Проект: ptweir/wjul
def cbAInScan(board, LowChan, HighChan, Count, Rate, Gain, ADData, Options):
    """Scan range of A/D channels and store samples in an array

    Inputs
    ------

    BoardNum
    LowChan
    HighChan
    Count
    Rate
    Gain
    ADData -- modified to contain the sampled data
    Options

    Outputs
    -------
    Count
    Rate

    """
    global _usbhandler
    device = _get_device(board)

    if not Options == CONVERTDATA:
        raise NotImplementedError("The only option I currently understand is CONVERTDATA")

    ADData = numpy.asarray(ADData)
    if ADData.dtype != numpy.int16:
        raise TypeError("argument ADData must be (convertable to) a numpy int16 array")

    # in the test-usb1208FS.c example program, the single grab is done before calling scan
    svalue = PMD.usbAIn_USB1208FS(device, 0, gain_str2pmd[Gain])
    # START CHANGED BY PETER
    # options = PMD.AIN_EXECUTION
    options = 0
    # END CHANGED BY PETER
    count, rate = PMD.usbAInScan_USB1208FS(device, LowChan, HighChan, Count, Rate, options, ADData)
    return count, rate