コード例 #1
0
ファイル: ps6000.py プロジェクト: jimisebben/pico-python
 def _lowLevelSetChannel(self, chNum, enabled, coupling, VRange, VOffset,
                         BWLimited):
     m = self.lib.ps6000SetChannel(c_int16(self.handle), c_enum(chNum),
                                   c_int16(enabled), c_enum(coupling),
                                   c_enum(VRange), c_float(VOffset),
                                   c_enum(BWLimited))
     self.checkResult(m)
コード例 #2
0
ファイル: ps3000.py プロジェクト: haymeister/pico-python
 def _lowLevelSetChannel(self, chNum, enabled, coupling, VRange, VOffset,
                         BWLimited):
     m = self.lib.ps3000_set_channel(c_int16(self.handle), c_enum(chNum),
                                     c_int16(enabled), c_enum(coupling),
                                     c_enum(VRange))
     if m == 0:
         raise IOError('Error calling %s: parameter out of range' % (inspect.stack()[1][3]))
コード例 #3
0
ファイル: ps6000.py プロジェクト: jimisebben/pico-python
    def _lowLevelSetAWGSimpleDeltaPhase(self, waveform, deltaPhase,
                                        offsetVoltage, pkToPk, indexMode,
                                        shots, triggerType, triggerSource):
        """ waveform should be an array of shorts. """

        waveformPtr = waveform.ctypes.data_as(POINTER(c_int16))

        m = self.lib.ps6000SetSigGenArbitrary(
            c_int16(self.handle),
            c_uint32(int(offsetVoltage * 1E6)),  # offset voltage in microvolts
            c_uint32(int(pkToPk * 1E6)),         # pkToPk in microvolts
            c_uint32(int(deltaPhase)),           # startDeltaPhase
            c_uint32(int(deltaPhase)),           # stopDeltaPhase
            c_uint32(0),                         # deltaPhaseIncrement
            c_uint32(0),                         # dwellCount
            waveformPtr,                         # arbitraryWaveform
            c_int32(len(waveform)),              # arbitraryWaveformSize
            c_enum(0),                           # sweepType for deltaPhase
            c_enum(0),            # operation (adding random noise and whatnot)
            c_enum(indexMode),                   # single, dual, quad
            c_uint32(shots),
            c_uint32(0),                         # sweeps
            c_uint32(triggerType),
            c_uint32(triggerSource),
            c_int16(0))                          # extInThreshold
        self.checkResult(m)
コード例 #4
0
ファイル: ps4000a.py プロジェクト: colinoflynn/pico-python
 def _lowLevelSetSimpleTrigger(self, enabled, trigsrc, threshold_adc,
                               direction, delay, timeout_ms):
     m = self.lib.ps4000aSetSimpleTrigger(
         c_int16(self.handle), c_int16(enabled),
         c_enum(trigsrc), c_int16(threshold_adc),
         c_enum(direction), c_uint32(delay), c_int16(timeout_ms))
     self.checkResult(m)
コード例 #5
0
ファイル: ps3000a.py プロジェクト: colinoflynn/pico-python
 def _lowLevelClearDataBuffer(self, channel, segmentIndex):
     m = self.lib.ps3000aSetDataBuffer(c_int16(self.handle),
                                       c_enum(channel),
                                       c_void_p(), c_uint32(0),
                                       c_uint32(segmentIndex),
                                       c_enum(0))
     self.checkResult(m)
コード例 #6
0
ファイル: ps6000.py プロジェクト: jimisebben/pico-python
    def _lowLevelSetDataBuffers(self, channel, bufferMax, bufferMin, downSampleRatioMode):
        bufferMaxPtr = bufferMax.ctypes.data_as(POINTER(c_int16))
        bufferMinPtr = bufferMin.ctypes.data_as(POINTER(c_int16))
        bufferLth = len(bufferMax)

        m = self.lib.ps6000SetDataBuffers(c_int16(self.handle), c_enum(channel),
                                          bufferMaxPtr, bufferMinPtr, c_uint32(bufferLth),
                                          c_enum(downSampleRatioMode))
        self.checkResult(m)
コード例 #7
0
ファイル: ps6000.py プロジェクト: jimisebben/pico-python
    def _lowLevelSetDataBufferBulk(self, channel, buffer, waveform, downSampleRatioMode):
        bufferPtr = buffer.ctypes.data_as(POINTER(c_int16))
        bufferLth = len(buffer)

        m = self.lib.ps6000SetDataBufferBulk(
            c_int16(self.handle),
            c_enum(channel), bufferPtr, c_uint32(bufferLth),
            c_uint32(waveform), c_enum(downSampleRatioMode))
        self.checkResult(m)
コード例 #8
0
ファイル: ps3000.py プロジェクト: colinoflynn/pico-python
    def _lowLevelSetSimpleTrigger(self, enabled, trigsrc, threshold_adc,
                                  direction, delay, timeout_ms):
        # TODO: Fix 'auto' which is where trigger occurs in block.
        # Delay is not used

        m = self.lib.ps3000_set_trigger(
            c_int16(self.handle), c_enum(trigsrc), c_int16(threshold_adc),
            c_enum(direction), c_int16(delay), c_int16(timeout_ms))
        self.checkResult(m)
コード例 #9
0
ファイル: ps5000a.py プロジェクト: arunpersaud/pico-python
 def _lowLevelSetChannel(self, chNum, enabled, coupling, VRange, VOffset,
                         BWLimited):
     m = self.lib.ps5000aSetChannel(c_int16(self.handle), c_enum(chNum),
                                   c_int16(enabled), c_enum(coupling),
                                   c_enum(VRange), c_float(VOffset))
     self.checkResult(m)
     if BWLimited:
         m = self.lib.ps5000aSetBandwidthFilter(c_int16(self.handle), c_enum(chNum), c_enum(1))
     else:
         m = self.lib.ps5000aSetBandwidthFilter(c_int16(self.handle), c_enum(chNum), c_enum(0))
     self.checkResult(m)
コード例 #10
0
ファイル: ps6000.py プロジェクト: jimisebben/pico-python
    def _lowLevelGetAnalogueOffset(self, range, coupling):
        # TODO, populate properties with this function
        maximumVoltage = c_float()
        minimumVoltage = c_float()

        m = self.lib.ps6000GetAnalogueOffset(
            c_int16(self.handle), c_enum(range), c_enum(coupling),
            byref(maximumVoltage), byref(minimumVoltage))
        self.checkResult(m)

        return (maximumVoltage.value, minimumVoltage.value)
コード例 #11
0
ファイル: ps4000a.py プロジェクト: thennen/pico-python
    def _lowLevelRunStreaming(self, sampleInterval, sampleIntervalTimeUnits, maxPreTriggerSamples,
                              maxPostTriggerSamples, autoStop, downSampleRatio, downSampleRatioMode,
                              overviewBufferSize):
        m = self.lib.ps4000aRunStreaming(
            c_int16(self.handle),
            byref(c_uint32(sampleInterval)),
            c_enum(sampleIntervalTimeUnits),
            c_uint32(maxPreTriggerSamples),
            c_uint32(maxPostTriggerSamples),
            c_int16(autoStop),
            c_uint32(downSampleRatio),
            c_enum(downSampleRatioMode),
            c_uint32(overviewBufferSize))

        self.checkResult(m)
コード例 #12
0
ファイル: ps4000a.py プロジェクト: colinoflynn/pico-python
    def _lowLevelGetTriggerTimeOffset(self, segmentIndex):
        time = c_uint64()
        timeUnits = c_enum()

        m = self.lib.ps4000aGetTriggerTimeOffset64(
            c_int16(self.handle),
            byref(time),
            byref(timeUnits),
            c_uint16(segmentIndex))

        self.checkResult(m)

        if timeUnits.value == 0:  # PS4000a_FS
            return time.value * 1E-15
        elif timeUnits.value == 1:  # PS4000a_PS
            return time.value * 1E-12
        elif timeUnits.value == 2:  # PS4000a_NS
            return time.value * 1E-9
        elif timeUnits.value == 3:  # PS4000a_US
            return time.value * 1E-6
        elif timeUnits.value == 4:  # PS4000a_MS
            return time.value * 1E-3
        elif timeUnits.value == 5:  # PS4000a_S
            return time.value * 1E0
        else:
            raise TypeError("Unknown timeUnits %d" % timeUnits.value)
コード例 #13
0
ファイル: ps6000.py プロジェクト: jimisebben/pico-python
 def _lowLevelSetSigGenBuiltInSimple(self, offsetVoltage, pkToPk, waveType,
                                     frequency, shots, triggerType,
                                     triggerSource):
     # TODO, I just noticed that V2 exists
     # Maybe change to V2 in the future
     m = self.lib.ps6000SetSigGenBuiltIn(
         c_int16(self.handle),
         c_int32(int(offsetVoltage * 1000000)),
         c_int32(int(pkToPk        * 1000000)),
         c_int16(waveType),
         c_float(frequency), c_float(frequency),
         c_float(0), c_float(0), c_enum(0), c_enum(0),
         c_uint32(shots), c_uint32(0),
         c_enum(triggerType), c_enum(triggerSource),
         c_int16(0))
     self.checkResult(m)
コード例 #14
0
ファイル: ps4000.py プロジェクト: no-net/pico-python
    def _lowLevelGetUnitInfo(self, info):
        s = create_string_buffer(256)
        requiredSize = c_int16(0)

        m = self.lib.ps4000GetUnitInfo(c_int16(self.handle), byref(s),
                                       c_int16(len(s)), byref(requiredSize),
                                       c_enum(info))
        self.checkResult(m)
        if requiredSize.value > len(s):
            s = create_string_buffer(requiredSize.value + 1)
            m = self.lib.ps4000GetUnitInfo(c_int16(self.handle), byref(s),
                                           c_int16(len(s)),
                                           byref(requiredSize), c_enum(info))
            self.checkResult(m)

        return s.value
コード例 #15
0
ファイル: ps5000a.py プロジェクト: arunpersaud/pico-python
    def _lowLevelSetDataBuffer(self, channel, data, downSampleMode, segmentIndex):
        """
        data should be a numpy array

        Be sure to call _lowLevelClearDataBuffer
        when you are done with the data array
        or else subsequent calls to GetValue will still use the same array.
        """
        dataPtr = data.ctypes.data_as(POINTER(c_int16))
        numSamples = len(data)

        m = self.lib.ps5000aSetDataBuffer(c_int16(self.handle), c_enum(channel),
                                         dataPtr, c_int32(numSamples),
                                         c_uint32(segmentIndex),
                                         c_enum(downSampleMode))
        self.checkResult(m)
コード例 #16
0
ファイル: ps4000a.py プロジェクト: colinoflynn/pico-python
 def _lowLevelClearDataBuffers(self, channel):
     m = self.lib.ps4000aSetDataBuffers(
         c_int16(self.handle),
         c_enum(channel),
         c_void_p(),
         c_void_p(),
         c_uint32(0))
     self.checkResult(m)
コード例 #17
0
ファイル: ps5000a.py プロジェクト: colinoflynn/pico-python
    def _lowLevelSetChannel(self, chNum, enabled, coupling, VRange, VOffset,
                            bandwidth):
        m = self.lib.ps5000aSetChannel(c_int16(self.handle), c_enum(chNum),
                                       c_int16(enabled), c_enum(coupling),
                                       c_enum(VRange), c_float(VOffset))
        self.checkResult(m)

        # The error this might through are
        #    INVALID_HANDLE
        #    INVALID_CHANNEL
        #    INVALID_BANDWIDTH
        # Invalid bandwidth is the only case that could go wrong.
        # The others would be thrown above (assuming no race condition:
        # i.e. unplugging the scope in between this call.
        # I decided to keep the logic below to avoid a possible error
        # picobase/SetChannel should be changed to the following
        # Set the channel
        # save the new channel settings
        # check if ps5000a
        # change the bandwidth separately
        # changing the bandwidth would be it's own function (implemented below)
        if bandwidth:
            m = self.lib.ps5000aSetBandwidthFilter(c_int16(self.handle),
                                                   c_enum(chNum), c_enum(1))
        else:
            m = self.lib.ps5000aSetBandwidthFilter(c_int16(self.handle),
                                                   c_enum(chNum), c_enum(0))
        self.checkResult(m)
コード例 #18
0
ファイル: ps6000.py プロジェクト: colinoflynn/pico-python
    def _lowLevelSetDataBuffer(self, channel, data, downSampleMode,
                               segmentIndex):
        """Set the data buffer.

        Be sure to call _lowLevelClearDataBuffer
        when you are done with the data array
        or else subsequent calls to GetValue will still use the same array.

        segmentIndex is unused, but required by other versions of the API
        (eg PS5000a)
        """
        dataPtr = data.ctypes.data_as(POINTER(c_int16))
        numSamples = len(data)

        m = self.lib.ps6000SetDataBuffer(c_int16(self.handle), c_enum(channel),
                                         dataPtr, c_uint32(numSamples),
                                         c_enum(downSampleMode))
        self.checkResult(m)
コード例 #19
0
ファイル: ps4000a.py プロジェクト: colinoflynn/pico-python
    def _lowLevelGetUnitInfo(self, info):
        s = create_string_buffer(256)
        requiredSize = c_int16(0)

        m = self.lib.ps4000aGetUnitInfo(c_int16(self.handle), byref(s),
                                        c_int16(len(s)), byref(requiredSize),
                                        c_enum(info))
        self.checkResult(m)
        if requiredSize.value > len(s):
            s = create_string_buffer(requiredSize.value + 1)
            m = self.lib.ps4000aGetUnitInfo(c_int16(self.handle), byref(s),
                                            c_int16(len(s)),
                                            byref(requiredSize), c_enum(info))
            self.checkResult(m)

        # should this bee ascii instead?
        # I think they are equivalent...
        return s.value.decode('utf-8')
コード例 #20
0
ファイル: ps4000.py プロジェクト: thennen/pico-python
    def _lowLevelSetSigGenBuiltInSimple(self, offsetVoltage, pkToPk, waveType,
                                        frequency, shots, triggerType, 
                                        triggerSource, stopFreq, increment, 
                                        dwellTime, sweepType, numSweeps):
        if stopFreq is None:
            stopFreq = frequency

        m = self.lib.ps4000SetSigGenBuiltIn(
            c_int16(self.handle),
            c_int32(int(offsetVoltage * 1000000)),
            c_int32(int(pkToPk        * 1000000)),
            c_int16(waveType),
            c_float(frequency), c_float(stopFreq),
            c_float(increment), c_float(dwellTime), c_enum(sweepType), c_enum(0),
            c_uint32(shots), c_uint32(numSweeps),
            c_enum(triggerType), c_enum(triggerSource),
            c_int16(0))
        self.checkResult(m)
コード例 #21
0
ファイル: ps3000.py プロジェクト: colinoflynn/pico-python
    def _lowLevelGetUnitInfo(self, info):
        s = create_string_buffer(256)

        m = self.lib.ps3000_get_unit_info(
            c_int16(self.handle), byref(s), c_int16(len(s)), c_enum(info))
        self.checkResult(m)

        # should this bee ascii instead?
        # I think they are equivalent...
        return s.value.decode('utf-8')
コード例 #22
0
ファイル: ps6000.py プロジェクト: jimisebben/pico-python
    def _lowLevelGetMaxDownSampleRatio(self, noOfUnaggregatedSamples,
                                       downSampleRatioMode, segmentIndex):
        maxDownSampleRatio = c_uint32()

        m = self.lib.ps6000GetMaxDownSampleRatio(
            c_int16(self.handle), c_uint32(noOfUnaggregatedSamples), byref(maxDownSampleRatio),
            c_enum(downSampleRatioMode), c_uint32(segmentIndex))
        self.checkResult(m)

        return maxDownSampleRatio.value
コード例 #23
0
ファイル: ps3000.py プロジェクト: haymeister/pico-python
 def _lowLevelGetUnitInfo(self, info):
     s = create_string_buffer(256)
     m = self.lib.ps3000_get_unit_info(c_int16(self.handle), byref(s),
                                       c_int16(len(s)), c_enum(info))
     if m == 0:
         raise IOError('Error calling %s: parameter out of range' % (inspect.stack()[1][3]))
     else:
         print('%d bytes returned' % (m))
     # should this be ascii instead?
     # I think they are equivalent...
     return s.value.decode('utf-8')
コード例 #24
0
ファイル: ps2000.py プロジェクト: arunpersaud/pico-python
 def _lowLevelSetSigGenBuiltInSimple(self, offsetVoltage, pkToPk, waveType,
                                     frequency, shots, triggerType,
                                     triggerSource):
     m = self.lib.ps2000_set_sig_gen_built_in(
         c_int16(self.handle),
         c_int32(int(offsetVoltage * 1000000)),
         c_int32(int(pkToPk        * 1000000)),
         c_int16(waveType),
         c_float(frequency), c_float(frequency),
         c_float(0), c_float(0), c_enum(0), c_uint32(0))
     self.checkResult(m)
コード例 #25
0
ファイル: ps6000.py プロジェクト: jimisebben/pico-python
    def _lowLevelGetValuesBulk(self, numSamples, fromSegmentIndex, toSegmentIndex,
                               downSampleRatio, downSampleRatioMode):
        noOfSamples = c_uint32(numSamples)
        overflow = c_int16()

        m = self.lib.ps6000GetvaluesBulk(
            c_int16(self.handle),
            c_uint32(fromSegmentIndex), c_uint32(toSegmentIndex),
            c_uint32(downSampleRatio), c_enum(downSampleRatioMode),
            byref(overflow))
        self.checkResult(m)
        return (noOfSamples.value, overflow.value)
コード例 #26
0
ファイル: ps4000a.py プロジェクト: colinoflynn/pico-python
 def _lowLevelGetValues(self, numSamples, startIndex, downSampleRatio,
                        downSampleMode, segmentIndex):
     numSamplesReturned = c_uint32()
     numSamplesReturned.value = numSamples
     overflow = c_int16()
     m = self.lib.ps4000aGetValues(
         c_int16(self.handle), c_uint32(startIndex),
         byref(numSamplesReturned), c_uint32(downSampleRatio),
         c_enum(downSampleMode), c_uint16(segmentIndex),
         byref(overflow))
     self.checkResult(m)
     return (numSamplesReturned.value, overflow.value)
コード例 #27
0
ファイル: ps3000a.py プロジェクト: colinoflynn/pico-python
    def _lowLevelSetSigGenBuiltInSimple(self, offsetVoltage, pkToPk, waveType,
                                        frequency, shots, triggerType,
                                        triggerSource, stopFreq, increment,
                                        dwellTime, sweepType, numSweeps):
        # TODO, I just noticed that V2 exists
        # Maybe change to V2 in the future
        if stopFreq is None:
            stopFreq = frequency

        m = self.lib.ps3000aSetSigGenBuiltIn(
            c_int16(self.handle),
            c_int32(int(offsetVoltage * 1000000)),
            c_int32(int(pkToPk * 1000000)),
            c_int16(waveType),
            c_float(frequency), c_float(stopFreq),
            c_float(increment), c_float(dwellTime),
            c_enum(sweepType), c_enum(0),
            c_uint32(shots), c_uint32(numSweeps),
            c_enum(triggerType), c_enum(triggerSource),
            c_int16(0))
        self.checkResult(m)
コード例 #28
0
ファイル: ps4000a.py プロジェクト: colinoflynn/pico-python
 def _lowLevelGetValuesBulk(self, numSamples, fromSegment, toSegment,
                            downSampleRatio, downSampleMode, overflow):
     """Copy data from several memory segments at once."""
     overflowPoint = overflow.ctypes.data_as(POINTER(c_int16))
     m = self.lib.ps4000aGetValuesBulk(
         c_int16(self.handle),
         byref(c_int32(numSamples)),
         c_int32(fromSegment),
         c_int32(toSegment),
         c_int32(downSampleRatio),
         c_enum(downSampleMode),
         overflowPoint
     )
     self.checkResult(m)
コード例 #29
0
ファイル: ps6000.py プロジェクト: thennen/pico-python
    def _lowLevelGetValuesBulk(self,
                               numSamples, fromSegmentIndex, toSegmentIndex,
                               downSampleRatio, downSampleRatioMode,
                               overflow):
        noOfSamples = c_uint32(numSamples)

        m = self.lib.ps6000GetValuesBulk(
            c_int16(self.handle),
            byref(noOfSamples),
            c_uint32(fromSegmentIndex), c_uint32(toSegmentIndex),
            c_uint32(downSampleRatio), c_enum(downSampleRatioMode),
            overflow.ctypes.data_as(POINTER(c_int16))
            )
        self.checkResult(m)
        return noOfSamples.value
コード例 #30
0
ファイル: ps4000a.py プロジェクト: thennen/pico-python
    def _lowLevelSetDataBuffer(self, channel, data, downSampleMode, segmentIndex):
        """
        data should be a numpy array.

        Be sure to call _lowLevelClearDataBuffer
        when you are done with the data array
        or else subsequent calls to GetValue will still use the same array.

        segmentIndex is unused, but required by other versions of the API (eg PS5000a)

        """
        numSamples = len(data)

        m = self.lib.ps4000aSetDataBuffer(c_int16(self.handle), c_enum(channel),
                                          byref(data), c_uint32(numSamples),
                                          c_uint32(segmentIndex), c_uint32(downSampleMode))
        self.checkResult(m)
コード例 #31
0
 def GetCurrentHistogram(self, ch, H):
     counts, real_t, dead_t, acqStatus = c_uint32(), c_uint64(), c_uint64(
     ), c_enum()
     R = self.RQ(
         self.dpplib.CAENDPP_GetCurrentHistogram(self.handle, c_int32(ch),
                                                 byref(H), byref(counts),
                                                 byref(real_t),
                                                 byref(dead_t),
                                                 byref(acqStatus)))
     if R:
         return {
             'counts': counts.value,
             'real_t': float('{:.8f}'.format(real_t.value * 1e-9)),
             'dead_t': float('{:.8f}'.format(dead_t.value * 1e-9)),
             'acqStatus': acqStatus.value
         }
     else:
         return False
コード例 #32
0
ファイル: ps4000.py プロジェクト: morgatron/pico-python
    def _lowLevelSetDataBuffer(self, channel, data, downSampleMode,
                               segmentIndex):
        """
        data should be a numpy array.

        Be sure to call _lowLevelClearDataBuffer
        when you are done with the data array
        or else subsequent calls to GetValue will still use the same array.

        segmentIndex is unused, but required by other versions of the API (eg PS5000a)

        """
        dataPtr = data.ctypes.data_as(POINTER(c_int16))
        numSamples = len(data)

        m = self.lib.ps4000SetDataBuffer(c_int16(self.handle), c_enum(channel),
                                         dataPtr, c_uint32(numSamples))
        self.checkResult(m)
コード例 #33
0
    def _lowLevelSetDataBuffer(self, channel, data, downSampleMode,
                               segmentIndex):
        """Set the data buffer.

        Be sure to call _lowLevelClearDataBuffer
        when you are done with the data array
        or else subsequent calls to GetValue will still use the same array.

        segmentIndex is unused, but required by other versions of the API
        (eg PS5000a)
        """
        numSamples = len(data)

        m = self.lib.ps4000aSetDataBuffer(c_int16(self.handle),
                                          c_enum(channel), byref(data),
                                          c_uint32(numSamples),
                                          c_uint32(segmentIndex),
                                          c_uint32(downSampleMode))
        self.checkResult(m)
コード例 #34
0
    def _lowLevelGetValues(self, numSamples, startIndex, downSampleRatio,
                           downSampleMode, segmentIndex):

        #TODO: Check overflow in channelBuffersLen against numSamples, but need to
        #      not raise error if channelBuffersPtr is void

        overflow = c_int16()
        numSamples = c_uint32(numSamples)
        m = self.lib.ps4000aGetValues(
            c_int16(self.handle),
            c_uint32(startIndex),
            byref(numSamples),
            c_uint32(downSampleRatio),  #downsample factor
            c_enum(downSampleMode),
            c_uint32(segmentIndex),
            byref(overflow))
        if m == 0:
            return (numSamples.value, overflow.value)
        else:
            self.checkResult(m)
コード例 #35
0
ファイル: ps6000.py プロジェクト: mzszym/pico-python
    def _lowLevelGetTriggerTimeOffset(self, segmentIndex):
        time = c_uint64()
        timeUnits = c_enum()

        m = self.lib.ps6000GetTriggerTimeOffset64(c_int16(self.handle), byref(time),
                                                  byref(timeUnits), c_uint32(segmentIndex))
        self.checkResult(m)

        if timeUnits.value == 0:    # PS6000_FS
            return time.value * 1E-15
        elif timeUnits.value == 1:  # PS6000_PS
            return time.value * 1E-12
        elif timeUnits.value == 2:  # PS6000_NS
            return time.value * 1E-9
        elif timeUnits.value == 3:  # PS6000_US
            return time.value * 1E-6
        elif timeUnits.value == 4:  # PS6000_MS
            return time.value * 1E-3
        elif timeUnits.value == 5:  # PS6000_S
            return time.value * 1E0
        else:
            raise TypeError("Unknown timeUnits %d" % timeUnits.value)
コード例 #36
0
 def _lowLevelClearDataBuffer(self, channel, segmentIndex):
     """Clear the data in the picoscope."""
     m = self.lib.ps2000aSetDataBuffer(
         c_int16(self.handle), c_enum(channel),
         c_void_p(), c_uint32(0), c_uint32(segmentIndex), c_enum(0))
     self.checkResult(m)
コード例 #37
0
    def _lowLevelRunStreaming(self, sampleInterval, sampleIntervalTimeUnits, maxPreTriggerSamples, maxPostTriggerSamples, autoStop, downSampleRatio, downSampleRatioMode, overviewBufferSize):
        sampleInterval_c=c_uint32(sampleInterval)
        m = self.lib.ps5000aRunStreaming(c_int16(self.handle), byref(sampleInterval_c), c_enum(sampleIntervalTimeUnits), c_uint32(maxPreTriggerSamples), c_uint32(maxPostTriggerSamples), c_int16(autoStop), c_uint32(downSampleRatio), c_enum(downSampleRatioMode), c_uint32(overviewBufferSize))
        self.streamReady=False
        self.checkResult(m)
        print(sampleInterval_c)

        return
コード例 #38
0
 def _lowLevelSetDeviceResolution(self, resolution):
     self.resolution = resolution
     m = self.lib.ps4000aSetDeviceResolution(
         c_int16(self.handle),
         c_enum(resolution))
     self.checkResult(m)
コード例 #39
0
 def SetInputRange(self, ch):
     ir = c_enum(self.inputRange[ch])
     return self.RQ(
         self.dpplib.CAENDPP_SetInputRange(self.handle, c_int32(ch), ir))
コード例 #40
0
ファイル: ps5000a.py プロジェクト: wanming2008/pico-python
 def _lowLevelChangePowerSource(self, powerstate):
     m = self.lib.ps5000aChangePowerSource(c_int16(self.handle),
                                           c_enum(powerstate))
     self.checkResult(m)
コード例 #41
0
ファイル: ps4000.py プロジェクト: greyltc/pico-python
 def _lowLevelSetExtTriggerRange(self, VRange):
     m = self.lib.ps4000SetExtTriggerRange(c_int16(self.handle),
                                           c_enum(VRange))
     self.checkResult(m)
コード例 #42
0
ファイル: ps4000.py プロジェクト: greyltc/pico-python
    def _lowLevelSigGenSoftwareControl(self, triggerType):

        m = self.lib.ps4000SigGenSoftwareControl(c_int16(self.handle),
                                                 c_enum(triggerType))
        self.checkResult(m)
コード例 #43
0
ファイル: ps4000.py プロジェクト: greyltc/pico-python
 def _lowLevelClearDataBuffer(self, channel, segmentIndex):
     m = self.lib.ps4000SetDataBuffer(c_int16(self.handle), c_enum(channel),
                                      c_void_p(), c_uint32(0), c_enum(0))
     self.checkResult(m)
コード例 #44
0
ファイル: ps4000a.py プロジェクト: morgatron/pico-python
 def _lowLevelClearDataBuffer(self, channel, segmentIndex):
     """data should be a numpy array."""
     m = self.lib.ps4000aSetDataBuffer(c_int16(self.handle),
                                       c_enum(channel), c_void_p(),
                                       c_uint32(0), c_uint32(0), c_enum(0))
     self.checkResult(m)
コード例 #45
0
class CAEN_DPP(HVPS, DGTZ):
    dpplib = cdll.LoadLibrary("libCAENDPPLib.so")
    linknum = 0
    acqMode = 0  # Waveform = 0, Histogram = 1
    trigger = 0  # Normal= 0, Auto = 1
    link = DPP_ConnectionParams()
    link.LinkType = link.LinkTypes['USB']
    boardConfig = DPP_DgtzParams()
    inputRange = [0] * MAX_NUMCHB
    inputRanges = [
        float(e.replace(",", ".")) for e in DPP_Probes["InputRanges"]
    ]
    boardInfo = DPP_Info()
    Traces = DPP_Traces()
    is_board_acq = c_int32()
    is_chann_acq = c_enum()

    def RQ(self, s):
        if not s: return True
        else:
            print(DPP_ErrorCode[s])
            return False

    def InitLibrary(self):
        self.handle = c_int32(-1)
        return self.RQ(self.dpplib.CAENDPP_InitLibrary(byref(self.handle)))

    def AddBoard(self):
        self.boardId = c_int32()
        self.link.LinkNum = c_int32(self.linknum)
        return self.RQ(
            self.dpplib.CAENDPP_AddBoard(self.handle, self.link,
                                         byref(self.boardId)))

    def EndLibrary(self):
        return self.RQ(self.dpplib.CAENDPP_EndLibrary(self.handle))

    def ResetConfiguration(self):
        return self.RQ(
            self.dpplib.CAENDPP_ResetConfiguration(self.handle, self.boardId))

    def GetDPPInfo(self):
        return self.RQ(
            self.dpplib.CAENDPP_GetDPPInfo(self.handle, self.boardId,
                                           byref(self.boardInfo)))

    def CheckBoardCommunication(self):
        return self.RQ(
            self.dpplib.CAENDPP_CheckBoardCommunication(
                self.handle, self.boardId))

    def GetInfoDict(self, attr_number, attr_list):
        R = {}
        for r in range(getattr(self.boardInfo, attr_number)):
            num = getattr(self.boardInfo, attr_list)[r]
            name = DPP_Probes[attr_list][num]
            R[name] = num


#      print(r, num, name)
        return R

    def GetBoardConfiguration(self):
        self.acqcMode = c_enum(self.acqMode)
        return self.RQ(
            self.dpplib.CAENDPP_GetBoardConfiguration(self.handle,
                                                      self.boardId,
                                                      byref(self.acqcMode),
                                                      byref(self.boardConfig)))

    def SetBoardConfiguration(self):
        self.acqcMode = c_enum(self.acqMode)
        return self.RQ(
            self.dpplib.CAENDPP_SetBoardConfiguration(self.handle,
                                                      self.boardId,
                                                      self.acqcMode,
                                                      self.boardConfig))

    def Board_Reconfigure(self, ch):
        status = self.IsChannelAcquiring(ch)
        if status != 0: self.StopAcquisition(ch)
        self.SetBoardConfiguration()
        if status != 0: self.StartAcquisition(ch)
コード例 #46
0
ファイル: ps4000a.py プロジェクト: morgatron/pico-python
 def _lowLevelSetChannel(self, chNum, enabled, coupling, VRange, VOffset,
                         BWLimited):
     m = self.lib.ps4000aSetChannel(c_int16(self.handle), c_enum(chNum),
                                    c_int16(enabled), c_enum(coupling),
                                    c_enum(VRange), c_float(VOffset))
     self.checkResult(m)
コード例 #47
0
 def _lowLevelSetBandwidthFilter(self, channel, bandwidth):
     m = self.lib.ps5000aSetBandwidthFilter(c_int16(self.handle),
                                            c_enum(channel),
                                            c_enum(bandwidth))
     self.checkResult(m)
コード例 #48
0
ファイル: ps4000a.py プロジェクト: morgatron/pico-python
 def _lowLevelClearDataBuffers(self, channel):
     m = self.lib.ps4000aSetDataBuffers(c_int16(self.handle),
                                        c_enum(channel), c_void_p(),
                                        c_void_p(), c_uint32(0))
     self.checkResult(m)
コード例 #49
0
ファイル: HEAD.py プロジェクト: muchnoi/HPGe-Acquisition
                ("RampDown", c_double), ("VMax", c_double), ("PWDownMode",
                                                             c_int32))


# D P P   P A R A M E T E R S   S E C T I O N

MAX_GW = 1000  # Max number of generic write register in the Config File
MAX_NUMCHB = 16  # Max number of channels per board
MAX_NUMCHB_COINCIDENCE = MAX_NUMCHB + 1  # Max number of channels for coincidences (add external channel)
MAX_LISTFILE_LENGTH = 155  # Max binary file filename length
MAX_LIST_BUFF_NEV = 8192  # Max size of the list events memory buffer
MAX_GPIO_NUM = 2
MAX_RUNNAME = 128

DPP_ParamID = {
    'RecordLength': c_enum(0),
    'PreTrigger': c_enum(1),
    'Decay': c_enum(2),
    'TrapRise': c_enum(3),
    'TrapFlat': c_enum(4),
    'TrapFlatDelay': c_enum(5),
    'Smoothing': c_enum(6),
    'InputRise': c_enum(7),
    'Threshold': c_enum(8),
    'NSBL': c_enum(9),
    'NSPK': c_enum(10),
    'PKHO': c_enum(11),
    'BLHO': c_enum(12),
    'TRGHO': c_enum(13),
    'DGain': c_enum(14),
    'ENF': c_enum(15),