示例#1
0
    def get_interval_from_timebase(self, timebase, num_samples=1000):
        """Get sampling interval for given timebase.

        :param timebase: timebase setting (see programmers guide for reference)
        :param num_samples: number of samples required

        :returns: sampling interval in nanoseconds
        """
        interval = ctypes.c_float()
        assert_pico_ok(
            ps.ps3000aGetTimebase2(self._handle, timebase, num_samples,
                                   ctypes.byref(interval), 1, None, 0))
        return interval.value
示例#2
0
 def setTimebase(self,
                 postTriggerSamples=0,
                 preTriggerSamples=0,
                 timebase=2):
     # Gets timebase innfomation
     # Handle = chandle
     # Timebase = 2 = timebase
     # Nosample = maxsamples
     # TimeIntervalNanoseconds = ctypes.byref(timeIntervalns)
     # MaxSamples = ctypes.byref(returnedMaxSamples)
     # Segement index = 0
     self.timebase = timebase
     self.preTriggerSamples = int(preTriggerSamples)
     self.postTriggerSamples = int(postTriggerSamples)
     self.maxsamples = preTriggerSamples + postTriggerSamples
     self.timeIntervalns = ctypes.c_float()
     self.returnedMaxSamples = ctypes.c_int16()
     segment_index = 0
     self.status["GetTimebase"] = ps.ps3000aGetTimebase2(
         self.chandle, timebase, self.maxsamples,
         ctypes.byref(self.timeIntervalns), 1,
         ctypes.byref(self.returnedMaxSamples), segment_index)
     assert_pico_ok(self.status["GetTimebase"])
示例#3
0
totalSamples = preTriggerSamples + postTriggerSamples

# Gets timebase information
# handle = chandle
# timebase = 1252
# Nosample = totalSamples
# TimeIntervalNanoseconds = ctypes.byref(timeIntervalNs)
# MaxSamples = ctypes.byref(returnedMaxSamples)
# Segement index = 0
timebase = 1252
timeIntervalNs = ctypes.c_float()
returnedMaxSamples = ctypes.c_int16()
status["GetTimebase"] = ps.ps3000aGetTimebase2(chandle,
                                               timebase,
                                               totalSamples,
                                               ctypes.byref(timeIntervalNs),
                                               1,
                                               ctypes.byref(returnedMaxSamples),
                                               0)
assert_pico_ok(status["GetTimebase"])

# Create buffers ready for assigning pointers for data collection
bufferDPort0Max = (ctypes.c_int16 * totalSamples)()
bufferDPort0Min = (ctypes.c_int16 * totalSamples)()

# Set the data buffer location for data collection from PS3000A_DIGITAL_PORT0
# handle = chandle
# source = PS3000A_DIGITAL_PORT0 = 0x80
# Buffer max = ctypes.byref(bufferDPort0Max)
# Buffer min = ctypes.byref(bufferDPort0Min)
# Buffer length = totalSamples